public BackgroundExecutorWithStatus(TextBox control, string textToAnimate)
 {
     _statusControl = control;
     AnimateText = string.Empty;
     _maxDots = 4;
     AnimateText = textToAnimate;
     _statusControl.TextChanged += (sender, e) =>
     {
         _statusControl.InvokeIfRequired(tb =>
         {
             tb.Focus();
             tb.SelectionStart = tb.Text.Length;
             tb.ScrollToCaret();
         });
     };
     Log.WriteVerbose(new SourceInfo(), "Initializing Background Worker.");
     _actionWorker = new BackgroundExecutorBase();
     _actionWorker.DoWork += actionWorker_DoWork;
     _actionWorker.ProgressChanged += actionWorker_ProgressChanged;
     _actionWorker.RunWorkerCompleted += actionWorker_RunWorkerCompleted;
 }
Пример #2
0
 private static void UpdateUiTextbox(BackgroundExecutorWithStatus bgws, TextBox textbox, string msg, params object[] args)
 {
     if (args.Length != 0)
     {
         msg = string.Format(msg, args);
     }
     if (bgws != null)
     {
         bgws.AnimateText = msg;
     }
     else
     {
         textbox.InvokeIfRequired(s =>
         {
             s.Text += Environment.NewLine + msg;
         });
     }
 }