// Wird vom Command Binding aufgerufen. parameter enthält das mit "CommandParameter" übergebene Objekt public void Execute(object parameter) { RemoteSession TypedParameter = parameter as RemoteSession; logoffReturn results = functions.LogoffRDPSession(TypedParameter.ServerName, TypedParameter.SessionID); if (results.ExitCode != 0) { LogoffError ErrorWindow = new LogoffError(results); // Make sure the ErrorWindow pops up on the same monitor, // without this it's always the primary (I think) ErrorWindow.Top = Application.Current.MainWindow.Top + 20; ErrorWindow.Left = Application.Current.MainWindow.Left + 20; ErrorWindow.Show(); } }
private void btn_findSessions_Click(object sender, RoutedEventArgs e) { WindowBindings.Sessions.Clear(); var Sessions = functions.GetSessions(GUIStateManager.GUIStateInstance.connectionBroker, GUIStateManager.GUIStateInstance.searchUserDomain, GUIStateManager.GUIStateInstance.searchUserName); if (Sessions != null && Sessions.Any()) { GUIStateManager.GUIStateInstance.bNoSessions = false; foreach (var Session in Sessions) { RemoteSession obj = new RemoteSession(Session.CimInstanceProperties["ServerName"].Value.ToString(), Session.CimInstanceProperties["SessionID"].Value.ToString()); WindowBindings.Sessions.Add(obj); } } else { GUIStateManager.GUIStateInstance.bNoSessions = true; } }