public void ImageFromMsgLevel(PictureBox pic, MessageLevels msgLevel) { switch (msgLevel) { case MessageLevels.Error: pic.Image = Properties.Resources.Checkbox_Error; pic.Name = ""; break; case MessageLevels.Warning: pic.Image = Properties.Resources.Checkbox_Warning; pic.Name = ""; break; case MessageLevels.Ok: pic.Image = Properties.Resources.Checkbox_Ok; pic.Name = ""; break; case MessageLevels.Animate: if (pic.Name.StartsWith(_ctrlRoundRobinName)) { break; } pic.Image = Properties.Resources.Checkbox_Work0; pic.Name = CreateAnimControlName(0); break; default: pic.Image = Properties.Resources.Checkbox_Ok; break; } }
public void GetFirstImage(PictureBox pic, string modkey, MessageLevels msgLevel) { //no mod key. no anime for you buddy. if (string.IsNullOrEmpty(modkey) && msgLevel == MessageLevels.Animate && Debugger.IsAttached) { throw new Exception("Developer mind melt. this is wrong"); } ImageFromMsgLevel(pic, msgLevel); }
private bool MessageFilter(object item) { if (!(item is IMessage message)) { return(false); } foreach (var level in MessageLevels.Where(l => l.Show)) { if (message.Level == level.Level) { return(true); } } return(false); }
private void Notify(string msg, MessageLevels msgLevel, string modKey = "") { if (picCheckbox.IsDisposed || picCheckbox.Disposing) { return; } picCheckbox.Invoke(new Action(() => { try { bool modKeyFound = false; if (!string.IsNullOrEmpty(modKey)) { foreach (Control ctrl in Controls) { if (ctrl.Tag?.ToString() == modKey) { if (ctrl is PictureBox inPic) { _anime.ImageFromMsgLevel(inPic, msgLevel); } else if (ctrl is Label inLbl) { inLbl.Text = msg; } modKeyFound = true; } } if (modKeyFound) { return; } } if (_lblLastCreatedPos == 0) { _lblLastCreatedPos = picCheckbox.Top; } _lblLastCreatedPos += 30; var pic = picCheckbox.Clone(); _anime.GetFirstImage(pic, modKey, msgLevel); pic.Top = _lblLastCreatedPos; pic.Visible = true; pic.Tag = modKey + ""; var lbl = lblMsg.Clone(); lbl.Top = _lblLastCreatedPos; lbl.Text = msg; lbl.Visible = true; lbl.Tag = modKey + ""; picCircles.SendToBack(); Log.Add($"Notified on:{msg}"); } catch (Exception ex) { Log.Add($"Notify failed ex:{ex}"); } finally { Application.DoEvents(); } })); }
public TranslationMessage(string text, MessageLevels level) { Text = text; Level = level; }
public TranslationMessage(string Text, MessageLevels Level) { this.Text = Text; this.Level = Level; }
public void Log(MessageLevels level, string text) { var a = new TranslationMessage(text, level); _logs.Add(a); }
public void Log(MessageLevels level, string text) { var a = new TranslationMessage(text, level); _logs.Add(a); }
public TranslationMessage(string Text, MessageLevels Level) { this.Text = Text; this.Level = Level; }