public override void ExecuteCommand(string userId, string command)
        {
            ServerViewingAreaStatus viewingData = deserialize.Deserialize <ServerViewingAreaStatus>(command);

            if (viewingData == null)
            {
                return;
            }

            WindowsModel viewingArea = new WindowsModel()
            {
                PosLeft = viewingData.ViewingArea.LeftPos,
                PosTop  = viewingData.ViewingArea.TopPos,
                Width   = viewingData.ViewingArea.RightPos - viewingData.ViewingArea.LeftPos,
                Height  = viewingData.ViewingArea.BottomPos - viewingData.ViewingArea.TopPos
            };

            // save to settings
            ServerSettings.GetInstance().ViewingAreaLeft   = viewingArea.PosLeft;
            ServerSettings.GetInstance().ViewingAreaTop    = viewingArea.PosTop;
            ServerSettings.GetInstance().ViewingAreaWidth  = viewingArea.Width;
            ServerSettings.GetInstance().ViewingAreaHeight = viewingArea.Height;

            client.RefreshViewingArea(viewingArea);
        }
Esempio n. 2
0
        private void onGroupEdited(int groupId)
        {
            GroupData latestData = Server.ServerDbHelper.GetInstance().GetAllGroups().First(groupData => groupData.id == groupId);

            ServerViewingAreaStatus viewingArea = new ServerViewingAreaStatus();
            MonitorInfo             monitorInfo = null;

            if (latestData.share_full_desktop)
            {
                monitorInfo = getDesktopMonitorInfo();
            }
            else
            {
                monitorInfo = getUserMonitorInfo(groupId);
            }

            viewingArea.ViewingArea = monitorInfo;


            ServerMaintenanceStatus maintenanceCmd = new ServerMaintenanceStatus();

            maintenanceCmd.AllowMaintenance   = latestData.allow_maintenance;
            maintenanceCmd.AllowRemoteControl = latestData.allow_remote;

            ServerApplicationStatus appCmd          = new ServerApplicationStatus();
            List <ApplicationEntry> applicationList = new List <ApplicationEntry>();

            foreach (ApplicationData appData in Server.ServerDbHelper.GetInstance().GetAppsWithGroupId(groupId))
            {
                applicationList.Add(new ApplicationEntry()
                {
                    Identifier = appData.id,
                    Name       = appData.name
                });
            }
            appCmd.UserApplicationList = applicationList;

            // send update to all users
            List <string> usersList = getSocketIdentifierFromGroupId(groupId);

            connectionManager.SendData(
                (int)CommandConst.MainCommandServer.UserPriviledge,
                (int)CommandConst.SubCommandServer.ViewingArea,
                viewingArea,
                usersList);

            connectionManager.SendData(
                (int)CommandConst.MainCommandServer.UserPriviledge,
                (int)CommandConst.SubCommandServer.Maintenance,
                maintenanceCmd,
                usersList);

            connectionManager.SendData(
                (int)CommandConst.MainCommandServer.UserPriviledge,
                (int)CommandConst.SubCommandServer.ApplicationList,
                appCmd,
                usersList);
        }
Esempio n. 3
0
        private void onMonitorEdited(int monitorId)
        {
            MonitorData monitorData = ServerDbHelper.GetInstance().GetMonitorsList().First(data => data.MonitorId == monitorId);

            List <string>           usersList      = getUsersSocketIdFromMonitorId(monitorId);
            ServerViewingAreaStatus viewingAreaCmd = new ServerViewingAreaStatus()
            {
                ViewingArea = new Session.Data.SubData.MonitorInfo()
                {
                    LeftPos   = monitorData.Left,
                    TopPos    = monitorData.Top,
                    RightPos  = monitorData.Right,
                    BottomPos = monitorData.Bottom
                },
            };

            connectionManager.SendData((int)CommandConst.MainCommandServer.UserPriviledge,
                                       (int)CommandConst.SubCommandServer.ViewingArea,
                                       viewingAreaCmd,
                                       usersList);
        }