Exemple #1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var psi = new ProcessStartInfo(System.Windows.Forms.Application.ExecutablePath);
            // launch the process through white application
            _application = TestStack.White.Application.Attach(Process.GetCurrentProcess());
            _mainWindow = _application.GetWindow("MainWindow", InitializeOption.NoCache);

            Point textboxLocation = txtbox.PointToScreen(new Point(0d, 0d));

            Microsoft.Test.Input.Mouse.MoveTo(new System.Drawing.Point((int)textboxLocation.X, (int)textboxLocation.Y));
            Microsoft.Test.Input.Mouse.Click(Microsoft.Test.Input.MouseButton.Left);

            TextCompositionManager.StartComposition(
                new TextComposition(InputManager.Current, txtbox, "pwpito"));

            //var button = _mainWindow.Get<Button>("stopButton");
            //button.Click();


            //TextCompositionManager.StartComposition(
            //    new TextComposition(InputManager.Current, txtbox, " papito"));

            //AutomationElement automationElement = _mainWindow.GetElement(SearchCriteria.ByAutomationId("stopButton"));
            //var invokePattern = automationElement.GetCurrentPattern(InvokePattern.Pattern) as InvokePattern;
            //invokePattern.Invoke();

            //this.stopButton.

            //Keyboard.Type("Hello world.");
            //Keyboard.Press(Key.Shift);
            //Keyboard.Type("hello, capitalized world.");
            //Thread.Sleep(100);
            //SendKeys.SendWait("pepe");
            // Keyboard.Release(Key.Shift);
        }
Exemple #2
0
        public MainWindow()
        {
            //Set up background thread
            M6502WorkerThread = new Thread(() =>
            {
                Thread.CurrentThread.IsBackground = true;
                vm.Processor.Run();
            });

            #region events

            #endregion

            //Set up viewmodel
            vm.Processor           = new M6502();
            vm.DisplayGrid         = new AppleDisplay();
            vm.DisassembledOpcodes = new ObservableCollection <Disassembly.DisassembledOpcode>();

            //Set up events
            vm.Processor.ProcessorStepCompleted += new M6502.ProcessorStepCompletedEventHandler(AfterProcessorStepCompleted);
            vm.Processor.ToggleCursor           += new M6502.ToggleCursorEventHandler(vm.DisplayGrid.onToggleCursor);
            vm.Processor.UpdateDisplay          += new M6502.UpdateDisplayEventHandler(vm.DisplayGrid.onUpdateDisplay);
            vm.Processor.ExecutionStopped       += new M6502.ExecutionStoppedEventHandler(onExecutionStopped);
            TextCompositionManager.AddTextInputHandler(this, new TextCompositionEventHandler(OnTextComposition));

            basicRomPath     = @"C:\apple\apple1basic.bin";
            monitorRomPath   = @"C:\apple\apple1.rom";
            characterRomPath = @"C:\apple\apple1.vid";

            //Set up window
            InitializeComponent();
            binaryLoadedStatus.SetBinding(ContentProperty, new Binding("LoadSuccess"));
            DataContext = vm;
        }
 protected virtual void Dispose(bool isDisposing)
 {
     if (!isDisposing)
     {
         return;
     }
     if (this.editorElement != null)
     {
         TextCompositionManager.RemoveTextInputStartHandler((DependencyObject)this.editorElement, new TextCompositionEventHandler(this.OnTextInputStart));
         TextCompositionManager.RemoveTextInputUpdateHandler((DependencyObject)this.editorElement, new TextCompositionEventHandler(this.OnTextInputUpdate));
         this.editorElement.TextInput -= new TextCompositionEventHandler(this.OnTextInput);
         this.editorElement.KeyDown   -= new KeyEventHandler(this.OnKeyDown);
         this.editorElement.MouseDown -= new MouseButtonEventHandler(this.OnMouseDown);
         this.editorElement            = (FrameworkElement)null;
     }
     if (this.codeAidEngine != null)
     {
         this.codeAidEngine.Dispose();
         this.codeAidEngine = (XamlCodeAidEngine)null;
     }
     if (this.undoHistory == null)
     {
         return;
     }
     this.undoHistory.UndoRedoHappened -= new EventHandler <UndoRedoEventArgs>(this.OnUndoRedoHappened);
     this.undoHistory = (UndoHistory)null;
 }
