Exemple #1
0
        /// <summary>
        /// Synchronous command execution.
        /// This is not used. It blocks the GUI.
        /// </summary>
        /// <param name="elem"></param>
        private void RunCommand(IWorkElement elem)
        {
            (elem.ResultContainer as TextBox).Text = string.Empty;
            ClearError();
            elem.Execute();

            if (elem.Error != null)
            {
                ShowError(elem.Error, showDialog: false);
            }
            else
            {
                (elem.ResultContainer as TextBox).Text = elem.Result;
            }
        }
Exemple #2
0
 /// <summary>
 /// Thread routine (loop)
 /// </summary>
 private void Run()
 {
     while (!ShouldStop)
     {
         //Get first element from queue
         IWorkElement e = GetWork();
         //If null is returned then the app wants to exit.
         if (e == null)
         {
             return;
         }
         //Handle the element. Do it's work and call the callback routine when done.
         busy = true;
         e.Execute();
         CallBack(e);
         busy = false;
     }
 }