コード例 #1
0
ファイル: AddNewGamePage.xaml.cs プロジェクト: RemSoftDev/GMP
 private void ListView_Tapped(object sender, TappedRoutedEventArgs e)
 {
     if (InputTextBox.FocusState == FocusState.Unfocused)
     {
         InputTextBox.Focus(FocusState.Programmatic);
     }
 }
コード例 #2
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);
            }
        }
コード例 #3
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;
            }
        }
コード例 #4
0
        public NightcoreWindow(NightcoreWindowEnumeration setting)
        {
            InitializeComponent();

            Setting = setting;


            switch (Setting)
            {
            case NightcoreWindowEnumeration.Single:
                Title += "Single";
                InputTextBox.SetValue(TextBoxHelper.WatermarkProperty,
                                      (InputTextBox.GetValue(TextBoxHelper.WatermarkProperty) as string) + " (File)");
                OutputTextBox.SetValue(TextBoxHelper.WatermarkProperty,
                                       (OutputTextBox.GetValue(TextBoxHelper.WatermarkProperty) as string) + " (File)");
                break;

            case NightcoreWindowEnumeration.Multiple:
                Title += "Multiple";
                InputTextBox.SetValue(TextBoxHelper.WatermarkProperty,
                                      (InputTextBox.GetValue(TextBoxHelper.WatermarkProperty) as string) + " (Directory)");
                OutputTextBox.SetValue(TextBoxHelper.WatermarkProperty,
                                       (OutputTextBox.GetValue(TextBoxHelper.WatermarkProperty) as string) + " (Directory)");
                break;
            }

            InputTextBox.SetValue(TextBoxHelper.WatermarkProperty,
                                  (InputTextBox.GetValue(TextBoxHelper.WatermarkProperty) as string) + "...");
            OutputTextBox.SetValue(TextBoxHelper.WatermarkProperty,
                                   (OutputTextBox.GetValue(TextBoxHelper.WatermarkProperty) as string) + "...");
        }
コード例 #5
0
ファイル: Form1.cs プロジェクト: SabinaDzitoeva/QuickSort
 private void ClearButton_Click(object sender, EventArgs e)
 {
     InputTextBox.Clear();
     OutputTextBox.Clear();
     arrayLengthLabel.Text = "Длина массива:";
     timeSortLabel.Text    = "Время работы сортировки:";
 }
コード例 #6
0
        private void button3_Click(object sender, EventArgs e)
        {
            string[] randomText = Resources.ResourceManager.GetObject("LoremIpsum").ToString().Split('.');
            List <CustomMessageBoxButton> buttons = new List <CustomMessageBoxButton>();

            for (int j = 0; j < 10; j++)
            {
                string textValue = StaticRandomizer.RandomInt(0, 10) > 6 ? randomText[StaticRandomizer.RandomInt(0, randomText.Length - 1)] : "";

                buttons.Clear();
                int buttonCount = StaticRandomizer.RandomInt(1, 5);
                for (int i = 0; i < buttonCount; i++)
                {
                    buttons.Add(new CustomMessageBoxButton(CustomButtonResult.Button1, randomText[StaticRandomizer.RandomInt(0, randomText.Length - 1)].Trim().Split(' ').FirstOrDefault()));
                }

                using (InputTextBox customMessageBox = new InputTextBox(textValue, randomText[StaticRandomizer.RandomInt(0, randomText.Length - 1)], "CustomMessageBox Demo", buttons.ToArray(), StaticRandomizer.RandomInt(1, buttonCount))
                {
                    StartPosition = FormStartPosition.CenterParent
                })
                {
                    customMessageBox.VerificationText = StaticRandomizer.RandomInt(0, 10) > 6 ? randomText[StaticRandomizer.RandomInt(0, randomText.Length - 1)] : "";
                    customMessageBox.ShowDialog();
                }
            }
        }
コード例 #7
0
        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;
            }
        }
