private void button_Click(object sender, RoutedEventArgs e) { Name = textBox.Text; Name = Name.Trim(); MainWindow mainWindow = new MainWindow(Name); var awayStorage = new ConnectionServer(); MyProfilePresenter myProfile = new MyProfilePresenter(awayStorage, this, mainWindow); myProfile.Initialize(); try { LoadProfile?.Invoke(this, EventArgs.Empty); } catch (Exception) { MessageBox.Show("Нет соединения с сервером, попробуйте позже"); mainWindow.Close(); Close(); return; } Hide(); mainWindow.Show(); Close(); }
private static void Load() { string fileName = Path.Combine(Options.AppDataPath, "Options_default.xml"); if (!File.Exists(fileName)) { return; } LoadProfile profile = new LoadProfile { TopMost = true }; profile.ShowDialog(); //loadProfile(FileName); }