Exemple #4
0
        /// <summary>
        /// Called when [edit element loaded].
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
        protected override void OnEditElementLoaded(object sender, RoutedEventArgs e)
        {
            var dateTimeEdit = ((DateTimeEdit)sender);

            dateTimeEdit.TextChanged        += OnTextChanged;
            dateTimeEdit.WatermarkVisibility = Visibility.Collapsed;
            dateTimeEdit.Focus();
            if ((this.DataGrid.EditorSelectionBehavior == EditorSelectionBehavior.SelectAll || this.DataGrid.IsAddNewIndex(this.CurrentCellIndex.RowIndex)) && PreviewInputText == null)
            {
                dateTimeEdit.SelectAll();
                return;
            }
            else
            {
                if (PreviewInputText == null)
                {
                    var index = dateTimeEdit.Text.Length;
                    dateTimeEdit.Select(index + 1, 0);
                    return;
                }
                if (dateTimeEdit.CanEdit)
                {
                    ((DateTimeEdit)CurrentCellRendererElement).SelectedText = PreviewInputText.ToString();
                }
                TextCompositionManager.StartComposition(new TextComposition(InputManager.Current, (DateTimeEdit)CurrentCellRendererElement, PreviewInputText.ToString()));
            }
            PreviewInputText = null;
        }
Exemple #5
0
 public EditMonument(ObservableCollection <Type> types, ObservableCollection <Tag> tags,
                     onEditMonument editMonumentCallback, Monument oldMonument,
                     onAddType addTypeCallback, onAddTag addTagCallback)
 {
     InitializeComponent();
     Root.DataContext = this;
     this.OldMonument = oldMonument;
     this.NewMonument = new Monument();
     this.copyOldMonument();
     this.initializeEraList();
     this.initializeTouristicList();
     this.DateCollection         = getDateCollection();
     this.Tags                   = tags;
     this.TagListBox.ItemsSource = this.Tags;
     this.Types                  = types;
     this.AddTypeCallBack        = addTypeCallback;
     this.AddTagCallback         = addTagCallback;
     this.EditMonumentCallback   = editMonumentCallback;
     setTagFlags();
     setEraComboBoxValue();
     setTouristicComboBoxValue();
     setDiscoveryDate();
     TextCompositionManager.AddTextInputHandler(this,
                                                new TextCompositionEventHandler(OnTextComposition));
 }
Exemple #6
0
        public override void DisableEvent(object eventId)
        {
            if (eventId is WidgetEvent)
            {
                var ev = (WidgetEvent)eventId;
                switch (ev)
                {
                case WidgetEvent.KeyPressed:
                    Widget.PreviewKeyDown -= WidgetKeyDownHandler;
                    break;

                case WidgetEvent.KeyReleased:
                    Widget.PreviewKeyUp -= WidgetKeyUpHandler;
                    break;

                case WidgetEvent.TextInput:
                    TextCompositionManager.RemovePreviewTextInputHandler(Widget, WidgetPreviewTextInputHandler);
                    break;

                case WidgetEvent.ButtonPressed:
                    Widget.MouseDown -= WidgetMouseDownHandler;
                    break;

                case WidgetEvent.ButtonReleased:
                    Widget.MouseUp -= WidgetMouseUpHandler;
                    break;

                case WidgetEvent.MouseEntered:
                    Widget.MouseEnter -= WidgetMouseEnteredHandler;
                    break;

                case WidgetEvent.MouseExited:
                    Widget.MouseLeave -= WidgetMouseExitedHandler;
                    break;

                case WidgetEvent.MouseMoved:
                    Widget.MouseMove -= WidgetMouseMoveHandler;
                    break;

                case WidgetEvent.BoundsChanged:
                    Widget.SizeChanged -= WidgetOnSizeChanged;
                    break;

                case WidgetEvent.MouseScrolled:
                    Widget.MouseWheel -= WidgetMouseWheelHandler;
                    break;
                }

                enabledEvents &= ~ev;

                if ((ev & dragDropEvents) != 0 && (enabledEvents & dragDropEvents) == 0)
                {
                    // All drag&drop events have been disabled
                    Widget.DragOver  -= WidgetDragOverHandler;
                    Widget.Drop      -= WidgetDropHandler;
                    Widget.DragLeave -= WidgetDragLeaveHandler;
                }
            }
        }
 public MainWindow()
 {
     InitializeComponent();
     TextCompositionManager.AddTextInputHandler(this,
                                                new TextCompositionEventHandler(OnTextComposition));
     this.WindowState = WindowState.Maximized;
     this.Title       = "Emlekmu";
 }
