ChatGPTAIRewritingContentViewModel.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using PDF_Master.Helper;
  2. using Prism.Commands;
  3. using Prism.Mvvm;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Windows.Forms;
  8. namespace PDF_Master.ViewModels.HomePanel.ChatGPTAI
  9. {
  10. public class ChatGPTAIRewritingContentViewModel : BindableBase
  11. {
  12. private string inputText;
  13. public string InputText
  14. {
  15. get { return inputText; }
  16. set
  17. {
  18. SetProperty(ref inputText, value);
  19. }
  20. }
  21. private string rewriteText;
  22. public string RewriteText
  23. {
  24. get { return rewriteText; }
  25. set
  26. {
  27. SetProperty(ref rewriteText, value);
  28. }
  29. }
  30. public DelegateCommand CopyCommand { get; set; }
  31. public DelegateCommand RewriteCommand { get; set; }
  32. public ChatGPTAIRewritingContentViewModel()
  33. {
  34. CopyCommand = new DelegateCommand(copy);
  35. RewriteCommand = new DelegateCommand(rewrite);
  36. }
  37. public void copy()
  38. {
  39. try
  40. {
  41. Clipboard.SetText(RewriteText);
  42. }
  43. catch { }
  44. }
  45. public async void rewrite() {
  46. RewriteText= await ChatGTPAIHelper.Rewrite(InputText);
  47. }
  48. }
  49. }