Example #1
0
        public void AddOrUpdateComputer(ClientConnection connection)
        {
            var onlineComputer = ComputerList.FirstOrDefault(x => !string.IsNullOrWhiteSpace(x.MACAddress) && x.MACAddress == connection.MACAddress);

            if (onlineComputer != null)
            {
                onlineComputer.IsOnline = true;
            }
            else
            {
                onlineComputer = new HubComputer()
                {
                    IsOnline = true
                };
                MainWindow.Current.Dispatcher.Invoke(() =>
                {
                    ComputerList.Add(onlineComputer);
                });
            }
            onlineComputer.ID             = connection.ID;
            onlineComputer.SessionID      = connection.SessionID;
            onlineComputer.ConnectionType = connection.ConnectionType;
            onlineComputer.IsOnline       = true;
            onlineComputer.CurrentUser    = connection.CurrentUser;
            onlineComputer.ComputerName   = connection.ComputerName;
            onlineComputer.LastOnline     = DateTime.Now;
            onlineComputer.LastReboot     = connection.LastReboot;
            onlineComputer.MACAddress     = connection.MACAddress;
        }