Beispiel #1
0
 public void SpeekCurrentFieldLabel()
 {
     if (this.emu.IsConnected)
     {
         ScreenField xf = null;
         xf = GetCurrentField();
         if (xf != null)
         {
             ScreenField xf1 = GetPreviousField(xf);
             if (xf1 != null && !String.IsNullOrEmpty(xf1.Text.Trim()) && xf1.Location.top == xf.Location.top)
             {
                 Tolk.Speak(xf1.Text.Trim().Replace("|", ""));
             }
             else
             {
                 if (!String.IsNullOrEmpty(ScreenText))
                 {
                     ScreenField xf2 = GetNextUnprotectedField(xf);
                     if (xf2 != null && xf2.Location.top == xf.Location.top)
                     {
                         Tolk.Speak(ScreenText.Substring(xf.Location.position + xf.Location.top + xf.Location.length, (xf2.Location.position + xf2.Location.top) - (xf.Location.position + xf.Location.top + xf.Location.length)).Replace("|", ""));
                     }
                     else
                     {
                         Tolk.Speak(ScreenText.Substring(xf.Location.position + xf.Location.top + xf.Location.length, 80 - (xf.Location.left + xf.Location.length)).Trim().Replace("|", ""));
                     }
                 }
             }
         }
     }
 }
Beispiel #2
0
 /// <summary>
 /// Sends text to the terminal.
 /// This is used for typical alphanumeric text entry.
 /// </summary>
 /// <param name="text">The text to send</param>
 internal void SendText(string text, bool automated = false)
 {
     try
     {
         if (this.emu.IsConnected)
         {
             enterKeyPressed = false;
             textKeyPressed = true;
             if (!automated)
             {
                 ScreenField xf = GetCurrentField();
                 if (xf.Attributes.FieldType == "Hidden" && xf.Attributes.Protected == false)
                 {
                     Tolk.Silence();
                     Tolk.Speak("", true);
                 }
             }
             this.emu.SetText(text);
             if (!automated)
             {
                 Refresh();
                 textKeyPressed = false;
             }
         }
     }
     catch (TNHostException tnHostException)
     {
         log.Warn("Exceção TNHostException em terminal.SendText", tnHostException);
     }
     catch (Exception e)
     {
         log.Error("Exceção não esperada em terminal.Sendtext", e);
         emu_Disconnected(emu, e.Message);
     }
 }
Beispiel #3
0
        void ExecuteSpeakCommand(object sender, ExecutedRoutedEventArgs args)
        {
            ScreenField xf = null;

            switch ((String)args.Parameter)
            {
            case "A":
                Tolk.Speak(Console.Text.Trim(), true);
                break;

            case "S":
                Tolk.Silence();
                break;

            case "D":
                Tolk.Speak(Console.Text.Substring((Terminal.GetCaretIndex() / 81) * 81, 80).Trim().Replace("|", ""));
                break;

            case "X":
                xf = Terminal.GetCurrentField();
                if (xf != null)
                {
                    Tolk.Speak(Console.Text.Substring(xf.Location.position + xf.Location.top, xf.Location.length).Trim().Replace("|", ""));
                }
                break;

            case "Z":
                xf = Terminal.GetCurrentField();
                if (xf != null)
                {
                    ScreenField xf1 = Terminal.GetPreviousField(xf);
                    if (xf1 != null && xf1.Text != null && xf1.Location.top == xf.Location.top)
                    {
                        Tolk.Speak(xf1.Text.Trim().Replace("|", ""));
                    }
                    else
                    {
                        ScreenField xf2 = Terminal.GetNextUnprotectedField(xf);
                        if (xf2 != null && xf2.Location.top == xf.Location.top)
                        {
                            Tolk.Speak(Console.Text.Substring(xf.Location.position + xf.Location.top + xf.Location.length, (xf2.Location.position + xf2.Location.top) - (xf.Location.position + xf.Location.top + xf.Location.length)).Replace("|", ""));
                        }
                        else
                        {
                            Tolk.Speak(Console.Text.Substring(xf.Location.position + xf.Location.top + xf.Location.length, 80 - (xf.Location.left + xf.Location.length)).Trim().Replace("|", ""));
                        }
                    }
                }
                break;
            }
            ;
        }
