public void Remove(eIcon ico) { if (ActiveIcons.Contains(ico)) { ActiveIcons.Remove(ico); } }
public void Add(eIcon ico) { if (!ActiveIcons.Contains(ico)) { ActiveIcons.Add(ico); } }
public Icon GetIcon(eIcon eI) { foreach (var iconInfo in Icons) { if (iconInfo.Key == eI) { return(iconInfo.Value); } } return(Icons[0]); }
/// <summary>Set fields by converting values from that untyped binary JSON.</summary> protected internal FileBase(bool isFolder, IReadOnlyDictionary <string, object> dict) { parentFolderId = dict.getLong("parentfolderid", 0); id = dict.getLong(isFolder ? "folderid" : "fileid"); name = (string)dict["name"]; created = dict.getTimestamp("created"); modified = dict.getTimestamp("modified"); string iconString = dict.lookup("icon") as string; if (null == iconString || !Enum.TryParse(iconString, true, out icon)) { icon = eIcon.None; } category = (eCategory)dict.getInt("category", (int)eCategory.Uncategorized); }
internal void Register(Icon icon, eIcon eIcon) { Icons.Add(eIcon, icon); }
public void Swap(eIcon old, eIcon ne) { ActiveIcons.Remove(old); ActiveIcons.Add(ne); }
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ /// <summary> /// Constructor /// </summary> public frmMsgBox(Form i_Owner, string s_Text, string s_Caption, eIcon e_Icon, MessageBoxButtons e_Buttons, MessageBoxDefaultButton e_DefaultBtn) { InitializeComponent(); this.Owner = i_Owner; this.TopMost = (i_Owner == null); this.ShowInTaskbar = false; // ShowInTaskbar can NOT be combined with TopMost !!! this.Text = s_Caption; this.lblMessage.Text = s_Text; this.DialogResult = DialogResult.None; switch (e_Buttons) { case MessageBoxButtons.OK: btnLeft.Text = "OK"; btnLeft.DialogResult = DialogResult.OK; btnMid. Visible = false; btnRight.Visible = false; break; case MessageBoxButtons.OKCancel: btnLeft.Text = "OK"; btnLeft.DialogResult = DialogResult.OK; btnMid.Text = "Cancel"; btnMid.DialogResult = DialogResult.Cancel; btnRight.Visible = false; break; case MessageBoxButtons.YesNo: btnLeft.Text = "Yes"; btnLeft.DialogResult = DialogResult.Yes; btnMid.Text = "No"; btnMid.DialogResult = DialogResult.No; btnRight.Visible = false; break; case MessageBoxButtons.RetryCancel: btnLeft.Text = "Retry"; btnLeft.DialogResult = DialogResult.Retry; btnMid.Text = "Cancel"; btnMid.DialogResult = DialogResult.Cancel; btnRight.Visible = false; break; case MessageBoxButtons.YesNoCancel: btnLeft.Text = "Yes"; btnLeft.DialogResult = DialogResult.Yes; btnMid.Text = "No"; btnMid.DialogResult = DialogResult.No; btnRight.Text = "Cancel"; btnRight.DialogResult = DialogResult.Cancel; break; default: throw new Exception("MessageBoxButtons not supported"); } // swap the Tab indexes if (e_DefaultBtn == MessageBoxDefaultButton.Button2) { btnMid. TabIndex = 1; btnLeft.TabIndex = 2; } if (e_DefaultBtn == MessageBoxDefaultButton.Button3) { btnRight.TabIndex = 1; btnLeft. TabIndex = 2; btnMid. TabIndex = 3; } switch (e_Icon) { case eIcon.Info: // == Asterisk picIcon.Icon = SystemIcons.Asterisk; break; case eIcon.Error: // == Stop == Hand picIcon.Icon = SystemIcons.Hand; break; case eIcon.Warning: // == Exclamation picIcon.Icon = SystemIcons.Warning; break; case eIcon.Question: picIcon.Icon = SystemIcons.Question; break; case eIcon.Butterfly: picIcon.Icon = null; // The icon is stored in the resources break; case eIcon.Alarm: picIcon.Icon = Functions.ReadEmbeddedIconResource("Stop.ico"); // Set red messagebox background Color col_Back = Color.FromArgb(0xFF, 0xAA, 0x00); Color col_Btn = Color.FromArgb(0xFF, 0x00, 0x00); this.BackColor = col_Back; lblMessage.BackColor = col_Back; picIcon.BackColor = col_Back; btnLeft. BackColor = col_Btn; btnMid. BackColor = col_Btn; btnRight.BackColor = col_Btn; break; } }