public async Task SaveDonationAsync()
        {
            if (!App.User.Verified)
            {
                UserDialogs.Instance.Alert("", "You can't post until you are verified as a donor.");
                return;
            }

            IsBusy = true;
            EnterCommand.ChangeCanExecute();
            var res = await donationRepository.SaveDonationAsync(DonationTitle, mediaFile, Quantity, DonationType, ExpirationDate, ExpirationTime);

            IsBusy = false;
            EnterCommand.ChangeCanExecute();

            if (res)
            {
                App.Current.MainPage = new RootPage()
                {
                    Detail = new NavigationPage(new DonationTabPage())
                }
            }
            ;
            else
            {
                UserDialogs.Instance.Alert("Please check all of your entries.", "Unable to process your request");
            }
        }
        private async Task ExecuteRelistCommand(int id)
        {
            DonationCapture capture = new DonationCapture()
            {
                Title      = DonationTitle,
                Type       = DonationType,
                Amount     = Quantity,
                Expiration = ExpirationDate.Add(ExpirationTime)
            };
            var okToProceed = await CheckRemoveRecipient();

            if (okToProceed)
            {
                IsBusy = true;
                EnterCommand.ChangeCanExecute();
                var res = await donationRep.RelistDonationAsync(capture, donation.Id, mediaFile);

                IsBusy = false;
                EnterCommand.ChangeCanExecute();

                if (!res)
                {
                    ShowFailureDialog("Unable to Relist");
                }
                else
                {
                    await Page.Navigation.PopToRootAsync();
                }
            }
        }
 private void TextBoxValueKeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key.Equals(Key.Enter))
     {
         if (Validate())
         {
             if (EnterCommand != null && EnterCommand.CanExecute(null))
                 EnterCommand.Execute(null);
             hiddenButton.Focus(); // workaround to hide the keyboard
         }
     }
 }
示例#4
0
        public void LoadAllCommands()
        {
            //OrderCommand order = new OrderCommand();
            CommandsCommand     help         = new CommandsCommand();
            EnterCommand        enter        = new EnterCommand();
            CheckinCommand      checkin      = new CheckinCommand();
            CheckoutCommand     checkout     = new CheckoutCommand();
            CurrentSetupCommand currentsetup = new CurrentSetupCommand();
            SetupCommand        setup        = new SetupCommand();

            this.Commands = new Collection <ICommand>()
            {
                help, enter, checkin, checkout, currentsetup, setup
            };
        }
示例#5
0
        void PathPointNode_PreviewMouseMove(object sender, MouseEventArgs e)
        {
            if (DirectionType == TypeDirection.OUT)
            {
                Workspace.This.StatusString = "Invaild Action : Path Point Type is Out";
                Workspace.This.Statusbar    = Colors.Red;
                e.Handled = true;
                return;
            }


            if (EnterCommand != null)
            {
                EnterCommand.Execute(this);
            }

            e.Handled = true;
        }
示例#6
0
        protected override void OnKeyDown(KeyEventArgs e)
        {
            base.OnKeyDown(e);

            if (e.Key != Key.Enter)
            {
                return;
            }

            if (EnterCommand == null)
            {
                return;
            }

            if (!EnterCommand.CanExecute(Text))
            {
                return;
            }

            EnterCommand.Execute(Text);
            Text = string.Empty;
        }