private void PreviewClosed(object sender, WindowPreviewClosedEventArgs e) { if (e.Cancel == true) { return; } var guard = (IGuardClose) model; if (actuallyClosing) { actuallyClosing = false; return; } bool runningAsync = false, shouldEnd = false; guard.CanClose(canClose => { Execute.OnUIThread(() => { if (runningAsync && canClose) { actuallyClosing = true; view.Close(); } else { e.Cancel = !canClose; } shouldEnd = true; }); }); if (shouldEnd) { return; } e.Cancel = true; runningAsync = true; }
private void PreviewClosed(object sender, WindowPreviewClosedEventArgs e) { if (e.Cancel == true) { return; } var guard = (IGuardClose)model; if (actuallyClosing) { actuallyClosing = false; return; } bool runningAsync = false, shouldEnd = false; guard.CanClose(canClose => { Execute.OnUIThread(() => { if (runningAsync && canClose) { actuallyClosing = true; view.Close(); } else { e.Cancel = !canClose; } shouldEnd = true; }); }); if (shouldEnd) { return; } e.Cancel = true; runningAsync = true; }
private void RadWindow_PreviewClosed(object sender, WindowPreviewClosedEventArgs e) { if (CambiosSingleton.CambiosOrganismos.Count > 0) { foreach (int org in CambiosSingleton.CambiosOrganismos) { List<int> funcionariosOrganismo = new OrganismosModel().GetFuncionariosPorOrganismo(org); IntegracionesModel model = new IntegracionesModel(org); int idIntegracion = model.GetNewIntegracion(); if (idIntegracion != 0) { model.SetIntegracionFuncionarios(funcionariosOrganismo, idIntegracion); Bitacora bitacora = new Bitacora(); bitacora.IdMovimiento = 64; bitacora.IdElemento = idIntegracion; bitacora.EdoActual = "Cambio Integracion"; bitacora.EdoAnterior = " "; bitacora.NombreEquipo = Environment.MachineName; new BitacoraModel().SetNewBitacoraEntry(bitacora); } } } if (CambiosSingleton.CambioPresidente.Count > 0) { foreach (CommonProperties pres in CambiosSingleton.CambioPresidente) { IntegracionesModel model = new IntegracionesModel(Convert.ToInt32(pres.Descripcion)); model.SetNewPresidente(pres.IdElemento); Bitacora bitacora = new Bitacora(); bitacora.IdMovimiento = 128; bitacora.IdElemento = pres.IdElemento; bitacora.EdoActual = "Cambio Presidente"; bitacora.EdoAnterior = " "; bitacora.NombreEquipo = Environment.MachineName; new BitacoraModel().SetNewBitacoraEntry(bitacora); } } }