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; } } }
private void OnDisconnectNotificationMessage(MasterNotification message) { if (message != null) { if (this._sudoSession != null) { this._sudoSession.StopSession(); this._sudoSession.Dispose(); this._sudoSession = null; } } }
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", () => { }); //} } }
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 }); }
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"); } } }
private void OnTestFunNotificationMessage(MasterNotification message) { Console.WriteLine("Just a test function."); this._temperature = 70.1; }