Beispiel #1
0
 private void ListView_Tapped(object sender, TappedRoutedEventArgs e)
 {
     if (InputTextBox.FocusState == FocusState.Unfocused)
     {
         InputTextBox.Focus(FocusState.Programmatic);
     }
 }
Beispiel #2
0
 private void EnterTimeCommandExecuted(object sender, ExecutedRoutedEventArgs e)
 {
     ToggleTimeInputBox();
     InputTextBox.Text = this.Timer.Duration.ToString();
     InputTextBox.SelectAll();
     InputTextBox.Focus();
 }
Beispiel #3
0
 void MainPage_Loaded(object sender, RoutedEventArgs e)
 {
     if (searchWord == null)
     {
         InputTextBox.Focus();
     }
 }
        public CustomDialog(string title, string message, CustomDialogType dialogType, string placeholderText = null)
        {
            DialogTitle     = title;
            DialogMessage   = message;
            DialogInputText = placeholderText;

            InitializeComponent();

            InputTextBox.Focus();
            InputTextBox.CaretIndex = DialogInputText == null ? 0 : DialogInputText.Length;

            Background            = CustomBrushes.WindowBackground;
            ButtonGrid.Background = CustomBrushes.DarkGray;

            WindowStartupLocation = WindowStartupLocation.CenterScreen;

            switch (dialogType)
            {
            case CustomDialogType.OK:
                InputTextBox.Visibility = Visibility.Collapsed;
                CancelButton.Visibility = Visibility.Collapsed;
                break;

            case CustomDialogType.YesNo:
                InputTextBox.Visibility = Visibility.Collapsed;
                OkButton.Content        = "Yes";
                CancelButton.Content    = "No";
                break;

            case CustomDialogType.TextInput:
                break;
            }
        }
        private async void PlaySoundpadButton_Click(object sender, RoutedEventArgs e)
        {
            var hasText = !string.IsNullOrWhiteSpace(InputTextBox.Text);

            InputTextBox.Background = hasText ? new SolidColorBrush(Colors.White) : new SolidColorBrush(Colors.Red);
            if (!hasText)
            {
                return;
            }

            if (_soundpad.ConnectionStatus != ConnectionStatus.Connected)
            {
                MessageBox.Show("Soundpad is not running", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }


            var text = InputTextBox.Text;

            if (Settings.Default.EmptyTextAfterPlay)
            {
                InputTextBox.Text = "";
            }
            InputTextBox.Focus();
            await Play(text);
        }
Beispiel #6
0
        private void Image_Tapped(object sender, TappedRoutedEventArgs e)
        {
            var control = sender as Image;

            if (control != null)
            {
                LanguageEnum lang;
                switch (control.Name)
                {
                case "Image_es":
                    lang = LanguageEnum.Spanish;
                    break;

                case "Image_dk":
                    lang = LanguageEnum.Danish;
                    break;

                case "Image_se":
                    lang = LanguageEnum.Swedish;
                    break;

                case "Image_no":
                    lang = LanguageEnum.Norwegian;
                    break;

                default:
                    lang = LanguageEnum.English;
                    break;
                }
                InputTextBox.IsEnabled = true;
                InputTextBox.Focus(FocusState.Programmatic);
                ViewModel.GoToEnterWord(lang);
            }
        }
 private void InitializeEvents()
 {
     Loaded      += (object sender, RoutedEventArgs e) => InputTextBox.Focus();
     KeyDown     += new KeyEventHandler(OnKeyDown);
     LostFocus   += new RoutedEventHandler(OnLostFocus);
     Deactivated += new EventHandler(OnLostFocus);
 }
 public InputBoxPassword()
 {
     InitializeComponent();
     DataContext = this;
     InputTextBox.Focus();
     Loaded += (s, e) => InputTextBox.SelectAll();
 }
Beispiel #9
0
 private void NewProblemButton_Click(object sender, RoutedEventArgs e)
 {
     if (Adding)
     {
         _main.Equation.NewAdditionExpression();
         InputTextBox.Text = "";
         InputTextBox.Focus();
         _main.Result.DefaultImage();
     }
     else if (Subtracting)
     {
         _main.Equation.NewSubtractionExpression();
         InputTextBox.Text = "";
         InputTextBox.Focus();
         _main.Result.DefaultImage();
     }
     else if (Multiplying)
     {
         _main.Equation.NewMultiplicationExpression();
         InputTextBox.Text = "";
         InputTextBox.Focus();
         _main.Result.DefaultImage();
     }
     else if (Dividing)
     {
         _main.Equation.NewDivisionExpression();
         InputTextBox.Text = "";
         InputTextBox.Focus();
         _main.Result.DefaultImage();
     }
     InputTextBox.Focus();
 }
Beispiel #10
0
        /// <summary>
        /// function which grabs the user's input and determines if it is
        /// correct and if it needs to create a new question. If the limit has
        /// been reached -> Ends the game
        /// </summary>
        public void Submit_User_Input()
        {
            try
            {
                Sound.PlayCoinSound();
                double answer;
                double.TryParse(InputTextBox.Text, out answer);
                bool result = CurrentGame.IsCorrect(answer);

                if (CurrentGame.AnsweredQuestions < 10)
                {
                    QuestionTextBlock.Text = CurrentGame.GenerateQuestion();
                    AnswerResponse.Text    = (result) ? "Correct!" : "Incorrect!";
                    InputTextBox.Text      = "";
                    InputTextBox.Focus();
                }
                else
                {
                    QuestionTextBlock.Text = "";
                    AnswerResponse.Text    = "";
                    CurrentGame.StopTimer();
                    Timer.IsEnabled = false;
                    EndGame();
                }

                ProgressBar.Value += 10;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #11
0
 public async Task PrepareTypingSession()
 {
     InputTextBox.IsEnabled = true;
     InputTextBox.Focus(FocusState.Pointer);
     await LoadNewBatch();
     await Redraw();
 }
Beispiel #12
0
        private void SplitButton_Click(object sender, RoutedEventArgs e)
        {
            InputBox.Visibility = Visibility.Visible;
            InputBox.IsOpen     = true;

            InputTextBox.Focus();
        }
Beispiel #13
0
        /// <summary>
        /// Starts the Animation321Go and sets the game up to begin starting
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public async void Game_Start_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Sound.PlayJumpSound();

                StartGameBtn.Visibility = Visibility.Hidden;

                CurrentGame             = new Game();
                CurrentGame.CurrentMode = mode;

                Animation321Go();
                await Task.Delay(TimeSpan.FromSeconds(4));

                if (CurrentGame != null)
                {
                    GameGrid.Visibility   = Visibility.Visible;
                    TimerLabel.Visibility = Visibility.Visible;

                    CurrentGame.StartTimer();
                    Timer.IsEnabled        = true;
                    QuestionTextBlock.Text = CurrentGame.GenerateQuestion();
                }

                InputTextBox.Text = "";
                InputTextBox.Focus();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed to Start the Games.\n" + ex.ToString(),
                                "Error - Start Game", MessageBoxButton.OK, MessageBoxImage.Exclamation);
            }
        }