Exemple #8
0
        public MainWindow()
        {
            InitializeComponent();

            TextCompositionManager.AddPreviewTextInputHandler(tbSearch, OnPreviewTextInput);
            TextCompositionManager.AddPreviewTextInputStartHandler(tbSearch, OnPreviewTextInputStart);
            TextCompositionManager.AddPreviewTextInputUpdateHandler(tbSearch, OnPreviewTextInputUpdate);
        }
        public NumberBoxContainer()
        {
            InitializeComponent();

            if (System.Windows.Application.Current.MainWindow != null)
            {
                TextCompositionManager.AddPreviewTextInputHandler(System.Windows.Application.Current.MainWindow, MainWindow_PreviewTextInput);
            }
        }
Exemple #10
0
        public MainView()
        {
            InputManager.Current.PreNotifyInput += PreNotifyInput;
            // This is where we handle all the rest of the keys
            TextCompositionManager.AddPreviewTextInputStartHandler(
                Application.Current.MainWindow,
                PreviewTextInputHandler);

            InitializeComponent();
        }
 public AddTag(onAddTag addTagCallback, ObservableCollection <Tag> tags)
 {
     this.AddTagCallback = addTagCallback;
     this.Tags           = tags;
     NewTag = new models.Tag();
     InitializeComponent();
     Root.DataContext = this;
     TextCompositionManager.AddTextInputHandler(this,
                                                new TextCompositionEventHandler(OnTextComposition));
 }
Exemple #12
0
        /// <summary>
        /// コンストラクタ
        /// </summary>
        public MainWindow()
        {
            InitializeComponent();

            // GUI初期処理
            TitleBase  = this.Title + " " + MyUtil.GetFileVersion();
            this.Title = TitleBase;

            TextCompositionManager.AddPreviewTextInputHandler(this, OnPreviewTextInput);
            TextCompositionManager.AddPreviewTextInputUpdateHandler(this, OnPreviewTextInputUpdate);
        }
Exemple #13
0
    private static void TextBox_ConvertHandler(object sender, KeyEventArgs e)
    {
        var textBox = sender as TextBox;

        if (e.Key == Key.Oem4)      // "["
        {
            string convertString = "\\u0001";
            TextCompositionManager.StartComposition(new TextComposition(InputManager.Current, textBox, convertString));
            e.Handled = true;
        }
    }
Exemple #14
0
        public MainWindow()
        {
            InitializeComponent();

            TextCompositionManager.AddPreviewTextInputHandler(TB, OnPreviewTextInput);
            TextCompositionManager.AddPreviewTextInputStartHandler(TB, OnPreviewTextInputStart);
            TextCompositionManager.AddPreviewTextInputUpdateHandler(TB, OnPreviewTextInputUpdate);

            kbd = new KeyboardDevice();
            kbd.KeyboardDeviceFound     += OnKeyboardDeviceFound;
            kbd.KeyboardDeviceConnected += OnKeyboardDeviceConnected;
        }
        private void OnTextBoxKeyDown(object sender, KeyEventArgs eventArgs)
        {
            // Translate the numpad decimal key to the correct decimal separator.
            if (eventArgs.Key == Key.Decimal)
            {
                eventArgs.Handled = true;

                var cultureInfo     = _textBox.Language.GetSpecificCulture();
                var textComposition = new TextComposition(InputManager.Current, _textBox, cultureInfo.NumberFormat.NumberDecimalSeparator);
                TextCompositionManager.StartComposition(textComposition);
            }
        }
Exemple #16
0
        private void SelectCharactorButtonOnClick(object sender, RoutedEventArgs e)
        {
            var button = sender as Button;
            var text   = button.Content as string;

            if (text != null)
            {
                var composition = new TextComposition(InputManager.Current, this.Output, text);
                TextCompositionManager.StartComposition(composition);
                this.Clear();
            }
        }
 public TypeSection(ObservableCollection <Type> types, onAddType addTypeCallback, onEditType editTypeCallback, onRemoveType removeTypeCallback)
 {
     InitializeComponent();
     EnlargenedTypes     = new ObservableCollection <int>();
     Root.DataContext    = this;
     TypeClickedCallback = new onTypeClicked(typeClicked);
     Types              = types;
     AddTypeCallback    = addTypeCallback;
     EditTypeCallback   = editTypeCallback;
     RemoveTypeCallback = removeTypeCallback;
     TextCompositionManager.AddTextInputHandler(this,
                                                new TextCompositionEventHandler(OnTextComposition));
 }
