protected override void LoadWorkerDoWork(object sender, DoWorkEventArgs e) { Utils.EnsureCulture(); OnReloading = true; Dispatcher.Invoke(new Action(() => { aiLoader.Visibility = Visibility.Visible; tbNoResults.Visibility = Visibility.Collapsed; })); if (Convert.ToBoolean(e.Argument)) { Dispatcher.Invoke(new Action(() => { var propsSelectorWindow = new PropsSelectorWindow(true) { Owner = this }; Opacity = 0.5; propsSelectorWindow.ShowDialog(); Opacity = 1; _propID = propsSelectorWindow.GetPropID(); })); } e.Result = new List <object> { PropsService.Get(_propID), PropStatusChangesService.Instanse.GetLatest(_propID) }; }
public static string LabPropDetailer(LabProp labProp, ActionType actionType) { switch (actionType) { case ActionType.Created: return(string.Format("{0} به لیست اموال {1} اضافه شد.", PropsService.Get(labProp.PropID).Name, LabsService.Get(labProp.LabID).Name)); case ActionType.Modified: return(string.Format("اطلاعات اموال {0} بروز شد.", LabsService.Get(labProp.LabID).Name)); case ActionType.Removed: return(string.Format("{0} از لیست اموال {1} حذف شد.", PropsService.Get(labProp.PropID).Name, LabsService.Get(labProp.LabID).Name)); default: return(null); } }
protected override void OnStartup(StartupEventArgs e) { Current.DispatcherUnhandledException += OnDispatcherUnhandledException; base.OnStartup(e); if (!SingleInstance <App> .InitializeAsFirstInstance(PhoenixUniqueKey)) { Current.Shutdown(); return; } OriginResolution = new Rect { Width = SystemParameters.VirtualScreenWidth, Height = SystemParameters.VirtualScreenHeight }; if (Settings.Default.ResetPennding) { Settings.Default.Reset(); } if (Settings.Default.ModeIndex == -1) { Utils.UpdateScreenResolution(); } if (string.IsNullOrEmpty(Settings.Default.BackupPath)) { var executionPath = AppDomain.CurrentDomain.BaseDirectory; var backupPath = string.Format(@"{0}Backup", executionPath); Settings.Default.BackupPath = backupPath; Settings.Default.Save(); } if (!Directory.Exists(Settings.Default.BackupPath)) { Directory.CreateDirectory(Settings.Default.BackupPath, new DirectorySecurity(AppDomain.CurrentDomain.BaseDirectory, AccessControlSections.Owner)); } Utils.SetResolution(); Utils.EnsureCulture(); Utils.AddThemeBaseDictionaries(); try { DbContext.Init(); } catch (Exception ex) { Logger.Write(ex); MessageWindowHelpers.Show(null, SplashResources.DatabaseInitFailed, MessageBoxButton.OK, MessageBoxImage.Hand); Current.Shutdown(); return; } try { PropsService.Get(Guid.NewGuid()); } catch (Exception ex) { Logger.Write(ex); MessageWindowHelpers.Show(null, SplashResources.DatabaseTestFailed, MessageBoxButton.OK, MessageBoxImage.Hand); Current.Shutdown(); return; } try { var administratorRole = RolesService.Instanse.GetAdministrator(false); if (administratorRole == null) { RolesService.Instanse.CreateAdministrator(); } var systemUser = UsersService.Instanse.GetSystemUser(false); if (systemUser == null) { UsersService.Instanse.CreateSystemUser(); } } catch (Exception exception) { Logger.Write(exception); MessageWindowHelpers.Show(null, SplashResources.TestCheckIndeedRecordsFailed, MessageBoxButton.OK, MessageBoxImage.Hand); } }