Exemplo n.º 1
0
        private void cmdSubmit_Click(object sender, System.EventArgs e)
        {
            lblError.Visible = false;

            //Sanity check
            if (!Validate())
            {
                PageError("Missing a field, please try again.");
                return;
            }

            //Set up the submission process
            string        cvsroot = FormCVSRoot(txtServer.Text, txtUsername.Text, txtRepository.Text);
            SubmitCommand scmd    = new SubmitCommand(cvsroot, txtModule.Text, txtPassword.Text,
                                                      AssignmentID, SubmitterPrincipalID, new Submissions(Globals.CurrentIdentity));

            //Load global context for threads
            Globals.Context = HttpContext.Current;

            //Do the submission
            ViewState["submitting"] = true;
            //	((MasterPage)Page).ExecuteLongTask(scmd);
            scmd.Finished += new ICommandEventHandler(scmd_Finished);
            scmd.Execute();
        }
Exemplo n.º 2
0
        private void ActionButtonView_TappedEvent(object sender, object e)
        {
            var packReason = new PackReasonEventArgs
            {
                Action   = _selectedAction,
                Reason   = _selectedReason,
                Quantity = _selectedQuantity
            };

            SubmitCommand?.Execute(packReason);
        }
Exemplo n.º 3
0
 private void mainpanel_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         UIElement element = EditFields.LastOrDefault() as UIElement;
         if (SubmitCommand != null && element != null && (element.IsFocused || element.IsKeyboardFocused || element.IsKeyboardFocusWithin))
         {
             SubmitCommand.Execute(EditFields);
         }
     }
     else if (e.Key == Key.Escape)
     {
         CancelCommand.Execute(null);
     }
 }
 /// <summary>
 ///
 /// </summary>
 protected Task OnValidateCommand(Object parameter)
 {
     UIAtomsApplication.Instance.TriggerOnce(() =>
     {
         UpdateIsValid();
         if (IsValid)
         {
             SubmitCommand?.Execute(parameter ?? BindingContext);
         }
         else
         {
             UIAtomsApplication.Instance.NotificationService.NotifyAsync(InvalidMessage);
         }
     });
     return(Task.CompletedTask);
 }
        private void OnEnterKeyPress()
        {
            var enteredValue = AssociatedObject.Text;

            if (string.IsNullOrEmpty(enteredValue))
            {
                return;
            }
            if (SubmitCommand == null)
            {
                return;
            }

            SubmitCommand.Execute(enteredValue);
            if (ClearTextAfterSubmit)
            {
                AssociatedObject.Text = "";
            }
        }
Exemplo n.º 6
0
        private void cmdSubmit_Click(object sender, System.EventArgs e)
        {
            lblError.Visible = false;
            HttpPostedFile upfile = fileUpload.PostedFile;
            if (upfile.ContentLength == 0) {
                PageError("Please specify a file to upload");
                return;
            }

            SubmitCommand scmd =
                new SubmitCommand(new Submissions(Globals.CurrentIdentity), upfile,
                AssignmentID, SubmitterPrincipalID);

            //Load global context for threads
            Globals.Context = HttpContext.Current;

            ViewState["submitting"] = true;
            //	((MasterPage)Page).ExecuteLongTask(scmd);

            scmd.Finished += new ICommandEventHandler(scmd_Finished);
            scmd.Execute();
        }
Exemplo n.º 7
0
        private void cmdSubmit_Click(object sender, System.EventArgs e)
        {
            lblError.Visible = false;

            //Sanity check
            if (!Validate()) {
                PageError("Missing a field, please try again.");
                return;
            }

            //Set up the submission process
            string cvsroot = FormCVSRoot(txtServer.Text, txtUsername.Text, txtRepository.Text);
            SubmitCommand scmd = new SubmitCommand(cvsroot, txtModule.Text, txtPassword.Text,
                AssignmentID, SubmitterPrincipalID, new Submissions(Globals.CurrentIdentity));

            //Load global context for threads
            Globals.Context = HttpContext.Current;

            //Do the submission
            ViewState["submitting"] = true;
            //	((MasterPage)Page).ExecuteLongTask(scmd);
            scmd.Finished += new ICommandEventHandler(scmd_Finished);
            scmd.Execute();
        }
Exemplo n.º 8
0
        private void cmdSubmit_Click(object sender, System.EventArgs e)
        {
            lblError.Visible = false;
            HttpPostedFile upfile = fileUpload.PostedFile;

            if (upfile.ContentLength == 0)
            {
                PageError("Please specify a file to upload");
                return;
            }

            SubmitCommand scmd =
                new SubmitCommand(new Submissions(Globals.CurrentIdentity), upfile,
                                  AssignmentID, SubmitterPrincipalID);

            //Load global context for threads
            Globals.Context = HttpContext.Current;

            ViewState["submitting"] = true;
            //	((MasterPage)Page).ExecuteLongTask(scmd);

            scmd.Finished += new ICommandEventHandler(scmd_Finished);
            scmd.Execute();
        }
Exemplo n.º 9
0
 public void Handle_Completed(object sender, EventArgs e)
 {
     chatInput.Focus();
     SubmitCommand.Execute(null);
     Text = string.Empty;
 }
Exemplo n.º 10
0
        protected override void Invoke(object parameter)
        {
            if (Form.IsNotNull())
            {
                if (ScrollViewer != null)
                {
                    var  _curForm = Form as FrameworkElement;
                    var  _1       = AyForm.Forms[_curForm];
                    bool hasFalse = false;
                    foreach (var item in _1)
                    {
                        var _2 = item as IAyValidate;
                        if (_2.IsNotNull())
                        {
                            var _3 = _2.ValidateButNotShowError();
                            if (!_3)
                            {
                                hasFalse = true;
                                var currentScrollPosition = ScrollViewer.VerticalOffset;
                                var point = new Point(0, currentScrollPosition);

                                // 计算出目标位置并滚动
                                var targetPosition = item.TransformToVisual(ScrollViewer).Transform(point);
                                ScrollViewer.ScrollToVerticalOffset(targetPosition.Y);
                                templi = _2;
                                if (_ShowErrorTime == null)
                                {
                                    _ShowErrorTime = new AyTimeSetTimeout(100, () =>
                                    {
                                        templi.ShowError();
                                    });
                                }
                                _ShowErrorTime.Start();
                                break;
                            }
                        }
                    }
                    if (hasFalse)
                    {
                        return;
                    }
                    if (Submit != null)
                    {
                        Submit(true, new RoutedEventArgs()
                        {
                        });
                    }
                    if (SubmitCommand != null)
                    {
                        SubmitCommand.Execute(true);
                    }
                }
                else
                {
                    var  _curForm = Form as FrameworkElement;
                    var  _1       = AyForm.Forms[_curForm];
                    bool hasFalse = false;
                    foreach (var item in _1)
                    {
                        var _2 = item as IAyValidate;
                        if (_2.IsNotNull())
                        {
                            var _3 = _2.Validate();
                            if (!_3)
                            {
                                hasFalse = true;
                                break;
                            }
                        }
                    }
                    if (hasFalse)
                    {
                        return;
                    }
                    if (Submit != null)
                    {
                        Submit(true, new RoutedEventArgs()
                        {
                        });
                    }
                    if (SubmitCommand != null)
                    {
                        SubmitCommand.Execute(true);
                    }
                }
            }
        }