コード例 #1
0
        public AgentViewModel(IAgentDataService agentDataService)
        {
            try
            {
                this._agentDataService = agentDataService;
                if (IsInDesignMode)
                {
                    Title = "Hello MVVM Light (Design Mode)";
                }
                else
                {
                    Title = "Hello MVVM Light";
                    LoadMasterData();
                }

                SaveAgentCommand = new RelayCommand(SaveAgent, CanSaveAgent, true);
            }
            catch (Exception ex)
            {
                while (ex.InnerException != null)
                {
                    ex = ex.InnerException;
                }
                Messenger.Default.Send <NotificationMessage>(new NotificationMessage(ex.Message));
            }
        }
コード例 #2
0
        public AgentSummaryRegionController(IUnityContainer container,
                                            IRegionManager regionManager,
                                            IEventAggregator eventAggregator,
                                            IAgentDataService dataService)
        {
            if (container == null)
            {
                throw new ArgumentNullException("container");
            }
            if (regionManager == null)
            {
                throw new ArgumentNullException("regionManager");
            }
            if (eventAggregator == null)
            {
                throw new ArgumentNullException("eventAggregator");
            }
            if (dataService == null)
            {
                throw new ArgumentNullException("dataService");
            }

            _container       = container;
            _regionManager   = regionManager;
            _eventAggregator = eventAggregator;
            _dataService     = dataService;

            // Subscribe to the EmployeeSelectedEvent event.
            // This event is fired whenever the user selects an
            // employee in the EmployeeListView.
            _eventAggregator.GetEvent <AgentSelectedEvent>().Subscribe(OnAgentSelected, true);
        }
コード例 #3
0
        public AgentHistoryModule(IAgentDataService agentDataService)
        {
            this._agentDataService    = agentDataService;
            Post["/api/agentHistory"] = _ =>
            {
                var x = this.Request.Body.AsString();
                var agentExecution = JsonConvert.DeserializeObject <AgentExecution>(x);

                if (agentExecution == null)
                {
                    return(HttpStatusCode.BadRequest);
                }
                agentExecution.ExecutionTime = DateTime.UtcNow;
                _agentDataService.GetInsertedData(agentExecution);
                return(HttpStatusCode.OK);
            };

            Get["/api/agentHistory"] = p =>
            {
                var x = _agentDataService.GetExecutedListAgentDetails();
                return(Negotiate
                       .WithContentType("aplication/json")
                       .WithModel(x));
            };
        }
コード例 #4
0
ファイル: AgentsListViewModel.cs プロジェクト: alipov/open-rm
        //IDispatcher _dispatcher;

        public AgentsListViewModel(IAgentDataService dataService, IEventAggregator eventAggregator)//, IDispatcher dispatcher)
        {
            _eventAggregator = eventAggregator;
            _dataService     = dataService;
            AgentsCollection = new ObservableCollection <AgentWrapper>();
            //_dispatcher = dispatcher;

            _eventAggregator.GetEvent <AgentsListUpdated>().Subscribe(OnAgentsListUpdated, true);
        }
コード例 #5
0
        public AgentHistoryModule(IAgentDataService agentDataService)
        {
            Post["/api/agentHistory"] = p =>
            {
                AgentExecution agentExecution = this.Bind <AgentExecution>();
                if (agentExecution == null)
                {
                    return(HttpStatusCode.BadRequest);
                }

                agentDataService.GetInsertedData(agentExecution);
                return(HttpStatusCode.OK);
            };

            Get["/api/agentHistory"] = p =>
            {
                var x = agentDataService.GetExecutedListAgentDetails();
                return(Negotiate
                       .WithContentType("aplication/json")
                       .WithModel(x));
            };
        }
コード例 #6
0
        public AgentsRibbonTabViewModel(IUnityContainer container, IAgentDataService dataService)
        {
            AppDomain currentDomain = AppDomain.CurrentDomain;

            currentDomain.UnhandledException += ExceptionHandler;

            _container   = container;
            _dataService = dataService;

            ConnectCommand           = new DelegateCommand(ConnectToServer);
            IsConnectEnabled         = true;
            RefreshAgentsCommand     = new DelegateCommand(RefreshAgentsList);
            InstalledProgramsCommand = new DelegateCommand(ListInstalledPrograms);
            LockSessionCommand       = new DelegateCommand(LockSession);
            RestartCommand           = new DelegateCommand(Restart);
            ShutDownCommand          = new DelegateCommand(ShutDown);
            CommonCommand            = new DelegateCommand(CommonExecute);
            SelectedComboBoxValue    = "Ping";
            CommonCommandParameter   = "gmail.com";
            RemoteControlCommand     = new DelegateCommand(RemoteControl);
            WakeOnLanCommand         = new DelegateCommand(WakeOnLan);
            RunProcessCommand        = new DelegateCommand(RunProcess);
        }
コード例 #7
0
 public AgentController(IAgentDataService agentDataService)
 {
     _agentDataService = agentDataService;
 }