} // End constructor.

        private void TimerTick(object Sender, EventArgs eventArgs)
        {
            if (Aircraft.pmdg777.MCP_VSDial_Mode.ValueChanged)
            {
                switch (Aircraft.pmdg777.MCP_VSDial_Mode.Value)
                {
                case 0:
                    vsFpaTextBox.AccessibleName = "Vertical speed";
                    modeButton.Text             = "&Mode [VS]";
                    modeButton.AccessibleName   = "Mode [VS]";
                    Tolk.Output("Vertical speed mode.");
                    break;

                case 1:
                    vsFpaTextBox.AccessibleName = "Flight path angle";
                    modeButton.Text             = "&Mode [FPA]";
                    modeButton.AccessibleName   = "Mode [FPA]";
                    Tolk.Output("FPA mode.");
                    break;
                }
            }

            if (Aircraft.pmdg777.MCP_VSDial_Mode.Value == 0 && Aircraft.pmdg777.MCP_VertSpeed.ValueChanged)
            {
                vsFpaTextBox.Text = Aircraft.pmdg777.MCP_VertSpeed.Value.ToString();
            }
            if (Aircraft.pmdg777.MCP_VSDial_Mode.Value == 1 && Aircraft.pmdg777.MCP_FPA.ValueChanged)
            {
                vsFpaTextBox.Text = $"{Aircraft.pmdg777.MCP_FPA.Value}";
            }
        } // End TimerTick.
 private void braille(string output)
 {
     if (Properties.Settings.Default.OutputBraille)
     {
         Tolk.Braille(output);
     }
 }
Example #3
0
        } // End KeyDown event.

        private void airportsMenuItem_Click(object sender, EventArgs e)
        {
            // Make sure the airports form isn't already loaded.
            // If it is closed, it is safe to open it.
            foreach (Form form in Application.OpenForms)
            {
                if (form is AirportsForm)
                {
                    isAirportsFormOpen = true;
                    break;
                }
            }

            if (isAirportsFormOpen)
            {
                Tolk.Output("Airports dialog is already open!");
            }
            else
            {
                if (FSUIPC.FSUIPCConnection.IsOpen)
                {
                    AirportsForm af = new AirportsForm();
                    af.ShowDialog();
                }
                else
                {
                    Tolk.Output("Not connected to simulator!");
                    return;
                }
            }
        }
Example #4
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>	Registers the tolk oppdrag. </summary>
        ///
        /// <remarks>	Mojola, 19/05/2017. </remarks>
        ///
        /// <param name="sp">	    The sp. </param>
        /// <param name="tolkId">	Identifier for the tolk. </param>
        ///
        /// <returns>	True if it succeeds, false if it fails. </returns>
        ////////////////////////////////////////////////////////////////////////////////////////////////////

        public bool regTolkOppdrag(Spraak sp, int tolkId)
        {
            try
            {
                Tolk tolk = db.Personer.OfType <Tolk>().FirstOrDefault(k => k.persId == tolkId);
                if (tolk != null)
                {
                    if (sp != null)
                    {
                        tolk.spraak.Add(sp);
                    }
                    else
                    {
                        return(false);
                    }
                    db.SaveChanges();

                    return(true);
                }


                return(false);
            }
            catch (Exception feil)
            {
                Debug.WriteLine("Exception Message: " + feil.Message);
                return(false);
            }
        }
Example #5
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("|", ""));
                     }
                 }
             }
         }
     }
 }
 private void ConnectMenuItem_Click(object sender, EventArgs e)
 {
     // Reset the connection counter so logging errors work.
     connectionCounter = 0;
     Tolk.Output("Attempting to connect...");
     this.timerConnection.Start();
 }
        private void takeoffAssistDropDown_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (Tolk.DetectScreenReader() == "NVDA")
            {
                Tolk.Output(takeoffAssistDropDown.SelectedItem.ToString());
            }
            switch (takeoffAssistDropDown.SelectedIndex)
            {
            case 0:
                Properties.Settings.Default.takeOffAssistMode = "off";
                break;

            case 1:
                Properties.Settings.Default.takeOffAssistMode = "partial";
                break;

            case 2:
                Properties.Settings.Default.takeOffAssistMode = "full";
                break;

            default:
                MessageBox.Show("There is a problem displaying aircraft settings. Try again later.");
                break;
            }
        }
