Exemple #1
0
 public void SendText()
 {
     if (Terminal != null && Terminal.IsConnected)
     {
         HandlingInput = true;
         try
         {
             var win = new InsertText
             {
                 Topmost = true,
                 Text    = ""
             };
             win.Owner = this;
             if (win.ShowDialog() == true)
             {
                 SkipNextKey = true;
                 var text = win.Text;
                 ForceFocus();
                 Terminal.SendText(text);
             }
         }
         catch (Exception)
         {
             throw;
         }
         finally
         {
             HandlingInput = false;
         }
     }
 }
Exemple #2
0
 public void SetText()
 {
     GenericTools.RunUI(() =>
     {
         if (Terminal != null && Terminal.IsConnected)
         {
             HandlingInput = true;
             try
             {
                 var index = Terminal.GetFieldByLocation(Terminal.HighlightCursorX, Terminal.HighlightCursorY);
                 if (index == -1)
                 {
                     index = Terminal.GetFieldByLocation(Terminal.CursorX, Terminal.CursorY);
                 }
                 if (index == -1)
                 {
                     Log.Output("No field found, please click a field or use <tab> to select on");
                     Terminal.Refresh();
                     return;
                 }
                 var _f = Terminal.GetField(index);
                 if (_f == null)
                 {
                     return;
                 }
                 string text = _f.Text;
                 if (!string.IsNullOrEmpty(text))
                 {
                     text = text.TrimEnd();                              //
                 }
                 if (_f.UpperCase)
                 {
                     text = text.ToUpper();
                 }
                 var win = new InsertText
                 {
                     Topmost = true,
                     Text    = text
                 };
                 win.Owner = this;
                 if (win.ShowDialog() == true)
                 {
                     SkipNextKey = true;
                     text        = win.Text;
                     if (_f.UpperCase)
                     {
                         text = text.ToUpper();
                     }
                     global.OpenRPAClient.CurrentDesigner.AddActivity(new SetText()
                     {
                         DisplayName = "SetText #" + index, Text = text, Field = index
                     });
                     ForceFocus();
                     Terminal.SendText(index, text);
                 }
             }
             catch (Exception)
             {
                 throw;
             }
             finally
             {
                 HandlingInput = false;
             }
         }
     });
 }