Beispiel #14
0
 public MainWindow()
 {
     InitializeComponent();
     InputTextBox.Focus();
     _main.Result.DefaultImage();
     DataContext = _main;
 }
        public MainWindow()
        {
            DataContext = _translateModel;
            InitializeComponent();
            _notifyIcon.Text         = @"Google translate desktop";
            _notifyIcon.Visible      = true;
            _notifyIcon.Icon         = new System.Drawing.Icon(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "logo.ico"));
            _notifyIcon.DoubleClick += NotifyIcon_DoubleClick;
            if (!AppSettingsManager.ExistConfig())
            {
                _notifyIcon.BalloonTipTitle = @"Hi, 我在这儿呢";
                _notifyIcon.BalloonTipText  = @"使用快捷键 Control+` 可以打开我哦";
                _notifyIcon.ShowBalloonTip(5000);
            }

            Closing += MainWindow_Closing;

            var menuItems = new[]
            {
                //new MenuItem("热键",SetHotKey),
                new MenuItem("开机启动", SetAutoStartup)
                {
                    Name = "AutoStartup", Checked = AutoStartup.IsExistKey("Google translate desktop"),
                },
                new MenuItem("开打主窗口( Control+` )", Show),
                new MenuItem("退出", Exit)
            };

            _notifyIcon.ContextMenu = new System.Windows.Forms.ContextMenu(menuItems);

            _translateModel.OnChangeTargetLanguage += async arg => { await _translateModel.Translate(); };
            var appSettings = AppSettingsManager.Read();

            if (appSettings.TopMost)
            {
                Topmost             = true;
                TopMostIcon.Source  = BitmapFrame.Create(new Uri("pack://application:,,,/resources/topmost_yes.ico", UriKind.RelativeOrAbsolute));
                TopMostIcon.ToolTip = "取消置顶";
            }
            else
            {
                Topmost             = false;
                TopMostIcon.Source  = BitmapFrame.Create(new Uri("pack://application:,,,/resources/topmost_no.ico", UriKind.RelativeOrAbsolute));
                TopMostIcon.ToolTip = "置顶";
            }

            var lag = _translateModel.Languages.FirstOrDefault(p => p.Code == (string.IsNullOrWhiteSpace(appSettings.CurrentTargetLanguage) ? "en" : appSettings.CurrentTargetLanguage));

            if (lag != null)
            {
                _translateModel.TargetLanguage     = lag.Code;
                _translateModel.TargetLanguageText = lag.Name;
            }



            InputTextBox.Focus();
            HideWindow();
        }
Beispiel #16
0
        private void OnLoaded(object sender, System.Windows.RoutedEventArgs e)
        {
            _windowKeyDownHelper = new WindowKeyDownHelper(this);
            _windowKeyDownHelper.Register();
            _windowKeyDownHelper.KeyDown += WindowOnKeyDown;

            InputTextBox.Focus();
        }