Example #8
0
        public void update(GameTime gt)
        {
            if (this.firstCall)
            {
                this.IsInDialog = true;
                Tolk.Speak(this.parts[index], true);
                engine.Play2D("sounds/UI/menuconfirm.mp3");
                this.firstCall = false;
            }

            if (Input.WasKeyPressed(Keys.E))
            {
                Tolk.Speak(this.parts[index], true);
            }
            if (Input.WasKeyPressed(Keys.Enter))
            {
                if (index < parts.Length - 1)
                {
                    index += 1;
                    Tolk.Speak(parts[index], true);
                    engine.Play2D("sounds/UI/menumove.mp3");
                }
                else
                {
                    Tolk.Speak("dieron enter");
                    engine.Play2D("sounds/UI/menuback.mp3");
                    this.IsInDialog = false;
                }
            }
        }
 public AltitudeBox()
 {
     InitializeComponent();
     altitudeTimer.Tick += new EventHandler(AltitudeTimerTick);
     altitudeTimer.Start();
     Tolk.Load();
 } // End constructor.
        public TFMMainForm()
        {
            InitializeComponent();
            Aircraft.InitOffsets();
            // upgrade settings
            Properties.Settings.Default.Upgrade();
            synth.Rate = Properties.Settings.Default.SAPISpeechRate;
            // speak a debug message via SAPI if debug mode is turned on
            if (utility.DebugEnabled)
            {
                Tolk.PreferSAPI(true);
                Tolk.Output("Debug mode");
                Tolk.PreferSAPI(false);
            }

            if (Properties.Settings.Default.GeonamesUsername == "")
            {
                MessageBox.Show("Geonames username has not been configured. Flight following features will not function.\nGo to the General section in settings to add your Geonames user name\n", "error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }


            inst.ScreenReaderOutput += onScreenReaderOutput;
            // Start the connection timer to look for a flight sim
            this.timerConnection.Start();
        }
Example #11
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);
     }
 }
        public HeadingBox()
        {
            InitializeComponent();
            Tolk.Load();

            headingTimer.Tick += new EventHandler(TimerTick);
            headingTimer.Start();
        } // End constructor.
Example #13
0
        public VerticalSpeedBox()
        {
            InitializeComponent();

            verticalSpeedTimer.Tick += new EventHandler(TimerTick);
            verticalSpeedTimer.Start();
            Tolk.Load();
        } // End constructor.
        } // SetCommandKeyMenuText.

        private void Restart()
        {
            Tolk.PreferSAPI(true);
            Tolk.Output("TFM is restarting...");
            Tolk.PreferSAPI(false);
            Thread.Sleep(1500);
            Application.Restart();
        }             // Restart.
Example #15
0
 void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     try
     {
         Tolk.Unload();
     }
     catch { }
 }
        }                        // End constructor.

        private void TimerTick(object Sender, EventArgs eventArgs)
        {
            if (Aircraft.pmdg777.MCP_HDGDial_Mode.ValueChanged)
            {
                switch (Aircraft.pmdg777.MCP_HDGDial_Mode.Value)
                {
                case 0:
                    modeButton.Text              = "&Mode [HDG]";
                    modeButton.AccessibleName    = "Mode [HDG]";
                    hdgTrkTextBox.AccessibleName = "Heading";
                    Tolk.Output("Heading mode on.");
                    break;

                case 1:
                    modeButton.Text              = "&Mode [TRK]";
                    modeButton.AccessibleName    = "Mode [TRK]";
                    hdgTrkTextBox.AccessibleName = "Track";
                    Tolk.Output("Track mode on.");
                    break;
                }
            }
            if (Aircraft.pmdg777.MCP_Heading.ValueChanged)
            {
                hdgTrkTextBox.Text = Aircraft.pmdg777.MCP_Heading.Value.ToString();
            }
            if (Aircraft.pmdg777.MCP_annunHDG_HOLD.ValueChanged)
            {
                switch (Aircraft.pmdg777.MCP_annunHDG_HOLD.Value)
                {
                case 0:
                    hdgHoldButton.Text           = "Heading h&old off";
                    hdgHoldButton.AccessibleName = "Heading hold off";
                    break;

                case 1:
                    hdgHoldButton.Text           = "Heading h&old on";
                    hdgHoldButton.AccessibleName = "Heading hold on";
                    break;
                }
            }
            if (Aircraft.pmdg777.MCP_annunLNAV.ValueChanged)
            {
                switch (Aircraft.pmdg777.MCP_annunLNAV.Value)
                {
                case 0:
                    lNavButton.Text           = "&LNav off";
                    lNavButton.AccessibleName = "LNav off";
                    break;

                case 1:
                    lNavButton.Text           = "&LNav on";
                    lNavButton.AccessibleName = "LNav on";
                    break;
                }
            }
        }                 // End TimerTick.
