public void AddPreset(string name, Dictionary <ControlAttributes, Client.Model.ApplicationModel> appDic, Dictionary <ControlAttributes, Client.Model.VncModel> vncDic, Dictionary <ControlAttributes, InputAttributes> visionDic) { PresetDataEntry dataEntry = new PresetDataEntry(); dataEntry.Name = name; dataEntry.PresetAppList = new List <ApplicationEntry>(); dataEntry.PresetAppPos = new List <WndPos>(); dataEntry.PresetVisionInputList = new List <InputAttributes>(); dataEntry.PresetVisionInputPos = new List <WndPos>(); dataEntry.PresetVncList = new List <VncEntry>(); dataEntry.PresetVncPos = new List <WndPos>(); foreach (KeyValuePair <ControlAttributes, Client.Model.ApplicationModel> pair in appDic) { ApplicationEntry appEntry = new ApplicationEntry() { Identifier = pair.Value.AppliationId, Name = pair.Value.ApplicationName, }; WndPos wndPos = new WndPos() { posX = pair.Key.Xpos, posY = pair.Key.Ypos, width = pair.Key.Width, height = pair.Key.Height, style = pair.Key.Style, }; dataEntry.PresetAppList.Add(appEntry); dataEntry.PresetAppPos.Add(wndPos); } foreach (KeyValuePair <ControlAttributes, Client.Model.VncModel> pair in vncDic) { VncEntry vncEntry = new VncEntry() { Identifier = pair.Value.Identifier, DisplayName = pair.Value.DisplayName, IpAddress = pair.Value.VncServerIp, Port = pair.Value.VncServerPort, }; WndPos wndPos = new WndPos() { posX = pair.Key.Xpos, posY = pair.Key.Ypos, width = pair.Key.Width, height = pair.Key.Height, style = pair.Key.Style, }; dataEntry.PresetVncList.Add(vncEntry); dataEntry.PresetVncPos.Add(wndPos); } foreach (KeyValuePair <ControlAttributes, InputAttributes> pair in visionDic) { WndPos wndPos = new WndPos() { posX = pair.Key.Xpos, posY = pair.Key.Ypos, width = pair.Key.Width, height = pair.Key.Height, style = pair.Key.Style, }; dataEntry.PresetVisionInputList.Add(pair.Value); dataEntry.PresetVisionInputPos.Add(wndPos); } ClientPresetsCmd presetCmd = new ClientPresetsCmd() { ControlType = ClientPresetsCmd.EControlType.Add, PresetDataEntry = dataEntry, }; connectionMgr.BroadcastMessage( (int)CommandConst.MainCommandClient.Functionality, (int)CommandConst.SubCommandClient.Preset, presetCmd); }
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); * } * } * */ }