Beispiel #17
0
        private void SendButton_OnClick(object sender, RoutedEventArgs e)
        {
            string input = InputTextBox.Text.ToLower();

            DataReceived?.Invoke(this, input);
            InputTextBox.Focus();
            InputTextBox.SelectAll();
        }
Beispiel #18
0
        public PromptDialog()
        {
            PromptText = "Please enter destination queue name (e.g. 'someQueue@someMachine', or just 'someQueue' for a local queue):";
            InitializeComponent();
            DataContext = this;

            Loaded += (w, ea) => InputTextBox.Focus();
        }
 private void ShowWindow()
 {
     //WindowState = WindowState.Normal;
     Visibility    = Visibility.Visible;
     ShowInTaskbar = true;
     InputTextBox.Focus();
     InputTextBox.SelectAll();
 }
Beispiel #20
0
        public InputControl(MessageBoxFacade messageBoxFacade)
        {
            InitializeComponent();
            Background = Brushes.LightGray;

            _messageBoxFacade = messageBoxFacade ?? throw new ArgumentNullException(nameof(messageBoxFacade));
            Loaded           += (sender, args) => { InputTextBox.Focus(); };
        }
Beispiel #21
0
 private void ErrorLogTextBox_DoubleClick(object sender, EventArgs e)
 {
     if (Analizer.tokenizerLastErrorPos != 0)
     {
         InputTextBox.Focus();
         InputTextBox.Select(Analizer.tokenizerLastErrorPos, 1);
     }
 }
Beispiel #22
0
        public RenameWindow(string oldName)
        {
            InitializeComponent();

            InputTextBox.Text = oldName;
            InputTextBox.SelectAll();
            InputTextBox.Focus();
        }
Beispiel #23
0
 private void DeleteButton_Click(object sender, RoutedEventArgs e)
 {
     //wyczyszczenie pol tekstowych
     InputTextBox.Text  = string.Empty;
     OutputTextBox.Text = string.Empty;
     //ustawienie aktywnosci kursora na polu wejsciowym
     InputTextBox.Focus();
     InputTextBox.CaretIndex = InputTextBox.Text.Length;
 }
        private async void SendMessageButton_Click(object sender, RoutedEventArgs e)
        {
            InputTextBox.Focus(FocusState.Programmatic);
            bool sendMessageResult = await GetMainPageVm().SendMessageButton_Click(InputTextBox.Text);

            if (sendMessageResult)
            {
                InputTextBox.Text = string.Empty;
            }
        }
Beispiel #25
0
        //adds InputTextBox to InputPanel
        private void AddValueBox(string value)
        {
            InputTextBox tb = new InputTextBox();

            tb.Text        = value;
            tb.Break       = BreakType.None;
            tb.Validating += new CancelEventHandler(tb_Validating);
            c1InputPanel1.Items.Insert(c1InputPanel1.Items.Count - 2, tb);
            tb.Focus();
        }
 private void UserControl_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
 {
     if (this.Visibility == Visibility.Visible)
     {
         App.Current.Dispatcher.BeginInvoke((Action) delegate
         {
             InputTextBox.Focus();
         });
     }
 }
Beispiel #27
0
 void CoreWindow_KeyDown(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.KeyEventArgs args)
 {
     if (args.VirtualKey == Windows.System.VirtualKey.Back &&
         InputTextBox.FocusState == Windows.UI.Xaml.FocusState.Unfocused &&
         Scroller.Visibility == Windows.UI.Xaml.Visibility.Visible)
     {
         Left();
         InputTextBox.Focus(Windows.UI.Xaml.FocusState.Keyboard);
     }
 }
Beispiel #28
0
        public ClientWindow()
        {
            InitializeComponent();

            Loaded += OnLoaded;

            InputTextBox.Focus();

            IsConnected = true;
        }
Beispiel #29
0
        private void SendMessageButtonOnClick(object sender, RoutedEventArgs e)
        {
            var chatViewModel = DataContext as CappuChatViewModelBase;

            chatViewModel?.SendMessageCommand?.Execute(InputTextBox.Text);

            InputTextBox.Clear();
            InputTextBox.Focus();

            chatViewModel?.SendMessageCommand?.RaiseCanExecuteChanged();
        }
        bool isIncome;            //Boolean to get if the input window is for income or for spent money

        //Constructor to use from a MainWindowclass
        public InputBox(MainWindow _parent, bool _isIncome)
        {
            parent   = _parent;
            isIncome = _isIncome;
            InitializeComponent();
            InputTextBox.IsEnabled = false;                                  //Disable the textbox to block unwanted input
            Lb_Amount.Foreground   = isIncome ? Brushes.Green : Brushes.Red; //Depending on income or spent money, make the "Amount label" green or red
            InputTextBox.IsEnabled = true;                                   //Reenable the textbox
            InputTextBox.Focus();
            this.KeyDown += new KeyEventHandler(InputBox_KeyDown);           //Registering a KeyEventHandler to listen for Keypresses
        }