Example #17
0
 private void worker_RunWorkerCompleted(object sender,
                                        RunWorkerCompletedEventArgs e)
 {
     this.IsConnecting = false;
     this.IsConnected = emu.IsConnected;
     if (this.IsConnected)
     {
         Tolk.Speak("Conectado");
     }
 }
Example #18
0
        private void searchTypeComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (Tolk.DetectScreenReader() == "NVDA")
            {
                Tolk.Output(searchTypeComboBox.SelectedItem.ToString());
            }
            switch (this.searchTypeComboBox.SelectedItem)
            {
            case "Between":
                ToggleSearchConditionType("range");
                comparison = ComparisonType.Between;
                break;

            case "Equals":
                if (isStringSearch == true)
                {
                    ToggleSearchConditionType("text");
                    comparison = ComparisonType.StringEquals;
                }
                else
                {
                    ToggleSearchConditionType("numeric");
                    comparison = ComparisonType.NumericEquals;
                }
                break;

            case "Contains":
                ToggleSearchConditionType("text");
                comparison = ComparisonType.Contains;
                break;

            case "Ends with":
                ToggleSearchConditionType("text");
                comparison = ComparisonType.EndsWith;
                break;

            case "Starts with":
                ToggleSearchConditionType("text");
                comparison = ComparisonType.StartsWith;
                break;

            case "Greater than":
                ToggleSearchConditionType("numeric");
                comparison = ComparisonType.GreaterThan;
                break;

            case "Less than":
                ToggleSearchConditionType("numeric");
                comparison = ComparisonType.LessThan;
                break;

            default:
                break;
            }
        }
        }     //End Autopilot checked changed event.

        private void FlyModeComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            ComboBox FlyModes     = (ComboBox)sender;
            var      ScreenReader = Tolk.DetectScreenReader();

            // Make sure NVDA can read the items without opening the dropDown.
            if (ScreenReader == "NVDA" && FlyModes.DroppedDown == false)
            {
                Tolk.Output(FlyModes.SelectedItem.ToString());
            } //End NVDA fix.
        }     //End FlyModes selected index change event.
Example #20
0
 private void btnQNH_Click(object sender, EventArgs e)
 {
     if (double.TryParse(txtQNH.Text, out double qnh) && qnh >= 940 && qnh <= 1050)
     {
         inst.AltimeterQNH = qnh;
         this.DialogResult = DialogResult.OK;
     }
     else
     {
         Tolk.Output("Invalid Altimeter QNH setting.");
     }
 }
Example #21
0
 private void btnInches_Click(object sender, EventArgs e)
 {
     if (double.TryParse(txtInches.Text, out double inches) && inches >= 28.00 && inches <= 31.00)
     {
         inst.AltimeterInches = inches;
         this.DialogResult    = DialogResult.OK;
     }
     else
     {
         Tolk.Output("Invalid Altimeter Inches setting.");
     }
 }
Example #22
0
 public MainWindow()
 {
     InitializeComponent();
     //This odd event handler is needed because the TextBox control eats that spacebar, so we have to intercept an already-handled event.
     //this.Console.AddHandler(TextBox.KeyDownEvent, new KeyEventHandler(Console_KeyDown), true);
     this.Console.AddHandler(TextBox.PreviewKeyDownEvent, new KeyEventHandler(Console_KeyDown), true);
     Tolk.Load();
     Tolk.TrySAPI(false);
     Tolk.DetectScreenReader();
     Tolk.Speak("Bem-vindo ao terminal 3270!", true);
     Tolk.Speak("Pressione Alt + E para conectar, ou Alt + Q para sair.");
 }
