private void StatusBarMessager_SendMessageToStatusBar(object sender, StatusBarMessageEventArgs e) { void Mi() { lastStatusEventArgs = e; if (DockState != DockState.Float) { statusStrip1.Visible = false; SendMessageToStatusBar?.Invoke(sender, e); return; } SendMessageToStatusBar?.Invoke(sender, new StatusBarMessageEventArgs(null, null)); statusStrip1.Visible = true; if (string.IsNullOrEmpty(e.Message) && e.Progress == null) { statusStrip1.Visible = false; } else if (!string.IsNullOrEmpty(e.Message) && e.Progress != null) { toolStripProgressBar.Value = e.Progress.Value; toolStripStatusLabel.Text = e.Message; toolStripProgressBar.Visible = true; toolStripStatusLabel.Visible = true; statusStrip1.Visible = true; } else if (!string.IsNullOrEmpty(e.Message)) { toolStripStatusLabel.Text = e.Message; toolStripStatusLabel.Visible = true; toolStripProgressBar.Visible = false; statusStrip1.Visible = true; } else if (e.Progress != null) { toolStripProgressBar.Value = e.Progress.Value; toolStripProgressBar.Visible = true; toolStripStatusLabel.Visible = false; statusStrip1.Visible = true; } } if (statusStrip1.InvokeRequired) { statusStrip1.Invoke((MethodInvoker)Mi); } else { Mi(); } }
private void StatusBarMessager_SendMessageToStatusBar(object sender, StatusBarMessageEventArgs e) { var currentPlugin = pluginControlStatuses.FirstOrDefault(pcs => pcs.Control == sender); if (currentPlugin == null) { pluginControlStatuses.Add(new PluginControlStatus( (IXrmToolBoxPluginControl)sender, e.Progress, e.Message )); } else { currentPlugin.Percentage = e.Progress; currentPlugin.Message = e.Message; } MethodInvoker mi = delegate { if (tabControl1.SelectedIndex != 0) { var currentVisibleControl = tabControl1.SelectedTab.GetPlugin(); if (currentVisibleControl == sender) { ccsb.SetMessage(e.Message); ccsb.SetProgress(e.Progress); } } else { ccsb.SetMessage(null); ccsb.SetProgress(null); } }; if (InvokeRequired) { Invoke(mi); } else { mi(); } }
private void Label_Message_UpdateData(object sender, StatusBarMessageEventArgs e) { this.Label_Message.Content = e.Message; ShowSeconds = 5; }