Exemple #18
0
        public AddType(onAddType addTypeCallback, ObservableCollection <Type> types)
        {
            InitializeComponent();
            this.NewType         = new Type();
            this.AddTypeCallback = addTypeCallback;
            this.Types           = types;
            this.NewType.Id      = findNextId();

            Root.DataContext = this;

            TextCompositionManager.AddTextInputHandler(this,
                                                       new TextCompositionEventHandler(OnTextComposition));
        }
Exemple #19
0
        //--------------------------------------------------------------------------------------------------

        #endregion

        #region Keyboard Input

        static bool _SendKeyEvent(int key, bool isUp)
        {
            bool success = false;
            int  vkey    = key & 0xff;

            Application.Current.Dispatcher.Invoke(() =>
            {
                var sourceElement = Keyboard.PrimaryDevice.ActiveSource;
                var focusElement  = Keyboard.PrimaryDevice.FocusedElement;
                if (focusElement == null || sourceElement == null)
                {
                    return;
                }

                var tunnelArgs         = new KeyEventArgs(Keyboard.PrimaryDevice, sourceElement, 0, KeyInterop.KeyFromVirtualKey(vkey));
                tunnelArgs.RoutedEvent = isUp ? Keyboard.PreviewKeyUpEvent : Keyboard.PreviewKeyDownEvent;
                focusElement.RaiseEvent(tunnelArgs);

                if (!tunnelArgs.Handled)
                {
                    var bubbleArgs         = new KeyEventArgs(Keyboard.PrimaryDevice, sourceElement, 0, KeyInterop.KeyFromVirtualKey(vkey));
                    bubbleArgs.RoutedEvent = isUp ? Keyboard.KeyUpEvent : Keyboard.KeyDownEvent;
                    focusElement.RaiseEvent(bubbleArgs);

                    if (!bubbleArgs.Handled && !isUp)
                    {
                        var sb           = new StringBuilder();
                        byte[] bKeyState = new byte[255];
                        if ((key & 0x0100) > 0)
                        {
                            bKeyState[0x10] = 0x80;
                        }
                        if ((key & 0x0200) > 0)
                        {
                            bKeyState[0x11] = 0x80;
                        }
                        if ((key & 0x0400) > 0)
                        {
                            bKeyState[0x12] = 0x80;
                        }
                        uint lScanCode = Win32Api.MapVirtualKey((uint)(vkey), Win32Api.MapVirtualKeyMapTypes.MAPVK_VK_TO_VSC);
                        Win32Api.ToUnicode((uint)(vkey), lScanCode, bKeyState, sb, 5, 0);

                        TextCompositionManager.StartComposition(new TextComposition(InputManager.Current, Keyboard.FocusedElement, sb.ToString()));
                    }
                }

                success = true;
            });
            return(success);
        }
Exemple #20
0
        private void LoadSetting()
        {
            if (App.GV.Scale == 0)
            {
                App.GV.Scale = 1;
            }
            App.LastDir = App.RootDir;

            tb_Fps.SetBinding(TextBox.TextProperty, new Binding()
            {
                Source = App.GV, Path = new PropertyPath("Speed")
            });
            lb_Scale.SetBinding(Label.ContentProperty, new Binding()
            {
                Source = App.GV, Path = new PropertyPath("Scale")
            });
            lb_Width.SetBinding(ContentProperty, new Binding()
            {
                Source = App.GV, Path = new PropertyPath("FrameWidth")
            });
            lb_Height.SetBinding(ContentProperty, new Binding()
            {
                Source = App.GV, Path = new PropertyPath("FrameHeight")
            });

            //lb_PosX.SetBinding(ContentProperty, new Binding() { Source = App.GV, Path = new PropertyPath("PosX") });
            //lb_PosY.SetBinding(ContentProperty, new Binding() { Source = App.GV, Path = new PropertyPath("PosY") });

            tb_PosX.SetBinding(TextBox.TextProperty, new Binding()
            {
                Source = App.GV, Path = new PropertyPath("PosX")
            });
            tb_PosY.SetBinding(TextBox.TextProperty, new Binding()
            {
                Source = App.GV, Path = new PropertyPath("PosY")
            });

            chb_Alpha.SetBinding(CheckBox.IsCheckedProperty, new Binding()
            {
                Source = App.GV, Path = new PropertyPath("Alpha")
            });
            chb_IsLoop.SetBinding(CheckBox.IsCheckedProperty, new Binding()
            {
                Source = App.GV, Path = new PropertyPath("IsLoop")
            });
            chb_PreMultiplyAlpha.SetBinding(CheckBox.IsCheckedProperty, new Binding()
            {
                Source = App.GV, Path = new PropertyPath("PreMultiplyAlpha")
            });
            TextCompositionManager.AddPreviewTextInputStartHandler(tb_Fps, tb_Fps_PreviewTextInput);
        }
