public static bool ChangeNotifiable(Notification notification) { try { if (notification.NotifyType == NotifyType.Prop) { return(PropsService.ChangeNotifiable(((Prop)notification.OriginalObject).PropID, false)); } if (notification.NotifyType == NotifyType.Item) { return(ItemsService.ChangeNotifiable(((Item)notification.OriginalObject), false)); } if (notification.NotifyType == NotifyType.Material) { return(MaterialsService.ChangeNotifiable(((Material)notification.OriginalObject).MaterialID, false)); } return(false); } catch (Exception exception) { Logger.Write(exception); return(false); } }
protected override void SaveWorkerRunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if (Global.ShowQuestion(this)) { var count = PropsService.CountOfNotNotifiable() + MaterialsService.CountOfNotNotifiable(); var progressWindow = new ProgressWindow(count); progressWindow.Show(this); foreach (var propID in PropsService.GetAllNotNotifiables()) { PropsService.ChangeNotifiable(propID, true); progressWindow.IncreaseProgress(); } foreach (var materialID in MaterialsService.GetAllNotNotifiables()) { MaterialsService.ChangeNotifiable(materialID, true); progressWindow.IncreaseProgress(); } progressWindow.Close(); Global.ShowSuceeded(this); TryToLoad(); } aiLoader.Visibility = Visibility.Collapsed; OnSaving = false; }