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(); }
private void ActionButtonView_TappedEvent(object sender, object e) { var packReason = new PackReasonEventArgs { Action = _selectedAction, Reason = _selectedReason, Quantity = _selectedQuantity }; SubmitCommand?.Execute(packReason); }
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 = ""; } }
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(); }
public void Handle_Completed(object sender, EventArgs e) { chatInput.Focus(); SubmitCommand.Execute(null); Text = string.Empty; }
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); } } } }