public CloseDialogWIndowViewModel(DisconnectedDbProvider provider, Action onFinish) { this.provider = provider; this.onFinish = onFinish; SaveCommand = new RelayCommand(OnSave); DiscardCommand = new RelayCommand(OnDiscard); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); var connectionString = "Data Source=localhost;Initial Catalog=ClientsDB;Integrated Security=True"; ShutdownMode = ShutdownMode.OnLastWindowClose; provider = new DisconnectedDbProvider(connectionString); var mainViewModel = new MainWindowViewModel(provider); var mainWindow = new MainWindow { DataContext = mainViewModel }; mainWindow.Show(); mainWindow.Closing += OnClose; }