Example #1
0
        private void OnMasterNotificationMessage(MasterNotification message)
        {
            if (message != null)
            {
                switch (message.NotificationType)
                {
                case NotificationType.Connect:
                    OnConnectNotificationMessage(message);
                    break;

                case NotificationType.Disconnect:
                    OnDisconnectNotificationMessage(message);
                    break;

                case NotificationType.Shutdown:
                    OnShutdownNotificationMessage(message);
                    break;

                case NotificationType.ClearData:
                    OnClearDataNotificationMessage();
                    break;

                case NotificationType.Testfunc:
                    OnTestFunNotificationMessage(message);
                    break;

                default:
                    break;
                }
            }
        }
Example #2
0
 private void OnDisconnectNotificationMessage(MasterNotification message)
 {
     if (message != null)
     {
         if (this._sudoSession != null)
         {
             this._sudoSession.StopSession();
             this._sudoSession.Dispose();
             this._sudoSession = null;
         }
     }
 }
Example #3
0
 private void OnShutdownNotificationMessage(MasterNotification message)
 {
     if (message != null)
     {
         // mit await runsession async implementieren:
         //using(ISshSudoSession session = this._serviceLocator.GetInstance<ISshSudoSession>())
         //{
         //    var connectiondata = new ConnectionData() { Hostname = this._hostname, UserName = this._userName, Password = this._password, PortNumber = this._port };
         //    session.RunSession(connectiondata, "sudo shutdown now", () => { });
         //}
     }
 }
Example #4
0
        public static IList <MasterNotification> GetMasterNotificationList(IList <Notification> recentNotifications, IList <Notification> olderNotifications)
        {
            MasterNotification today = new MasterNotification("Today", "");

            today.AddRange(recentNotifications);
            MasterNotification earlier = new MasterNotification("Earlier", "");

            earlier.AddRange(olderNotifications);
            return(new ObservableCollection <MasterNotification> {
                today,
                earlier
            });
        }
Example #5
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");
         }
     }
 }
Example #6
0
 private void OnTestFunNotificationMessage(MasterNotification message)
 {
     Console.WriteLine("Just a test function.");
     this._temperature = 70.1;
 }