Exemple #21
0
 public MainWindow()
 {
     InitializeComponent();
     SetDecimalSeparator(DetectDecimalSeparator());
     entry        = "0";
     lastEntry    = dLastEntry;
     history      = dtHistory;
     operation    = dOperation;
     hasSeparator = false;
     toReset      = false;
     TextCompositionManager.AddTextInputHandler(this, new TextCompositionEventHandler(OnTextComposition));
     UpdateEntry();
     UpdateHistory();
 }
        public static void WriteText(this TextBox textBox, string text, bool overwrite = true)
        {
            if (overwrite)
            {
                textBox.SelectAll();
            }
            var composition = new TextComposition(InputManager.Current, textBox, text);

            TextCompositionManager.StartComposition(composition);
            if (text == "")
            {
                textBox.Text = "";
            }
        }
Exemple #23
0
        public EditTag(Tag tagToEdit, onEditTag editTagCallback)
        {
            InitializeComponent();
            Root.DataContext   = this;
            EditTagCallback    = editTagCallback;
            NewTag             = new models.Tag();
            NewTag.Id          = tagToEdit.Id;
            NewTag.Description = tagToEdit.Description;
            NewTag.Color       = tagToEdit.Color;
            TagColor           = System.Windows.Media.Color.FromRgb((byte)newTag.Color.Red, (byte)newTag.Color.Green, (byte)newTag.Color.Blue);

            TextCompositionManager.AddTextInputHandler(this,
                                                       new TextCompositionEventHandler(OnTextComposition));
        }
Exemple #24
0
        public TagSection(ObservableCollection <Tag> tags, onAddTag addTagCallback, onEditTag editTagCallback, onRemoveTag removeTagCallback)
        {
            InitializeComponent();
            EnlargenedTags     = new ObservableCollection <string>();
            Root.DataContext   = this;
            TagClickedCallback = new onTagClicked(tagClicked);
            Tags              = tags;
            AddTagCallback    = addTagCallback;
            EditTagCallback   = editTagCallback;
            RemoveTagCallback = removeTagCallback;

            TextCompositionManager.AddTextInputHandler(this,
                                                       new TextCompositionEventHandler(OnTextComposition));
        }
 public CodeEditorOperations(CodeEditor codeEditor, ICompletionBroker completionBroker, ICodeAidProvider codeAidProvider)
 {
     this.editorElement                 = codeEditor.Element;
     this.editorOperations              = codeEditor.EditorCommands;
     this.undoHistory                   = codeEditor.UndoHistory;
     this.textView                      = codeEditor.TextView;
     this.completionBroker              = completionBroker;
     this.codeAidEngine                 = new XamlCodeAidEngine(codeEditor.TextBuffer, codeAidProvider, codeEditor.Environment);
     this.editorElement.TextInput      += new TextCompositionEventHandler(this.OnTextInput);
     this.editorElement.KeyDown        += new KeyEventHandler(this.OnKeyDown);
     this.editorElement.MouseDown      += new MouseButtonEventHandler(this.OnMouseDown);
     this.undoHistory.UndoRedoHappened += new EventHandler <UndoRedoEventArgs>(this.OnUndoRedoHappened);
     TextCompositionManager.AddTextInputStartHandler((DependencyObject)this.editorElement, new TextCompositionEventHandler(this.OnTextInputStart));
     TextCompositionManager.AddTextInputUpdateHandler((DependencyObject)this.editorElement, new TextCompositionEventHandler(this.OnTextInputUpdate));
 }
        public EditType(Type typeToEdit, onEditType editTypeCallback)
        {
            InitializeComponent();
            this.NewType             = new Type();
            this.newType.Id          = typeToEdit.Id;
            this.newType.Name        = typeToEdit.Name;
            this.NewType.Description = typeToEdit.Description;
            this.NewType.Icon        = typeToEdit.Icon;

            Root.DataContext = this;
            EditTypeCallback = editTypeCallback;

            TextCompositionManager.AddTextInputHandler(this,
                                                       new TextCompositionEventHandler(OnTextComposition));
        }
        readonly PlainTextNote _ptn = new PlainTextNote(); // The enhanced note window

        /** Starting Process **/
        /**********************/
        /// The application starts by asking for tester and charter information. Only then the session starts

        // Default constructor, everything is empty/default values
        public SmWidget()
        {
            RegUtil.InitReg();
            var trans = GetTransparencyFromReg();

            Logger.Record("[SMWidget]: App constructor. Initializing.", "SMWidget", "info");
            InitializeComponent();
            SetBgColor(GetBgColorFromReg());
            TransparencySlide.Value = trans;
            _ptn.InitializeComponent();
            _ptn.Sm = this;
            TextCompositionManager.AddPreviewTextInputHandler(NoteContent, OnPreviewTextInput);
            TextCompositionManager.AddPreviewTextInputUpdateHandler(NoteContent, OnPreviewTextInputUpdate);
            Task.Run((Action)Updater.CheckVersion);
            NoteContent.Focus();
            Logger.Record("[SMWidget]: App constructor initialized and CLI executed.", "SMWidget", "info");
        }