Example #23
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;
            }
            ;
        }
Example #24
0
        /// <summary>
        /// Draw the map to the console
        /// </summary>
        /// <param name="Dungeon">Dungeon to draw</param>
        /// <param name="ForceDrawAll">Whether to force drawing whole map</param>
        static void DrawMap(AtlasWarriorsGame.Dungeon Dungeon, bool ForceDrawAll = false)
        {
            // Get the furthest on each edge that's visible
            // Initialising with max/min possible for min/max respectively
            int leftToShow   = Dungeon.Width;
            int rightToShow  = 0;
            int topToShow    = Dungeon.Height;
            int bottomToShow = 0;

            for (int iy = 0; iy < Dungeon.Height; ++iy)
            {
                for (int ix = 0; ix < Dungeon.Width; ++ix)
                {
                    // If in room mode and visible, or if seen
                    if (ForceDrawAll ||
                        ((displayMode == DisplayMode.ROOM) &&
                         (Dungeon.GetVisibility(new XY(ix, iy)) == Dungeon.CellVisibility.VISIBLE)) ||
                        ((displayMode == DisplayMode.ALL) &&
                         (Dungeon.GetVisibility(new XY(ix, iy)) != Dungeon.CellVisibility.UNSEEN)))
                    {
                        leftToShow   = Math.Min(leftToShow, ix);
                        rightToShow  = Math.Max(rightToShow, ix);
                        topToShow    = Math.Min(topToShow, iy);
                        bottomToShow = Math.Max(bottomToShow, iy);
                    }
                }
            }

            for (int iy = topToShow; iy <= bottomToShow; ++iy)
            {
                Console.WriteLine();
                for (int ix = leftToShow; ix <= rightToShow; ++ix)
                {
                    // Get character, unless unseen in which get space
                    var tileChar = Dungeon.GetVisibility(new XY(ix, iy))
                                   != Dungeon.CellVisibility.UNSEEN ?
                                   CellToScreen.CellScreenChar(Dungeon.GetCell(new XY(ix, iy))) : ' ';
                    var tileActors = (Dungeon.Actors.Where(i => i.Location == (new XY(ix, iy))));
                    if (tileActors.Count() > 0)
                    {
                        tileChar = CellToScreen.ActorToChar(tileActors.First());
                        Tolk.Output(tileActors.First().SpriteId);
                    }
                    else
                    {
                        Tolk.Output(Dungeon.GetCell(new XY(ix, iy)).ToString());
                    }
                    Console.Write(tileChar);
                }
                Tolk.Output("Next Row");
            }
        }
Example #25
0
 /// <summary>
 /// Allows the game to run logic such as updating the world,
 /// checking for collisions, gathering input, and playing audio.
 /// </summary>
 /// <param name="gameTime">Provides a snapshot of timing values.</param>
 protected override void Update(GameTime gameTime)
 {
     if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
     {
         Exit();
     }
     // TODO: Add your update logic here
     Input.Update();
     map.Update(Input.keystate, gameTime);
     if (Input.WasKeyPressed(Keys.C))
     {
         Tolk.Speak(map.Player.me.X + "," + map.Player.me.Y + "," + map.Player.me.Z, true);
     }
     base.Update(gameTime);
 }
 private void CommandKeyMenuItem_Click(object sender, EventArgs e)
 {
     if (inst.CommandKeyEnabled)
     {
         inst.CommandKeyEnabled = false;
         inst.ResetHotkeys();
         Tolk.Output("command key disabled");
     }
     else
     {
         inst.CommandKeyEnabled = true;
         inst.ResetHotkeys();
         Tolk.Output("command key enabled");
     }
 }
