Ejemplo n.º 1
0
 public void CloseInput()
 {
     if (!IsOpening)
     {
         return;
     }
     if (InputCoreViewModel.CheckClearInput())
     {
         // reset tab-account synchronization
         AccountSelectorViewModel.SynchronizeWithTab();
         // close
         IsOpening = false;
     }
     // move focus to timeline
     MainWindowModel.SetFocusTo(FocusRequest.Timeline);
 }
Ejemplo n.º 2
0
        public InputViewModel()
        {
            this.CompositeDisposable.Add(_inputCoreViewModel = new InputCoreViewModel(this));
            this.CompositeDisposable.Add(_accountSelectorViewModel = new AccountSelectorViewModel(this));
            this.CompositeDisposable.Add(_postLimitPredictionViewModel = new PostLimitPredictionViewModel());

            this.CompositeDisposable.Add(
                new EventListener<Action>(
                    h => InputModel.FocusRequest += h,
                    h => InputModel.FocusRequest -= h,
                    () =>
                    {
                        OpenInput();
                        FocusToTextBox();
                    }));
            this.CompositeDisposable.Add(
                new EventListener<Action>(
                    h => InputModel.CloseRequest += h,
                    h => InputModel.CloseRequest -= h,
                    CloseInput));
            this.RegisterKeyAssigns();
        }
Ejemplo n.º 3
0
 private void RegisterKeyAssigns()
 {
     KeyAssignManager.RegisterActions(
         KeyAssignAction.Create("CloseInput", CloseInput),
         KeyAssignAction.Create("Post", InputCoreViewModel.Send),
         KeyAssignAction.Create("LoadStash", () =>
     {
         if (InputCoreViewModel.IsDraftsExisted)
         {
             InputCoreViewModel.DraftedInputs[0].Writeback();
         }
     }),
         KeyAssignAction.Create("Amend", InputCoreViewModel.AmendLastPosted),
         KeyAssignAction.Create("AttachImage", () => { InputCoreViewModel.AttachImage(); }),
         KeyAssignAction.Create("ToggleEscape",
                                () => { InputCoreViewModel.IsUrlAutoEsacpeEnabled = !InputCoreViewModel.IsUrlAutoEsacpeEnabled; }),
         KeyAssignAction.Create("SelectNextAccount", () => AccountSelectorViewModel.SelectNext()),
         KeyAssignAction.Create("SelectPreviousAccount", () => AccountSelectorViewModel.SelectPrev()),
         KeyAssignAction.Create("ClearSelectedAccounts", () => AccountSelectorViewModel.ClearAll()),
         KeyAssignAction.Create("SelectAllAccounts", () => AccountSelectorViewModel.SelectAll())
         );
 }
Ejemplo n.º 4
0
        public InputViewModel()
        {
            CompositeDisposable.Add(InputCoreViewModel           = new InputCoreViewModel(this));
            CompositeDisposable.Add(AccountSelectorViewModel     = new AccountSelectorViewModel(this));
            CompositeDisposable.Add(PostLimitPredictionViewModel = new PostLimitPredictionViewModel());

            CompositeDisposable.Add(
                new EventListener <Action>(
                    h => InputModel.FocusRequest += h,
                    h => InputModel.FocusRequest -= h,
                    () =>
            {
                OpenInput();
                FocusToTextBox();
            }));
            CompositeDisposable.Add(
                new EventListener <Action>(
                    h => InputModel.CloseRequest += h,
                    h => InputModel.CloseRequest -= h,
                    CloseInput));
            RegisterKeyAssigns();
        }