MessageDialog.cs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using MECF.Framework.UI.Client.ClientBase;
  7. namespace OpenSEMI.ClientBase
  8. {
  9. public class MessageDialog : DialogViewModel<DialogButton>
  10. {
  11. private string m_text;
  12. public string Text
  13. {
  14. get { return m_text; }
  15. set { m_text = value; NotifyOfPropertyChange("Text"); }
  16. }
  17. public DialogButton DialogButton
  18. {
  19. set
  20. {
  21. this.m_buttons.Clear();
  22. foreach (int v in Enum.GetValues(typeof(DialogButton)))
  23. {
  24. DialogButton m_btn = (DialogButton)v;
  25. if (value.HasFlag(m_btn))
  26. {
  27. ButtonControl bc = new ButtonControl();
  28. bc.Name = m_btn.ToString();
  29. if (m_btn == DialogButton.OK || m_btn == DialogButton.Yes)
  30. bc.IsDefault = true;
  31. else
  32. bc.IsDefault = false;
  33. if (m_btn == DialogButton.Cancel || m_btn == DialogButton.No)
  34. bc.IsCancel = true;
  35. else
  36. bc.IsCancel = false;
  37. m_buttons.Add(bc);
  38. }
  39. }
  40. }
  41. }
  42. private List<ButtonControl> m_buttons = new List<ButtonControl>();
  43. public List<ButtonControl> Buttons
  44. {
  45. get { return m_buttons; }
  46. }
  47. private DialogType m_DialogType = DialogType.INFO;
  48. public DialogType DialogType
  49. {
  50. get { return m_DialogType; }
  51. set { m_DialogType = value; NotifyOfPropertyChange("DialogType"); }
  52. }
  53. }
  54. public class ButtonControl
  55. {
  56. public string Name { get; set; }
  57. public bool IsDefault { get; set; }
  58. public bool IsCancel { get; set; }
  59. }
  60. }