Exemple #1
0
        public bool SendKeyOp(KeyboardOp op, string key)
        {
            lock (tn)
            {
                // these can go to screen that is locked
                switch (op)
                {
                case KeyboardOp.Reset:
                    //tn.tnctlr.do_reset();
                    return(true);

                default:
                    break;
                }

                if ((tn.keyboard.kybdlock & Keyboard.KL_OIA_MINUS) != 0)
                {
                    return(false);
                }
                else if (tn.keyboard.kybdlock != 0)
                {
                    return(false);
                    //enq_ta(Enter_action, CN, CN);
                }
                else
                {
                    // these need unlocked screen
                    switch (op)
                    {
                    case KeyboardOp.AID:
                        byte v = (byte)typeof(AID).GetField(key).GetValue(null);
                        tn.keyboard.key_AID(v);
                        return(true);

                    case KeyboardOp.Home:

                        if (tn.IN_ANSI)
                        {
                            Console.WriteLine("IN_ANSI Home key not supported");
                            //ansi_send_home();
                            return(false);
                        }

                        if (!tn.tnctlr.formatted)
                        {
                            tn.tnctlr.cursor_move(0);
                            return(true);
                        }
                        tn.tnctlr.cursor_move(tn.tnctlr.next_unprotected(tn.tnctlr.ROWS * tn.tnctlr.COLS - 1));
                        return(true);

                    case KeyboardOp.ATTN:
                        tn.net_interrupt();
                        return(true);
                    }
                    throw new ApplicationException("Sorry, key '" + key + "'not known");
                }
            }
        }
Exemple #2
0
 public bool SendKeyOp(KeyboardOp op, string key)
 {
     return(SendKeyOp(op));
 }
Exemple #3
0
        /// <summary>
        ///     Sends an operator key to the mainframe.
        /// </summary>
        /// <param name="op"></param>
        /// <returns></returns>
        public bool SendKeyOp(KeyboardOp op)
        {
            var success = false;

            lock (tn)
            {
                // These can go to a locked screen
                if (op == KeyboardOp.Reset)
                {
                    success = true;
                }
                else
                {
                    if ((tn.Keyboard.keyboardLock & KeyboardConstants.OiaMinus) != 0 ||
                        tn.Keyboard.keyboardLock != 0)
                    {
                        success = false;
                    }
                    else
                    {
                        // These need unlocked screen
                        switch (op)
                        {
                        case KeyboardOp.AID:
                        {
                            var v = (byte)typeof(AID).GetField(op.ToString()).GetValue(null);
                            tn.Keyboard.HandleAttentionIdentifierKey(v);
                            success = true;
                            break;
                        }

                        case KeyboardOp.Home:
                        {
                            if (tn.IsAnsi)
                            {
                                Console.WriteLine("IN_ANSI Home key not supported");
                                //ansi_send_home();
                                return(false);
                            }

                            if (!tn.Controller.Formatted)
                            {
                                tn.Controller.SetCursorAddress(0);
                                return(true);
                            }
                            tn.Controller.SetCursorAddress(
                                tn.Controller.GetNextUnprotectedField(tn.Controller.RowCount *
                                                                      tn.Controller.ColumnCount - 1));
                            success = true;
                            break;
                        }

                        case KeyboardOp.ATTN:
                        {
                            tn.Interrupt();
                            success = true;
                            break;
                        }

                        default:
                        {
                            throw new ApplicationException("Sorry, key '" + op + "'not known");
                        }
                        }
                    }
                }
            }
            return(success);
        }