コード例 #8
0
 /// <summary>
 /// EventHandler for Num_Click
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Num_Click(object sender, EventArgs e)
 {
     if ((InputTextBox.Text == "0") || OperatorPressed || EqualsPressed)
     {
         InputTextBox.Clear();
     }
     else /*doNothing();*/ } {
コード例 #9
0
        private void InputTextBox_KeyDown(object sender, KeyEventArgs e)
        {
            Round round = new Round();

            round.Spin = AllRounds.Count() + 1;

            if (e.Key == Key.Enter)
            {
                if (InputValueAllowed())
                {
                    byte currentNumber = byte.Parse(InputTextBox.Text);

                    foreach (Number number in AllRouletteNumbers)
                    {
                        if (currentNumber == number.Digit)
                        {
                            round = UserInputHandler.EnterNumber(currentNumber, round, this);
                        }
                    }

                    AllRounds.Add(round);

                    NumberLogic.UpdateNumberProperties(currentNumber, this);
                    UserInputHandler.CheckIfUserHasWon(round, this);
                }

                InputTextBox.Clear();
                CascadeTextboxes();
                DisplayCurrentRound(round);

                tickSound.Play();
            }
        }
コード例 #10
0
ファイル: TextPad.xaml.cs プロジェクト: j0eyWh/Typist
 public async Task PrepareTypingSession()
 {
     InputTextBox.IsEnabled = true;
     InputTextBox.Focus(FocusState.Pointer);
     await LoadNewBatch();
     await Redraw();
 }
コード例 #11
0
        private void SplitButton_Click(object sender, RoutedEventArgs e)
        {
            InputBox.Visibility = Visibility.Visible;
            InputBox.IsOpen     = true;

            InputTextBox.Focus();
        }
コード例 #12
0
 private void InitializeEvents()
 {
     Loaded      += (object sender, RoutedEventArgs e) => InputTextBox.Focus();
     KeyDown     += new KeyEventHandler(OnKeyDown);
     LostFocus   += new RoutedEventHandler(OnLostFocus);
     Deactivated += new EventHandler(OnLostFocus);
 }
コード例 #13
0
ファイル: AddNewGamePage.xaml.cs プロジェクト: RemSoftDev/GMP
        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);
            }
        }
コード例 #14
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void RandomButton_Click(object sender, EventArgs e)
        {
            InputTextBox.Clear();
            OutputTextBox.Clear();
            TimeBox.Clear();
            CountText.Clear();

            int    n    = rnd.Next(2, 20);
            int    k    = rnd.Next(1, n);
            string line = null;

            for (int i = 0; i < k; i++)
            {
                int temp1 = rnd.Next(1, n);
                int temp2 = rnd.Next(1, n);
                if (temp1 != temp2)
                {
                    line += temp1 + " " + temp2 + "\n";
                    i++;
                }
            }
            if (line != null)
            {
                InputTextBox.Text = line.Trim();
            }
            CountText.Text = n + " " + k;
        }
コード例 #15
0
 private void EnterTimeCommandExecuted(object sender, ExecutedRoutedEventArgs e)
 {
     ToggleTimeInputBox();
     InputTextBox.Text = this.Timer.Duration.ToString();
     InputTextBox.SelectAll();
     InputTextBox.Focus();
 }
コード例 #16
0
 private void InputTextBox_TextChanged(object sender, EventArgs e)
 {
     if (InputTextBox.Text != "" && Convert.ToInt32(InputTextBox.Text) == 0)
     {
         InputTextBox.Clear();
     }
 }
コード例 #17
0
        public string GetInputText(string description, string caption)
        {
            var view = new InputTextBox(description, caption);

            view.ShowDialog();
            return(view.ReturnedText);
        }
コード例 #18
0
 public InputBoxPassword()
 {
     InitializeComponent();
     DataContext = this;
     InputTextBox.Focus();
     Loaded += (s, e) => InputTextBox.SelectAll();
 }
