Esempio n. 1
0
        public override void ExecuteCommand(string userId, string command)
        {
            ServerWindowsPos wndData = deserialize.Deserialize <ServerWindowsPos>(command);

            if (wndData == null)
            {
                return;
            }

            List <WindowsModel> wndsModelList = new List <WindowsModel>();

            foreach (WndPos wndPos in wndData.WindowsAttributes)
            {
                WindowsModel model = new WindowsModel()
                {
                    WindowsId   = wndPos.id,
                    DisplayName = wndPos.name,
                    PosLeft     = wndPos.posX,
                    PosTop      = wndPos.posY,
                    Width       = wndPos.width,
                    Height      = wndPos.height,
                    Style       = wndPos.style,
                    ZOrder      = wndPos.ZOrder
                };

                wndsModelList.Add(model);
            }

            client.RefreshWndList(wndsModelList);
        }
Esempio n. 2
0
        void runningWndsMgr_EvtApplicationWndChanged(List <WindowsAppMgr.WndAttributes> wndAttributes)
        {
            if (Server.ConnectedClientHelper.GetInstance().GetClientsCount() == 0)
            {
                return;
            }

            List <WndPos> windowList    = new List <WndPos>();
            int           zOrderCounter = 0;

            foreach (Windows.WindowsAppMgr.WndAttributes attribute in wndAttributes)
            {
                WndPos wndPos = new WndPos
                {
                    id        = attribute.id,
                    name      = attribute.name,
                    posX      = attribute.posX,
                    posY      = attribute.posY,
                    width     = attribute.width,
                    height    = attribute.height,
                    style     = attribute.style,
                    ZOrder    = zOrderCounter,
                    ProcessId = attribute.processId,
                };

                windowList.Add(wndPos);

                zOrderCounter++;
            }

            try
            {
                ServerWindowsPos windowsPos = new ServerWindowsPos();
                windowsPos.WindowsAttributes = windowList;

                // send to whole group of users login using same login id
                connectionMgr.SendData((int)CommandConst.MainCommandServer.WindowsInfo,
                                       (int)CommandConst.SubCommandServer.WindowsList,
                                       windowsPos,
                                       ConnectedClientHelper.GetInstance().GetAllClientsSocketId());
            }
            catch (Exception e)
            {
                Trace.WriteLine(e);
            }

            /*
             * // filter application launched by different login id
             * Dictionary<int, List<String>> userMap = ConnectedClientHelper.GetInstance().GetConnectedUsersGroupByDB();
             * foreach(KeyValuePair<int, List<String>> userData in userMap)
             * {
             *  ServerWindowsPos windowsPos = new ServerWindowsPos();
             *  windowsPos.WindowsAttributes = new List<WndPos>();
             *
             *  // get the launched application by user based on user's db index
             *  Dictionary<int, int> launchedApp = LaunchedWndHelper.GetInstance().GetLaunchedApps(userData.Key);
             *  foreach (KeyValuePair<int, int> launchedData in launchedApp)
             *  {
             *      var eligibleAppWnd = windowList.FindAll(t => t.id == launchedData.Key);
             *      windowsPos.WindowsAttributes.AddRange(eligibleAppWnd);
             *  }
             *
             *  Dictionary<int, int> launchedSources = LaunchedSourcesHelper.GetInstance().GetLaunchedApps(userData.Key);
             *  foreach (KeyValuePair<int, int> launchedData in launchedSources)
             *  {
             *      var eligibleSourceWnd = windowList.FindAll(t => t.id == launchedData.Key);
             *      windowsPos.WindowsAttributes.AddRange(eligibleSourceWnd);
             *  }
             *
             *  Dictionary<int, int> launchedVnc = LaunchedVncHelper.GetInstance().GetLaunchedApps(userData.Key);
             *  foreach (KeyValuePair<int, int> launchedData in launchedVnc)
             *  {
             *      var eligibleVncWnd = windowList.FindAll(t => t.id == launchedData.Key);
             *      windowsPos.WindowsAttributes.AddRange(eligibleVncWnd);
             *  }
             *
             *  try
             *  {
             *      // send to whole group of users login using same login id
             *      connectionMgr.SendData((int)CommandConst.MainCommandServer.WindowsInfo,
             *          (int)CommandConst.SubCommandServer.WindowsList,
             *          windowsPos,
             *          userData.Value);
             *  }
             *  catch (Exception e)
             *  {
             *      Trace.WriteLine(e);
             *  }
             * }
             * */
        }