Пример #1
0
 //Remove a Client from it's parrent Satellite
 public void RemoveClient(Core.Objects.Client Client, List <Objects.SatelliteConnection> SatelliteConnectionDetails)
 {
     Objects.ActiveConnection activeConnection = GetActiveConnections(SatelliteConnectionDetails).First(Connection => Connection.RequestSessionId == Client.SesstionID);
     //Look to makesure there isn't a Connection for that Client. If there is don't remove the client.
     if (activeConnection == null)
     {
         Client.SatelliteConnection.GetSatelliteManager().RemoveClient(Client.SesstionID);
     }
     else
     {
         //Only display message if not running with CLI arguments
         if (!RunningAsCLI)
         {
             MessageBox.Show("Unable to remove Client: " + Client.HostName + " as they have a Connection still processing: " + activeConnection.RequestSubroutine + " " + activeConnection.Subroutine);
         }
     }
 }
        //Handle click of remove in the Connections list view
        private void RemoveConnectionButton_MouseDown(object sender, MouseButtonEventArgs e)
        {
            //Makesure that the left button was proessed
            if (e.LeftButton == MouseButtonState.Pressed)
            {
                Core.Objects.ActiveConnection ActiveConnection = ((TextBlock)sender).DataContext as Core.Objects.ActiveConnection;

                //Makesure that we have a ActiveConnection object, and that the recored wasn't deleted.
                if (ActiveConnection == null)
                {
                    return;
                }

                //Question the user if this is what they wanted to do.
                MessageBoxResult messageBoxResult = MessageBox.Show("Are you sure you want to remove this connection " + ActiveConnection.RequestUserId + "?", "Remove Connetion?", MessageBoxButton.YesNo);
                if (messageBoxResult == MessageBoxResult.Yes)
                {
                    //Remove the Connection
                    DataLogic.RemoveConnection(ActiveConnection);
                }
            }
        }
Пример #3
0
        //Get the Active Connections for all Satellites
        public List <Objects.ActiveConnection> GetActiveConnections(List <Objects.SatelliteConnection> SatelliteConnectionDetails)
        {
            List <Objects.ActiveConnection> ActiveConnections = new List <Objects.ActiveConnection>();

            SatelliteConnectionDetails.ForEach(ConnectionDetails =>
            {
                try
                {
                    //Get the name of the Environment where the connetion is
                    string Environment = ConnectionDetails.GetSatelliteManager().Environment;

                    SatelliteConnection[] connList = ConnectionDetails.GetSatelliteManager().ConnectionList;

                    if (connList != null)
                    {
                        //Go over all the connections
                        foreach (SatelliteConnection conn2 in connList)
                        {
                            //If the connection has been marked as kill, continue
                            if (conn2.ConnectionState == SatelliteConnectionState.Kill)
                            {
                                continue;
                            }

                            //See if there was any subroutine aka function that the user was doing
                            string subroutine = string.Empty;
                            if (conn2.Request.Data.ContainsKey("subroutine"))
                            {
                                subroutine = conn2.Request.Data["subroutine"].ToString();
                            }

                            //Remap to my new object
                            Objects.ActiveConnection ActiveConnection = new Objects.ActiveConnection()
                            {
                                ConnectionId            = conn2.ConnectionId,
                                ConnectionLastMonitored = conn2.ConnectionLastMonitored,
                                ConnectionState         = conn2.ConnectionState.ToString(),
                                ConnectionUser          = conn2.ConnectionUser,
                                LastRequestStarted      = conn2.LastRequestStarted,
                                LastRequestSubroutine   = conn2.LastRequestSubroutine,
                                ProcessId           = conn2.ProcessId,
                                RequestSessionId    = conn2.RequestSessionId,
                                RequestStarted      = conn2.RequestStarted,
                                RequestSubroutine   = conn2.RequestSubroutine,
                                RequestUserId       = conn2.RequestUserId,
                                Subroutine          = subroutine,
                                Environment         = Environment,
                                SatelliteConnection = ConnectionDetails
                            };

                            ActiveConnections.Add(ActiveConnection);
                        }
                    }
                }
                catch (Exception e)
                {
                }
            });

            return(ActiveConnections);
        }