/// <summary> /// Updates the ViewModel structure, causing the View to reload all bound properties. /// </summary> public void UpdateController() { ControllerVM.ReloadController(); RaisePropertyChanged(""); }
/// <summary> /// Updates the ViewModel structure, causing the View to reload all bound properties. /// </summary> public void UpdateController() { ControllerVM.ReloadController(); OnPropertyChanged(null); }
private void ImportControllerCommand_Executed(object obj) { if (obj == null) { throw new NullReferenceException(); } if (!(obj is ITLCGenImporter imp)) { throw new InvalidCastException(); } // Import into existing controller if (TLCGenControllerDataProvider.Default.CheckChanged()) { return; } if (imp.ImportsIntoExisting) { // Request to process all synchronisation data from matrix to model Messenger.Default.Send(new ProcessSynchronisationsRequest()); // Check data integrity var s1 = TLCGenIntegrityChecker.IsConflictMatrixOK(ControllerVM.Controller); if (s1 != null) { TLCGenDialogProvider.Default.ShowMessageBox("Kan niet importeren:\n\n" + s1, "Error bij importeren: fout in regeling"); return; } // Import to clone of original (so we can discard if wrong) var c1 = DeepCloner.DeepClone(ControllerVM.Controller); var c2 = imp.ImportController(c1); // Do nothing if the importer returned nothing if (c2 == null) { TLCGenDialogProvider.Default.ShowMessageBox("Importeren is afgebroken door de gebruiker", "Importeren afgebroken"); return; } // Check data integrity c2.Data.GarantieOntruimingsTijden = false; s1 = TLCGenIntegrityChecker.IsConflictMatrixOK(c2); if (s1 != null) { TLCGenDialogProvider.Default.ShowMessageBox("Fout bij importeren:\n\n" + s1, "Error bij importeren: fout in data"); return; } if (c1.Data.GarantieOntruimingsTijden) { TLCGenDialogProvider.Default.ShowMessageBox("De bestaande regeling had garantie ontruimingstijden.\nDeze zijn nu uitgeschakeld.", "Garantie ontruimingstijden uitrgeschakeld"); } SetController(c2); ControllerVM.ReloadController(); GuiActionsManager.SetStatusBarMessage( DateTime.Now.ToLongTimeString() + " - Data in regeling " + TLCGenControllerDataProvider.Default.Controller.Data.Naam + " geïmporteerd"); } // Import as new controller else { var c1 = imp.ImportController(); // Do nothing if the importer returned nothing if (c1 == null) { return; } // Check data integrity var s1 = TLCGenIntegrityChecker.IsConflictMatrixOK(c1); if (s1 != null) { TLCGenDialogProvider.Default.ShowMessageBox("Fout bij importeren:\n\n" + s1, "Error bij importeren: fout in data"); return; } TLCGenControllerDataProvider.Default.CloseController(); DefaultsProvider.Default.SetDefaultsOnModel(c1.Data); DefaultsProvider.Default.SetDefaultsOnModel(c1.OVData); SetController(c1); ControllerVM.ReloadController(); GuiActionsManager.SetStatusBarMessage( DateTime.Now.ToLongTimeString() + " - Regeling geïmporteerd"); } Messenger.Default.Send(new UpdateTabsEnabledMessage()); RaisePropertyChanged("HasController"); }
private void ImportControllerCommand_Executed(object obj) { if (obj == null) { throw new NotImplementedException(); } ITLCGenImporter imp = obj as ITLCGenImporter; if (imp == null) { throw new NotImplementedException(); } // Import into existing controller if (!ControllerHasChanged()) { if (imp.ImportsIntoExisting) { // Check data integrity string s1 = IntegrityChecker.IsControllerDataOK(ControllerVM.Controller); if (s1 != null) { System.Windows.MessageBox.Show("Kan niet importeren:\n\n" + s1, "Error bij importeren: fout in regeling"); return; } // Import to clone of original (so we can discard if wrong) ControllerModel c1 = DeepCloner.DeepClone(ControllerVM.Controller); ControllerModel c2 = imp.ImportController(c1); // Do nothing if the importer returned nothing if (c2 == null) { return; } // Check data integrity s1 = IntegrityChecker.IsControllerDataOK(c2); if (s1 != null) { System.Windows.MessageBox.Show("Fout bij importeren:\n\n" + s1, "Error bij importeren: fout in data"); return; } if (ControllerVM != null) { ControllerVM.HasChanged = false; // Set forcefully, in case the user decided to ignore changes above } SetController(c2); ControllerVM.ReloadController(); ControllerVM.HasChanged = true; } // Import as new controller else { ControllerModel c1 = imp.ImportController(); // Do nothing if the importer returned nothing if (c1 == null) { return; } // Check data integrity string s1 = IntegrityChecker.IsControllerDataOK(c1); if (s1 != null) { System.Windows.MessageBox.Show("Fout bij importeren:\n\n" + s1, "Error bij importeren: fout in data"); return; } if (ControllerVM != null) { ControllerVM.HasChanged = false; // Set forcefully, in case the user decided to ignore changes above } SetNewController(c1); ControllerVM.ReloadController(); ControllerVM.HasChanged = true; } } }