//BackupDB public BackupDB() { InitializeComponent(); #region UserControl_Loaded if (thread_usercontrol != null && thread_usercontrol.ThreadState == ThreadState.Running) { } else { thread_usercontrol = new Thread(() => { try { this.Dispatcher.Invoke((Action)(() => { BackupLocal backuplocal = new BackupLocal(); uc_backuplocal = (UserControl)backuplocal; uc_backuplocal.Visibility = System.Windows.Visibility.Hidden; uc_backuplocal.Name = "UCBackupLocal"; grContent.Children.Add(uc_backuplocal); UndoRestoreLocal undorestorelocal = new UndoRestoreLocal(); uc_undorestorelocal = (UserControl)undorestorelocal; uc_undorestorelocal.Visibility = System.Windows.Visibility.Hidden; uc_undorestorelocal.Name = "UCUndoDb"; grContent.Children.Add(uc_undorestorelocal); ExportLocal exportlocal = new ExportLocal(); uc_exportlocal = (UserControl)exportlocal; uc_exportlocal.Visibility = System.Windows.Visibility.Hidden; uc_exportlocal.Name = "UCExportLocal"; grContent.Children.Add(uc_exportlocal); })); } catch (Exception ex) { this.Dispatcher.Invoke((Action)(() => { ModernDialog md = new ModernDialog(); md.CloseButton.Content = "Close"; md.Title = "Notification"; md.Content = "Error: " + ex.Message; md.ShowDialog(); })); } }); thread_usercontrol.Start(); } #endregion }
//tviUndo_Selected private void tviUndo_Selected(object sender, RoutedEventArgs e) { grContent.Children.Remove(uc_undorestorelocal); UndoRestoreLocal undorestorelocal = new UndoRestoreLocal(); uc_undorestorelocal = (UserControl)undorestorelocal; uc_undorestorelocal.Visibility = System.Windows.Visibility.Hidden; uc_undorestorelocal.Name = "UCUndoDb"; grContent.Children.Add(uc_undorestorelocal); uc_backuplocal.Visibility = System.Windows.Visibility.Hidden; uc_exportlocal.Visibility = System.Windows.Visibility.Hidden; if (uc_import_export_gdrive != null) { uc_import_export_gdrive.Visibility = System.Windows.Visibility.Hidden; } uc_undorestorelocal.Visibility = System.Windows.Visibility.Visible; if (uc_im_export != null) { grContent.Children.Remove(uc_im_export); } }