void IModalService.GoBackward(bool dialogReturnValue) { DoubleAnimation da = new DoubleAnimation(1, TimeSpan.FromMilliseconds(400).Duration()); LayoutRoot.BeginAnimation(Grid.OpacityProperty, da); LayoutRoot.IsHitTestVisible = true; // modalGrid.Children.RemoveAt(modalGrid.Children.Count - 1); //UIElement element = modalGrid.Children[modalGrid.Children.Count - 1]; //element.IsEnabled = true; BackNavigationEventHandler handler = _backFunctions.Pop(); if (handler != null) { handler(dialogReturnValue); } }
private void NavigateModal(UserControl uc, string title, BackNavigationEventHandler backFromDialog, bool allowClose) { DoubleAnimation da = new DoubleAnimation(0.5, TimeSpan.FromMilliseconds(400).Duration()); da.BeginTime = TimeSpan.FromMilliseconds(400); LayoutRoot.BeginAnimation(Grid.OpacityProperty, da); LayoutRoot.IsHitTestVisible = false; SimulatedWindow sw = new SimulatedWindow(); sw.HorizontalAlignment = System.Windows.HorizontalAlignment.Center; sw.VerticalAlignment = System.Windows.VerticalAlignment.Center; sw.Title = title; sw.AllowClose = allowClose; sw.WindowContent = uc; modalGrid.Children.Clear(); modalGrid.Children.Add(sw); _backFunctions.Push(backFromDialog); }
private void DBBackup_ZipWorker(int i) { System.Windows.Forms.DialogResult dr; string sDr = string.Empty; try { workerProcess = new BackgroundWorker(); workerProcess.WorkerReportsProgress = true; workerProcess.WorkerSupportsCancellation = true; if (workerProcess.IsBusy == false) { if (i == 0) { oFactoryResetTransport.BackUpDataBase = FactoryResetConstants.strExchangeDBName; } else if (i == 1) { oFactoryResetTransport.BackUpDataBase = FactoryResetConstants.strTicketingDBName; } workerProcess.DoWork += (s, args) => { Application.Current.Dispatcher.Invoke(DispatcherPriority.Normal, (ThreadStart) delegate { lblStatus.Text = "Status:\nCreating DB backup..."; }); odelDatabaseBackup = new delDatabaseBackup(CreateSqlDatabaseBackUp); IAsyncResult ar = odelDatabaseBackup.BeginInvoke(oFactoryResetTransport.BackUpDataBase, new AsyncCallback(BackupComplete), new object()); while (!ar.IsCompleted) { Thread.Sleep(10); ar.AsyncWaitHandle.WaitOne(); workerProcess.ReportProgress(DateTime.Now.Second); } workerProcess.ReportProgress(DateTime.Now.Second); if (workerProcess.CancellationPending) { args.Cancel = true; MakeVisible(); Refresh(); return; } }; workerProcess.ProgressChanged += (s, args) => { pbFactory.Value = 50 + args.ProgressPercentage; if (Spin.IsFrozen) { LayoutRoot.BeginAnimation(Border.OpacityProperty, Spin, HandoffBehavior.SnapshotAndReplace); } }; workerProcess.RunWorkerCompleted += (s, args) => { if (args.Cancelled == true) { pbFactory.Value = 0; } else { if (bDatabaseBackup == false) { pbFactory.Value = 60; dr = MessageBox.ShowBox("MessageID176", BMC_Icon.Question, BMC_Button.YesNo); sDr = dr.ToString().ToUpper(); if (sDr == "NO") { pbFactory.Value = 0; MakeVisible(); Refresh(); workerProcess.CancelAsync(); workerProcess.Dispose(); return; } } else { pbFactory.Value = 65; //dr = MessageBox.ShowBox("MessageID177", BMC_Icon.Question, BMC_Button.YesNo); // sDr = dr.ToString().ToUpper(); // if (sDr == "YES") // { pbFactory.Value = 70; if (CreateZip() == false) { pbFactory.Value = 80; dr = MessageBox.ShowBox("MessageID178", BMC_Icon.Question, BMC_Button.YesNo); sDr = dr.ToString().ToUpper(); if (sDr == "NO") { pbFactory.Value = 0; MakeVisible(); Refresh(); workerProcess.CancelAsync(); workerProcess.Dispose(); return; } } //} } i = i + 1; if (i == 1 && args.Cancelled == false) { DBBackup_ZipWorker(i); } if (i > 1 && args.Cancelled == false) { ResumeFactoryProcess(); } } }; workerProcess.RunWorkerAsync(); } } catch (Exception ex) { ExceptionManager.Publish(ex); pbFactory.Value = 0; } }