Exemple #28
0
        public override void OnApplyTemplate()
        {
            if (_textBox != null)
            {
                TextCompositionManager.RemovePreviewTextInputHandler(_textBox, PreviewTextInputHandler);
                _textBox.TextChanged    -= TextBox_TextChanged;
                _textBox.PreviewKeyDown -= TextBox_PreviewKeyDown;
                _textBox.LostFocus      -= TextBox_LostFocus;
            }

            base.OnApplyTemplate();

            _textBox  = GetTemplateChild(ElementTextBox) as TextBox;
            _errorTip = GetTemplateChild(ElementErrorTip) as UIElement;

            if (_textBox != null)
            {
                _textBox.SetBinding(SelectionBrushProperty, new Binding(SelectionBrushProperty.Name)
                {
                    Source = this
                });
#if !(NET40 || NET45 || NET451 || NET452 || NET46 || NET461 || NET462 || NET47 || NET471 || NET472)
                _textBox.SetBinding(SelectionTextBrushProperty, new Binding(SelectionTextBrushProperty.Name)
                {
                    Source = this
                });
#endif
                _textBox.SetBinding(SelectionOpacityProperty, new Binding(SelectionOpacityProperty.Name)
                {
                    Source = this
                });
                _textBox.SetBinding(CaretBrushProperty, new Binding(CaretBrushProperty.Name)
                {
                    Source = this
                });

                TextCompositionManager.AddPreviewTextInputHandler(_textBox, PreviewTextInputHandler);
                _textBox.TextChanged    += TextBox_TextChanged;
                _textBox.PreviewKeyDown += TextBox_PreviewKeyDown;
                _textBox.LostFocus      += TextBox_LostFocus;
                _textBox.Text            = CurrentText;
            }
        }
        public HudWindow()
        {
            InitializeComponent();

            if (DesignerProperties.GetIsInDesignMode(this))
            {
            }
            else
            {
                tmr          = new DispatcherTimer();
                tmr.Tick    += tmr_Tick;
                tmr.Interval = TimeSpan.FromMilliseconds(20);
                tmr.Start();

                TextCompositionManager.AddTextInputHandler(this, new TextCompositionEventHandler(Main.KeyBoardKeyPressed));

                Sensitivity_DirectionSlider.Value = Properties.Settings.Default.DefaultLRFBSpeed;
                Sensitivity_YawSlider.Value       = Properties.Settings.Default.DefaultYawSpeed;
                Sensitivity_GazSlider.Value       = Properties.Settings.Default.DefaultGazSpeed;
            }
        }
Exemple #30
0
        public override void OnApplyTemplate()
        {
            if (_textBox != null)
            {
                TextCompositionManager.RemovePreviewTextInputHandler(_textBox, PreviewTextInputHandler);
                _textBox.TextChanged    -= _textBox_TextChanged;
                _textBox.PreviewKeyDown -= TextBox_PreviewKeyDown;
                _textBox.LostFocus      -= TextBox_LostFocus;
            }

            base.OnApplyTemplate();

            _textBox = GetTemplateChild(ElementTextBox) as TextBox;

            if (_textBox != null)
            {
                TextCompositionManager.AddPreviewTextInputHandler(_textBox, PreviewTextInputHandler);
                _textBox.TextChanged    += _textBox_TextChanged;
                _textBox.PreviewKeyDown += TextBox_PreviewKeyDown;
                _textBox.LostFocus      += TextBox_LostFocus;
                _textBox.Text            = CurrentText;
            }
        }