private void Commit() { _logger.Trace(() => "Committing (" + _persistenceTransactionId + ")."); var exceptions = new List <Exception>(); Try( BeforeClose, () => BeforeClose = null, exceptions); Try( !exceptions.Any() ? (Action)CommitTransaction : (Action)RollbackTransaction, () => _transaction = null, exceptions); Try( CloseConnection, () => _connection = null, exceptions); if (exceptions.Any()) { ExceptionsUtility.Rethrow(exceptions.First()); } AfterClose?.Invoke(); AfterClose = null; }
/// <summary> /// Handles the after close callback. /// </summary> /// <param name="args"></param> /// <returns></returns> protected async Task AfterCloseHandler(MouseEventArgs args) { if (AfterClose.HasDelegate) { await AfterClose.InvokeAsync(args); } }
string GenerateCloseModalScript(AfterClose action, string url) { switch (action) { case AfterClose.RefreshParent: return("parent.CloseModal(true);"); case AfterClose.RefreshParentFully: return("window.parent.location = window.parent.location;"); case AfterClose.RedirectTo: return("parent.OpenBrowserWindow(\"{0}\",'_parent');".FormatWith(url)); default: return("parent.CloseModal(false);"); } }
/// <summary> /// Handles the close callback. /// </summary> /// <param name="args"></param> /// <returns></returns> protected async Task OnCloseHandler(MouseEventArgs args) { if (OnClose.HasDelegate) { await OnClose.InvokeAsync(args); } await PlayMotion(); if (AfterClose.HasDelegate) { await AfterClose.InvokeAsync(args); } }
internal void Close() { var args = new EventArgs(); try { Closing?.Invoke(this, args); } // ReSharper disable once EmptyGeneralCatchClause catch { } AfterClose?.Invoke(this, args); }
/// <summary> /// Closes the current modal window. /// </summary> public virtual void CloseModal(AfterClose action = AfterClose.DoNothing, string url = "") { var script = GenerateCloseModalScript(action, url); if (IsFromUpdatePanel() || Database.AnyOpenTransaction()) // || Request.Browser.Browser == "Chrome" { // Inside update panel: ScriptManager.RegisterStartupScript(Page, GetType(), "Close Modal" + Guid.NewGuid(), script, addScriptTags: true); } else { Response.Clear(); Response.Write(@"<html> <body> <script type='text/javascript'> {0} </script> </body> </html>".FormatWith(script)); Response.End(); } }
private void OnAfterClose(object sender, NavigateEventArgs e) { AfterClose?.Invoke(sender, e); }
/// <summary> /// Closes the current modal window. /// </summary> public void CloseModal(AfterClose action) => CloseModal(action, string.Empty);
/// <summary> /// Closes the current modal window. /// </summary> public void CloseModal(AfterClose action) => Page.CloseModal(action);
/// <summary> /// Closes the current modal window. /// </summary> public void CloseModal(AfterClose action = AfterClose.DoNothing, string url = "") { Page.CloseModal(action, url); }
protected virtual void OnAfterClose(object sender, NavigateEventArgs e) { AfterClose?.Invoke(sender, e); }
protected void DoAfterClose() { State = DatabaseState.Closed; AfterClose?.Invoke(this, new EventArgs()); }
public void FinalStandaloneOpen() { this.Show(); owner.Hide(); afterCloseAction = CloseOwner; }
public void StandaloneOpen() { this.Show(); owner.Hide(); afterCloseAction = ReopenOwner; }
public FormNavegable(FormNavegable owner, AfterClose afterCloseAction) : this(owner) { this.afterCloseAction = afterCloseAction; }
public FormNavegable() { this.owner = null; this.afterCloseAction = DoNothing; this.FormClosing += CloseNavegable; }