private void UserControl_Loaded(object sender, RoutedEventArgs e) { Main_ViewModel mvm = DataContext as Main_ViewModel; if (mvm != null) { mvm.ExecuteOnLoad(); } }
protected override void OnClosing(System.ComponentModel.CancelEventArgs e) { base.OnClosing(e); Main_ViewModel mainViewModel = DataContext as Main_ViewModel; if (mainViewModel != null && mainViewModel.IsRestartRequested == true) { System.Windows.Forms.Application.Restart(); } }
public MainWindow() { InitializeComponent(); DB_ModelContainer db = new DB_ModelContainer(); db.Database.Migrate(); mainViewModel = new Main_ViewModel(); DataContext = mainViewModel; Workspace_ViewModel.SetFullScreen_Event += VmFullScreen_SetFullScreen_Event; }