コード例 #1
0
        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));
            }
        }
コード例 #2
0
        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));
        }
コード例 #3
0
 public SaveComponentCommand(
     ComponentNewEditViewModel viewModel,
     IComponentRepositories repo,
     IUserNotify notify,
     ISecurityContext ctx)
 {
     this.viewModel = viewModel;
     this.repos     = repo;
     this.notify    = notify;
     this.ctx       = ctx;
 }
コード例 #4
0
 public NewSaveComponentCommand(
     ComponentNewEditViewModel viewModel,
     IComponentRepositories repo, 
     IUserNotify notify,
     ISecurityContext ctx)
 {
     this.viewModel = viewModel;
     this.repos = repo;
     this.notify = notify;
     this.ctx = ctx;
 }
コード例 #5
0
        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));
            }
        }