void OnSave() { var savePasswordViewModel = new LoadPasswordViewModel(); DialogService.ShowModalWindow(savePasswordViewModel); var password = savePasswordViewModel.Password; if (string.IsNullOrEmpty(password)) return; var configuration = new MulticlientConfiguration(); foreach (var appItem in AppItems) { var multiclientData = new MulticlientData() { Name = appItem.Name, Address = appItem.Address, Port = appItem.Port, Login = appItem.Login, Password = appItem.Password, IsNotUsed = appItem.IsNotUsed }; configuration.MulticlientDatas.Add(multiclientData); } MulticlientConfigurationHelper.SaveConfiguration(configuration, password); HasChanges = false; }
private void Application_Startup(object sender, StartupEventArgs e) { Bootstrapper.Run(); var shellView = new ShellView(); Application.Current.MainWindow = shellView; var shellViewModel = new ShellViewModel(); shellView.DataContext = shellViewModel; if (File.Exists(AppDataFolderHelper.GetMulticlientFile())) { var loadPasswordViewModel = new LoadPasswordViewModel(); DialogService.ShowModalWindow(loadPasswordViewModel); shellViewModel.Initialize(loadPasswordViewModel.MulticlientConfiguration); } else { shellViewModel.Initialize(new MulticlientConfiguration()); } shellView.Show(); }