Ejemplo n.º 1
0
        public SshHostViewModel(IEventAggregator eventAggregator, IServiceLocator serviceLocator, ISshSudoSession sshSudoSession)
        {
            this._serviceLocator  = serviceLocator;
            this._eventAggregator = eventAggregator;
            this._sudoSession     = sshSudoSession;
            this.registerEvents();

            this._eventAggregator = eventAggregator;
            this._eventAggregator.GetEvent <MasterNotificationMessageEvent>().Subscribe(OnMasterNotificationMessage);
            this._eventAggregator.GetEvent <CpuTempMonitorMessageEvent>().Subscribe(onReceiveCpuTemperatureMonitorMessage);
            this._cpu1LoadEntries   = new ObservableCollection <HeatingChartData>();
            this._cpu2LoadEntries   = new ObservableCollection <HeatingChartData>();
            this._cpu3LoadEntries   = new ObservableCollection <HeatingChartData>();
            this._cpu4LoadEntries   = new ObservableCollection <HeatingChartData>();
            this._temperatureData   = new ObservableCollection <HeatingChartData>();
            this._cpuClockFrequency = new ObservableCollection <HeatingChartData>();

            // Todo: implement reporting
            this._statistics = new List <CpuTempMonitorMessage>();

            // Commands
            ConfigureCommand = new DelegateCommand(onConfigureClicked);
            ConnectCommand   = new DelegateCommand(OnConnectCommandClicked);
            BenchmarkCommand = new DelegateCommand(OnBenchmarkClicked);

            // InteractionRequests
            GetServerConnectionRequest = new InteractionRequest <ServerConnectionNotification>();
        }
Ejemplo n.º 2
0
 private void OnDisconnectNotificationMessage(MasterNotification message)
 {
     if (message != null)
     {
         if (this._sudoSession != null)
         {
             this._sudoSession.StopSession();
             this._sudoSession.Dispose();
             this._sudoSession = null;
         }
     }
 }
Ejemplo n.º 3
0
 private void OnConnectNotificationMessage(MasterNotification message)
 {
     if (message != null)
     {
         if (_sudoSession == null)
         {
             _sudoSession = this._serviceLocator.TryResolve <ISshSudoSession>();
         }
         if (this._sudoSession != null)
         {
             var connectiondata = new ConnectionData()
             {
                 Hostname = this._hostname, UserName = this._userName, Password = this._password, PortNumber = this._port
             };
             this._sudoSession.RunSession(connectiondata, "sudo coretempmon -d 2000");
         }
     }
 }
Ejemplo n.º 4
0
        private bool disposedValue = false; // To detect redundant calls


        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    // TODO: dispose managed state (managed objects).
                    if (this._sudoSession != null)
                    {
                        this._sudoSession.StopSession();
                        this._sudoSession.Dispose();
                        this._sudoSession = null;
                    }
                }

                // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below.
                // TODO: set large fields to null.

                disposedValue = true;
            }
        }