コード例 #19
0
ファイル: MainForm.cs プロジェクト: tkalandarov/TextEncryptor
 private void ResetTextButton_Click(object sender, EventArgs e)
 {
     InputTextBox.Clear();
     OutputTextBox.Clear();
     CopyToBufferButton.Enabled = false;
     ActiveControl = InputTextBox;
 }
コード例 #20
0
 public MainWindow()
 {
     InitializeComponent();
     InputTextBox.Focus();
     _main.Result.DefaultImage();
     DataContext = _main;
 }
コード例 #21
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();
 }
コード例 #22
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (InputTextBox.Text == String.Empty)
            {
                return;                                    //Abort if there is no input
            }
            try
            {
                //Try to get the absolute value from the input field
                double inputSum = Math.Abs(double.Parse(InputTextBox.Text));

                //Depending on the type of input, increase income or spent money on main window
                if (isIncome)
                {
                    parent.IncomeText.Text = (double.Parse(parent.IncomeText.Text) + inputSum).ToString("0.00");
                }
                else
                {
                    parent.SpentText.Text = (double.Parse(parent.SpentText.Text) - inputSum).ToString("0.00");
                }

                parent.UpdateText();
                this.Close();
            } catch
            {
                //If the user gave wrong input, tell him how to make correct input
                MessageBox.Show("The given input is not a correct amount. Please only use numbers and one point or comma!", "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
                InputTextBox.Clear();
            }
        }
コード例 #23
0
 private void InputTextBox_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e)
 {
     if (e.Control && e.KeyCode == Keys.C)
     {
         InputTextBox.Copy();
     }
 }
コード例 #24
0
        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);
        }
コード例 #25
0
        private void Confirm_Click(object sender, RoutedEventArgs e)
        {
            password = InputTextBox.Password;
            if (handler.authenticateAdmin(password) == 1)
            {
                Page page = null;
                switch (clicked)
                {
                case 1:
                    page = new AddJelo(service);
                    break;

                case 2:
                    page = new Vozilo(service);
                    break;

                case 3:
                    page = new AddVozac(service);
                    break;
                }
                password = null;
                NavigationService.Navigate(page);
            }
            else
            {
                MessageBoxResult box = MessageBox.Show("Netačna administratorska lozinka!");
                password = null;
                InputTextBox.Clear();
            }
            InputBox.Visibility = Visibility.Collapsed;
        }
コード例 #26
0
 void MainPage_Loaded(object sender, RoutedEventArgs e)
 {
     if (searchWord == null)
     {
         InputTextBox.Focus();
     }
 }
コード例 #27
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void ClearButton_Click(object sender, EventArgs e)
 {
     InputTextBox.Clear();
     OutputTextBox.Clear();
     TimeBox.Clear();
     CountText.Clear();
 }
コード例 #28
0
        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();
        }
コード例 #29
0
        public RenameWindow(string oldName)
        {
            InitializeComponent();

            InputTextBox.Text = oldName;
            InputTextBox.SelectAll();
            InputTextBox.Focus();
        }
コード例 #30
0
        public string GetUserInput(string hint)
        {
            InputTextBox inputDialog = new InputTextBox();

            inputDialog.Title = hint;
            inputDialog.ShowDialog();
            return(inputDialog.Result);
        }
コード例 #31
0
ファイル: InputBox.cs プロジェクト: mateuscezar/netgore
 /// <summary>
 /// Creates the <see cref="TextBox"/> instance to use for the input.
 /// </summary>
 /// <param name="position">The position of the <see cref="TextBox"/>.</param>
 /// <param name="size">The suggested size of the <see cref="TextBox"/>.</param>
 /// <returns>The <see cref="TextBox"/> instance to use for the input.</returns>
 protected virtual TextBox CreateTextBoxControl(Vector2 position, Vector2 size)
 {
     var ret = new InputTextBox(this, position, size) { IsMultiLine = false };
     return ret;
 }