示例#1
0
        private ActionResult Modify(PocketAction action)
        {
            var actions = new List <PocketAction> {
                action
            };
            var results = _api.Modify(actions).ToList();
            var res     = results.Single();

            return(res);
        }
示例#2
0
        public void AddPocketAction()
        {
            var dialog = new ActionInput();

            dialog.Closing += (sender, args) =>
            {
                if (dialog.DataContext is ActionInputViewModel vm && vm.PocketAction.Id > 0)
                {
                    PocketActions.Add(vm.PocketAction);
                    SelectedPocketAction = vm.PocketAction;
                }
            };

            dialog.ShowDialogWindow(new ActionInputViewModel(dialog), mWindow);
        }
示例#3
0
        public ActionInputViewModel(Window window) : base(window)
        {
            mWindow             = window;
            WindowMinimumHeight = 350;
            WindowMinimumWidth  = 500;
            Title = "Add Pocket Action";

            PocketAction = new PocketAction();

            CloseCommand = new RelayCommand(p =>
            {
                SaveAction();

                mWindow.Close();
            });

            AddCategoryCommand = new RelayCommand(p => AddCategory());
            LoadPocketCategories();
        }
示例#4
0
 /// <summary>
 /// Sends an action.
 /// See: http://getpocket.com/developer/docs/v3/modify
 /// </summary>
 /// <param name="action">The action.</param>
 /// <param name="cancellationToken">The cancellation token.</param>
 /// <returns></returns>
 /// <exception cref="PocketException"></exception>
 public async Task <bool> SendAction(PocketAction action, CancellationToken cancellationToken = default(CancellationToken))
 {
     return(await Send(new List <PocketAction>() { action }, cancellationToken));
 }
示例#5
0
 private void LoadActions()
 {
     using var db         = new AppDbContext();
     PocketActions        = db.PocketActions.ToObservableCollection();
     SelectedPocketAction = PocketActions.FirstOrDefault();
 }
示例#6
0
 private async Task SendAction(PocketAction pa)
 {
     List<Param> parameters = new List<Param>
     {
         new Param("actions", JsonConvert.SerializeObject(new List<PocketAction> {pa}))
     };
     await HandleRequest("send.php", parameters: parameters);
 }
 /// <summary>
 /// Sends an action
 /// </summary>
 /// <param name="actionParameter">The action parameter.</param>
 /// <returns></returns>
 internal async Task <bool> Send(PocketAction actionParameter, CancellationToken cancellationToken)
 {
     return(await Send(new List <PocketAction>() { actionParameter }, cancellationToken));
 }