internal static void AssertCl(string message) { if (CommandLineMessages != null) { CommandLineMessages.Invoke(message); } }
public void UpdateUiFromSubProcess(string msg) { if (msg != _lastConsoleOutput) { if (!String.IsNullOrEmpty(msg)) { try { _commandLineMessages = JsonConvert.DeserializeObject <CommandLineMessages>(msg); if (_commandLineMessages != null) { Invoke((MethodInvoker) delegate { StateLabel.Text = String.Format("State: {0}", _commandLineMessages.Message); ProgressLabel.Text = String.Format("Progres: {0}/{1}", _commandLineMessages.Progress, _commandLineMessages.Max); }); switch (_commandLineMessages.Type) { case 1: Invoke((MethodInvoker) delegate { ProgressBar.Maximum = _commandLineMessages.Max; ProgressBar.Value = _commandLineMessages.Progress; }); break; case 2: Invoke((MethodInvoker) delegate { textBox1.AppendText(_commandLineMessages.ErrorMessage + Environment.NewLine); }); break; case 3: Invoke((MethodInvoker) delegate { ProgressBar.Maximum = _commandLineMessages.Max; ProgressBar.Value = _commandLineMessages.Progress; _photoPageLinks.Add(_commandLineMessages.PhotoLink); }); break; } } _lastConsoleOutput = msg; } catch (Exception exception) { Invoke((MethodInvoker) delegate { textBox1.AppendText(exception.Message + Environment.NewLine); textBox1.AppendText(msg + Environment.NewLine); }); } } } }