public void Close() { try { Main _Main = new Main(); _Main.Show(); Dispatcher.BeginInvoke(new Action(delegate { _Main.Activate(); }), System.Windows.Threading.DispatcherPriority.ContextIdle, null); Application.Current.MainWindow.Close(); } catch (Exception EX) { throw; } }
private static void SetCurrentFolder(string startupFolder) { if (_main.InvokeRequired) { ThreadSafeSetCurrentFolderDelegate d = SetCurrentFolder; _main.Invoke(d, new object[] { startupFolder }); return; } _main.CurrentDirectory = startupFolder; _main.RefreshTrackList(); _main.TreeView.TreeView.ShowFolder(startupFolder); _main.Activate(); }
private void submitBtn_Click(object sender, RoutedEventArgs e) { var newInstitution = new Institution(chiefs.ElementAt(chiefComboBox.SelectedIndex), name.Text); if (!(selected is Institution)) { Org.AddInstitution(newInstitution); } else { ((Institution)selected).Children.Add(newInstitution); } Org.ChiefsList.Remove(chiefs.ElementAt(chiefComboBox.SelectedIndex)); Close(); Main.Activate(); }
private void submitBtn_Click(object sender, RoutedEventArgs e) { var newDepartament = new Departament(chiefs.ElementAt(chiefComboBox.SelectedIndex), name.Text); if ((selected is Institution)) { ((Institution)selected).Children.Add(newDepartament); Org.ChiefsList.Remove(chiefs.ElementAt(chiefComboBox.SelectedIndex)); } else { MessageBox.Show("Департамент можно добавить только в ведомство"); } Close(); Main.Activate(); }