Пример #1
0
 private async Task DoNewAsync()
 {
     await SafeExecutionContext.ExecuteAsync(
         this,
         async() =>
     {
         var newNoteForm = new TextInputBox(Resources.NewNotePrompt, new Tuple <Func <string, bool>, string>[]
         {
             new Tuple <Func <string, bool>, string>(string.IsNullOrEmpty, Resources.TitleRequired),
             new Tuple <Func <string, bool>, string>(this.ExistingNotesTitle.Contains, Resources.TitleExists)
         });
         if (newNoteForm.ShowDialog() == DialogResult.OK)
         {
             var title = newNoteForm.InputText;
             var note  =
                 new Note
             {
                 ID            = Guid.Empty,
                 Title         = title,
                 Content       = string.Empty,
                 DatePublished = DateTime.UtcNow
             };
             await this.ImportNote(note);
         }
     });
 }
Пример #2
0
 public InputBox()
 {
     this.InitializeComponent();
     TextInputBox.AddHandler(RichEditBox.KeyDownEvent, new KeyEventHandler(TextInputBox_KeyDown), true);
     var a = new RichEditBox();
     var b = new Paragraph();
     var c = new RichTextBlock();
 }
Пример #3
0
 private void InitializeUi()
 {
     MainMenu.Initialize(this);
     OptionsMenu.Initialize();
     Overlay.Initialize();
     PauseMenu.Initialize();
     Dialog       = new Dialog();
     MessageBox   = new MessageBox();
     TextInputBox = new TextInputBox();
 }
Пример #4
0
        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            if (TextInputBox.Text.Contains("\n") && TextInputBox.TextLength >= 1)
            {
                byte[] outStream = Encoding.Unicode.GetBytes(TextInputBox.Text.TrimEnd('\n'));
                serverStream.Write(outStream, 0, outStream.Length);

                TextInputBox.ResetText();
            }
        }
Пример #5
0
        private void SendText(object sender, RoutedEventArgs e)
        {
            var layout =
                (bool)SingleLineLayout.IsChecked ? Layout.SingleLine :
                (bool)DoubleLineLayout.IsChecked ? Layout.DoubleLine :
                Layout.Split;

            m_vm.TextProvider.SendText(TextInputBox.Text, layout);
            TextInputBox.Clear();
        }
Пример #6
0
        private async void OnRename()
        {
            TextInputBox.SelectAll();

            int count = 0;

            // try to get element focus
            while (!TextInputBox.Focus() && ++count < 20)
            {
                await Task.Delay(1);
            }
        }
Пример #7
0
    public void ShowTextInputDialog(string title, string message, UnityAction okAction)
    {
        Destroy(dialogInstance);
        DisableInputReceive();
        dialogInstance = Instantiate(textInputDialog);

        TextInputBox textInputDialogInfo = dialogInstance.GetComponent <TextInputBox>();

        textInputDialogInfo.title.text   = title;
        textInputDialogInfo.message.text = message;
        textInputDialogInfo.okButton.onClick.AddListener(okAction);
    }
Пример #8
0
        private async void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            await Task.Delay(200);

            if (_passwordInput)
            {
                PasswordInputBox.Focus();
            }
            else
            {
                TextInputBox.Focus();
            }
        }
Пример #9
0
        public LoginScreen(MainGame game) : base(game)
        {
            ScreenWidth  = 500;
            ScreenHeight = 150;
            IsFullScreen = false;

            playerNameBox          = new TextInputBox("Enter Your Player Name", new Vector2(0, 0), this, game);
            playerNameBox.Position = new Vector2(50, 55);

            Action loginBtnAction = new Action(() => handleLogin());
            Button loginButton    = new Button("Login", new Vector2(0, 0), loginBtnAction, this);

            loginButton.Position = new Vector2(300, 57);

            Components.Add(playerNameBox);
            Components.Add(loginButton);
        }
