private void ChangeUser() { Login newLogin = new Login(); newLogin.DataContext = new LoginViewModel(true); newLogin.ShowDialog(); NotifyAllPropertiesChanged(); }
protected override void OnStartup(StartupEventArgs e) { EventManager.RegisterClassHandler(typeof(TextBox), TextBox.GotFocusEvent, new RoutedEventHandler(TextBox_GotFocus)); EventManager.RegisterClassHandler(typeof(TextBox), TextBox.GotMouseCaptureEvent, new RoutedEventHandler(TextBox_GotMouseCapture)); base.OnStartup(e); try { AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); App.Current.ShutdownMode = System.Windows.ShutdownMode.OnExplicitShutdown; if (Keyboard.Modifiers == ModifierKeys.Shift) { new SettingsWindow().ShowDialog(); } string connectionString = string.Format(@"DataSource={0};Database=d:\ProfStor\SKLAD.GDB;User=SYSDBA;Password=masterkey;Dialect=3;Charset=win1251", Utils.Config.AppSettings.Settings["Server"].Value); if(!ApplicationDeployment.IsNetworkDeployed) connectionString = string.Format(@"DataBase=c:\Users\user\Documents\Visual Studio 2010\Projects\BoginyaJournal\bin\Debug\SKLAD.GDB;User=SYSDBA;Password=masterkey;Dialect=3;Charset=win1251"); BLToolkit.Data.DbManager.AddConnectionString("Fdp", "Sklad", connectionString); BLToolkit.Data.DbManager.AddDataProvider(new BLToolkit.Data.DataProvider.FdpDataProvider()); //checkin connection using (DbManager db = new DbManager()) { db.SetCommand("select * from users"); db.ExecuteNonQuery(); } DbMigration.DBMigration.Migrate(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error",MessageBoxButton.OK,MessageBoxImage.Error); System.Diagnostics.Process.GetCurrentProcess().Kill(); } //sending mail new Thread(new ThreadStart(()=> { for (var i = 0; i < 3; i++) { try { //Utils.SendMail(Utils.GetNISTDate(true).AddDays(-1)); break; } catch{ Thread.Sleep(10000); } } } )).Start(); Login login = new Login(); login.ShowDialog(); if (login.DialogResult == null || login.DialogResult == false) { Application.Current.Shutdown(); } }