Example #27
0
        }     // End doStartsWith.

        Action <ComparisonType> doEndsWith()
        {
            return(comparison =>
            {
                if (comparison == ComparisonType.EndsWith)
                {
                    var field = fieldComboBox.SelectedItem.ToString();
                    var filter = textFilterTextBox.Text;
                    List <ListViewItem> rows = new List <ListViewItem>();
                    List <FsAirport> airports = new List <FsAirport>();
                    var database = FSUIPC.FSUIPCConnection.AirportsDatabase;
                    database.SetReferenceLocation();

                    switch (field)
                    {
                    case "Name":
                        airports = database.Airports.Where(a => a.Name.EndsWith(filter)).ToList();
                        break;

                    case "ICAO":
                        airports = database.Airports.Where(a => a.ICAO.EndsWith(filter)).ToList();
                        break;

                    case "City":
                        airports = database.Airports.Where(a => a.City.EndsWith(filter)).ToList();
                        break;

                    case "State/Province":
                        airports = database.Airports.Where(a => a.State != null).Where(a => a.State.EndsWith(filter)).ToList();
                        break;

                    case "Country":
                        airports = database.Airports.Where(a => a.Country.EndsWith(filter)).ToList();
                        break;
                    }

                    foreach (FsAirport airport in airports)
                    {
                        string[] row = { airport.Name, airport.ICAO, airport.City, airport.State, airport.Country, Math.Round(airport.BearingToTrue).ToString(), Math.Round(airport.AltitudeFeet).ToString(), Math.Round(airport.DistanceNauticalMiles).ToString() };
                        rows.Add(new ListViewItem(row));
                    }
                    Tolk.Output($"{rows.Count()} results found.");
                    airportsListView.BeginUpdate();
                    airportsListView.Items.AddRange(rows.ToArray());
                    airportsListView.EndUpdate();
                } // End comparison condition.
            });
        }     // End doEndsWith.
Example #28
0
 private void AirportsForm_KeyDown(object sender, KeyEventArgs e)
 {
     if ((e.Alt && e.KeyCode == Keys.A))
     {
         airportsListView.Focus();
     }
     if ((e.Alt && e.KeyCode == Keys.I))
     {
         fieldComboBox.Focus();
     }
     if ((e.Alt && e.KeyCode == Keys.T))
     {
         searchTypeComboBox.Focus();
     }
     if ((e.Alt && e.KeyCode == Keys.L))
     {
         if (textFilterTextBox.Visible == true)
         {
             textFilterTextBox.Focus();
         }
         else
         {
             Tolk.Output("The text filter field is not available. Select either Name, ICAO, City, State, or Country from the fields list.");
         }
     }
     if ((e.Alt && e.KeyCode == Keys.X))
     {
         if (upperNumericSpinner.Visible == true)
         {
             upperNumericSpinner.Focus();
         }
         else
         {
             Tolk.Output("The maxinum value field is not available. Select Bearing, Distance, or Altitude first, then choose between as the comparison operator.");
         }
     }
     if ((e.Alt && e.KeyCode == Keys.N))
     {
         if (lowerNumericSpinner.Visible == true)
         {
             lowerNumericSpinner.Focus();
         }
         else
         {
             Tolk.Output("The minimum value field is not available. Select Bearing, Distance, or Altitude from the fields list first.");
         }
     }
 }
 private void dbLoadWorker_DoWork(object sender, DoWorkEventArgs e)
 {
     try
     {
         FSUIPCConnection.AirportsDatabase.LoadTaxiways = true;
         FSUIPCConnection.AirportsDatabase.Load();
         if (FSUIPCConnection.AirportsDatabase.IsLoaded)
         {
             Tolk.Output("Airport database loaded.");
         }
     }
     catch (Exception ex)
     {
         Tolk.Output("could not load airport database.");
     }
 }
        }     // End screenreader output event.

        private void speak(string output, bool useSAPI = false, bool interruptSpeech = false)
        {
            if (Properties.Settings.Default.UseSAPIOutput == true || useSAPI == true)
            {
                if (interruptSpeech == true)
                {
                    synth.SpeakAsyncCancelAll();
                }
                synth.Rate = Properties.Settings.Default.SAPISpeechRate;
                synth.SpeakAsync(output);
            }
            else
            {
                Tolk.Speak(output, interruptSpeech);
            }
        }