Пример #10
0
 /// <summary>
 ///     Executes the current extension.
 /// </summary>
 /// <param name="shell">The <see cref="IShell" /> object on which the current extension will be executed.</param>
 protected override async void DoExecute(IShell shell)
 {
     try
     {
         var setting = this.SettingProvider.GetExtensionSetting <ImportFromWebSetting>();
         var dialog  = new ImportFromWebDialog(setting);
         if (dialog.ShowDialog() == DialogResult.OK)
         {
             var title = HtmlUtilities.ExtractTitle(dialog.HtmlContent);
             if (string.IsNullOrEmpty(title) || shell.ExistingNotesTitle.Contains(title))
             {
                 var titleInputDialog = new TextInputBox(Resources.ImportFromWebInputTitleText,
                                                         Resources.ImportFromWebInputTitlePrompt, title,
                                                         new[]
                 {
                     new Tuple <Func <string, bool>, string>(string.IsNullOrEmpty,
                                                             Resources.ImportFromWebEmptyTitleErrorMsg),
                     new Tuple <Func <string, bool>, string>(shell.ExistingNotesTitle.Contains,
                                                             Resources.ImportFromWebDuplicatedTitleErrorMsg)
                 });
                 if (titleInputDialog.ShowDialog() == DialogResult.OK)
                 {
                     title = titleInputDialog.InputText;
                 }
                 else
                 {
                     return;
                 }
             }
             await shell.ImportNote(new Note
             {
                 Title   = title,
                 Content = dialog.HtmlContent
             });
         }
     }
     catch (Exception ex)
     {
         FrmExceptionDialog.ShowException(ex);
     }
 }
Пример #11
0
        protected override void Update(GameTime gameTime)
        {
#if !DEBUG
            if (!IsActive)
            {
                return;
            }
#endif

            if (_wantsToQuit)
            {
                Exit();
            }

            SteamAPI.RunCallbacks();

            GameTime = gameTime;
            GameUpdateCalled?.Invoke();

            InputSystem.Update();

            _frameRateTimer += gameTime.ElapsedGameTime.TotalMilliseconds;
            if (_frameRateTimer > 1000f)
            {
                FPS             = _totalFrames;
                _totalFrames    = 0;
                _frameRateTimer = 0;
            }

            IsMouseVisible = false;

            Cursor.Update();
            SoundtrackManager.Update();

            MessageBox.Update();
            if (MessageBox.IsActive)
            {
                return;
            }

            TextInputBox.Update();
            if (TextInputBox.IsActive)
            {
                return;
            }

            GameDebug.Update();
            if (GameDebug.IsTyping)
            {
                return;
            }

            PauseMenu.Update();
            OptionsMenu.Update();
            if (OptionsMenu.IsActive)
            {
                return;
            }
            if (PauseMenu.IsActive)
            {
                return;
            }

            Dialog.Update();

            Overlay.Update();
            KeyPopUp.Update();

            Player player = GameWorld.GetPlayers()[0];

            Session.Update();

            //Update the game based on what GameState it is
            switch (CurrentGameState)
            {
            case GameState.MainMenu:
                MainMenu.Update();
                if (GameWorld.TileArray != null && GameWorld.TileArray.Length != 0)
                {
                    goto case GameState.GameWorld;
                }
                break;

            case GameState.LoadingScreen:
                LoadingScreen.Update();

                if (!IsLoadingContent)
                {
                    CurrentGameState = _desiredGameState;
                }
                break;

            case GameState.GameWorld:
                if (IsLoadingContent)
                {
                    return;
                }
                if (GameWorld.IsOnDebug)
                {
                    break;
                }
                GameWorld.TotalUpdateTimer.Start();
                if (!TimeFreeze.IsTimeFrozen())
                {
                    GameWorld.UpdateWorld();
                }
                GameWorld.UpdateVisual();
                GameWorld.TotalUpdateTimer.Measure();


                if (StoryTracker.IsInStoryMode)
                {
                    StoryTracker.Update();
                }
                break;
            }

            base.Update(gameTime);
        }