Beispiel #4
0
 public ScreenField GetPreviousField(ScreenField xf)
 {
     if (this.emu.CurrentScreenObject.Fields != null)
     {
         for (int i = emu.CurrentScreenObject.Fields.IndexOf(xf) - 1; i > 0; i--)
         {
             if (emu.CurrentScreenObject.Fields[i].Attributes.Protected == true && emu.CurrentScreenObject.Fields[i].Text != null && (emu.CurrentScreenObject.Fields[i].Location.position + emu.CurrentScreenObject.Fields[i].Location.top) < (xf.Location.position + xf.Location.top))
             {
                 return emu.CurrentScreenObject.Fields[i];
             }
         }
     }
     return null;
 }
Beispiel #5
0
 public ScreenField GetNextUnprotectedField(ScreenField xf)
 {
     if (this.emu.CurrentScreenObject.Fields != null)
     {
         for (int i = emu.CurrentScreenObject.Fields.IndexOf(xf) + 1; i < emu.CurrentScreenObject.Fields.Count; i++)
         {
             if (emu.CurrentScreenObject.Fields[i].Attributes.Protected == false && (emu.CurrentScreenObject.Fields[i].Location.position + emu.CurrentScreenObject.Fields[i].Location.top) > (xf.Location.position + xf.Location.top))
             {
                 return emu.CurrentScreenObject.Fields[i];
             }
         }
     }
     return null;
 }
Beispiel #6
0
        override public string[] GetStatements()
        {
            if (!_isExistingCustomer)
            {
                throw new Exception("Statements may only be obtained for an existing customer");
            }

            // call up the WBGB transaction
            _Handler.SendKey("WBGD@E");
            TraceScreen();

            // wait for the F9=Add Acct
            _Handler.WaitForContent("F9=Add Acct", 5000);
            TraceScreen();

            // The cursor is at the right place
            _Handler.SendKey(_name + "@E");
            TraceScreen();

            // wait for the "paging commands" or name is invalid
            ScreenPartialFieldCollection fields = new ScreenPartialFieldCollection(2);

            fields.Add(new ScreenPartialField("Customer name not found", 21, 2));
            fields.Add(new ScreenPartialField("Press <Enter> and follow with paging commands", 1, 2));

            int indexOfField = _Handler.WaitForContent(fields, 5000);

            TraceScreen();

            if (indexOfField == 0)
            {
                throw new ArgumentException("Customer Name incorrect", _name);
            }

            // hit enter
            _Handler.SendKey("@E");
            TraceScreen();

            // statement lines
            ArrayList alLines = new ArrayList();

            // look for the end of paging or more
            fields.Clear();
            fields.Add(new ScreenPartialField("End of Report", 24, 2));
            fields.Add(new ScreenPartialField("Press Clear and type P/N to see page N", 24, 2));

            // for each page
            bool morePages  = true;
            int  pageNumber = 1;

            while (morePages)
            {
                // do we have more statements
                indexOfField = _Handler.WaitForContent(fields, 5000);
                TraceScreen();

                // get hold of all of the statement lines
                // the last Amount spreads over the rest of the screen, so the column
                // does no longer start at 2..thus ending the get fields
                ScreenFieldCollection sfcNumbers = _Handler.GetFieldsByColumn(2, 4);
                foreach (ScreenField numberField in sfcNumbers)
                {
                    // get the Account Number
                    string line = numberField.Data;
                    // reference the transaction type field
                    ScreenField valueField = numberField + 3;
                    // add the rest of the info
                    line += valueField.Data + (++valueField).Data;
                    // just in case the last field is humogously long, use the partial field
                    line += (++valueField)[1, 13].Data;

                    alLines.Add(line);
                }

                // more?
                if (indexOfField == 1)
                {
                    // go to the blank screen
                    ClearScreenAndWait();

                    // next page
                    pageNumber++;

                    _Handler.SendKey("P/" + pageNumber.ToString() + "@E");
                }
                else
                {
                    morePages = false;
                }
            }
            // go to the blank screen
            ClearScreenAndWait();

            string [] returnLines = new string[alLines.Count];
            for (int index = 0; index < alLines.Count; index++)
            {
                returnLines[index] = (string)alLines[index];
            }

            return(returnLines);
        }