public ComponentNewEditViewModel( IComponentRepositories repos, Guid id, IUserNotify notify, ISecurityContext context) { this.repos = repos; this.notify = notify; this.context = context; try { this.componentTypes = new BindingList <ComponentType>(repos.ComponentTypeRepo.GetAll()); this.Inspectors = repos.RepoInspector.GetAll(); } catch (RepositoryException ex) { log.Warn("ComponentNewEditViewModel " + ex.ToString()); notify.ShowWarning(Program.LanguageManager.GetString(StringResources.Notification_Error_Db_Message), Program.LanguageManager.GetString(StringResources.Notification_Error_Db_Header)); } saveCommand = ViewModelSource .Create(() => new SaveComponentCommand(this, repos, notify, context)); newSaveCommand = ViewModelSource .Create(() => new NewSaveComponentCommand(this, repos, notify, context)); deactivationCommand = ViewModelSource .Create(() => new ComponentDeactivationCommand(this, repos, notify, context)); if (id == Guid.Empty) { NewComponent(); } else { try { this.Component = repos.ComponentRepo.Get(id); } catch (RepositoryException ex) { log.Warn("ComponentNewEditViewModel " + ex.ToString()); notify.ShowWarning(Program.LanguageManager.GetString(StringResources.Notification_Error_Db_Message), Program.LanguageManager.GetString(StringResources.Notification_Error_Db_Header)); } } if (this.Inspectors == null || this.Inspectors.Count <= 0) { log.Warn(string.Format("Componentry (id:{0}) creation: List of Inspectors is NULL or empty", id)); } }
public ComponentNewEditViewModel( IComponentRepositories repos, Guid id, IUserNotify notify, ISecurityContext context) { this.repos = repos; this.notify = notify; this.context = context; try { this.componentTypes = new BindingList<ComponentType>(repos.ComponentTypeRepo.GetAll()); this.Inspectors = repos.RepoInspector.GetAll(); } catch(RepositoryException ex) { log.Warn("ComponentNewEditViewModel " + ex.ToString()); notify.ShowWarning(Program.LanguageManager.GetString(StringResources.Notification_Error_Db_Message), Program.LanguageManager.GetString(StringResources.Notification_Error_Db_Header)); } saveCommand = ViewModelSource .Create(() => new SaveComponentCommand(this, repos, notify, context)); newSaveCommand = ViewModelSource .Create(() => new NewSaveComponentCommand(this, repos, notify, context)); deactivationCommand = ViewModelSource .Create(() => new ComponentDeactivationCommand(this, repos, notify, context)); if (id == Guid.Empty) { NewComponent(); } else { try { this.Component = repos.ComponentRepo.Get(id); } catch(RepositoryException ex) { log.Warn("ComponentNewEditViewModel " + ex.ToString()); notify.ShowWarning(Program.LanguageManager.GetString(StringResources.Notification_Error_Db_Message), Program.LanguageManager.GetString(StringResources.Notification_Error_Db_Header)); } } if(this.Inspectors == null || this.Inspectors.Count <=0) log.Warn(string.Format("Componentry (id:{0}) creation: List of Inspectors is NULL or empty", id)); }
public ComponentNewEditViewModel( IComponentRepositories repos, Guid id, IUserNotify notify, ISecurityContext context) { this.repos = repos; this.notify = notify; this.context = context; this.componentTypes = new BindingList <ComponentType>(repos.ComponentTypeRepo.GetAll()); this.Inspectors = repos.RepoInspector.GetAll(); saveCommand = ViewModelSource .Create(() => new SaveComponentCommand(this, repos, notify, context)); newSaveCommand = ViewModelSource .Create(() => new NewSaveComponentCommand(this, repos, notify, context)); deactivationCommand = ViewModelSource .Create(() => new ComponentDeactivationCommand(this, repos, notify, context)); if (id == Guid.Empty) { NewComponent(); } else { this.Component = repos.ComponentRepo.Get(id); } if (this.Inspectors == null || this.Inspectors.Count <= 0) { log.Warn(string.Format("Componentry (id:{0}) creation: List of Inspectors is NULL or empty", id)); } }