Exemple #1
0
        private void buttonVisionAdd_Click(object sender, EventArgs e)
        {
            FormVision visionFrm = new FormVision();

            visionFrm.Text = "Add Capture Card Entry";
            WindowsFormClient.RgbInput.Window          window = new RgbInput.Window();
            WindowsFormClient.RgbInput.Input           input  = new RgbInput.Input();
            WindowsFormClient.RgbInput.OnScreenDisplay osd    = new RgbInput.OnScreenDisplay();

            // set the empty object to the form
            visionFrm.WindowObj          = window;
            visionFrm.InputObj           = input;
            visionFrm.OnScreenDisplayObj = osd;
            visionFrm.NumberOfInputs     = ServerDbHelper.GetInstance().GetSystemInputCount();

            if (visionFrm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                // add to db
                visionInputPresenter.AddVisionInput(visionFrm.WindowObj, visionFrm.InputObj, visionFrm.OnScreenDisplayObj);
            }
        }
Exemple #2
0
        private void buttonVisionEdit_Click(object sender, EventArgs e)
        {
            Dictionary <uint, FormVision> updatedList = new Dictionary <uint, FormVision>();

            foreach (DataGridViewRow row in dataGridVisionInput.Rows)
            {
                if (row.Cells[0].Value != null &&
                    (bool)row.Cells[0].Value)
                {
                    // show the form user
                    uint   visionDataId = (uint)row.Cells[1].Value;
                    string visionWnd    = (string)row.Cells[2].Value;
                    string visionInput  = (string)row.Cells[3].Value;
                    string visionOSD    = (string)row.Cells[4].Value;

                    FormVision formVision = new FormVision();
                    formVision.WindowObj          = visionInputPresenter.GetWindowFromString(visionWnd);
                    formVision.InputObj           = visionInputPresenter.GetInputFromString(visionInput);
                    formVision.OnScreenDisplayObj = visionInputPresenter.GetOSDFromString(visionOSD);
                    formVision.NumberOfInputs     = ServerDbHelper.GetInstance().GetSystemInputCount();

                    if (formVision.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
                    {
                        updatedList.Add(visionDataId, formVision);
                    }
                }
            }

            foreach (KeyValuePair <uint, FormVision> data in updatedList)
            {
                visionInputPresenter.EditVisionInput(
                    data.Key,
                    data.Value.WindowObj,
                    data.Value.InputObj,
                    data.Value.OnScreenDisplayObj);
            }
        }
Exemple #3
0
        private void sendLoginReply(Server.Model.ClientInfoModel model, int dekstopRow, int desktopCol)
        {
            // get server's monitor info
            List <Session.Data.SubData.MonitorInfo> monitorList = new List <MonitorInfo>();
            int desktopLeft   = 0;
            int desktopTop    = 0;
            int desktopRight  = 0;
            int desktopBottom = 0;

            foreach (WindowsHelper.MonitorInfo monitor in Utils.Windows.WindowsHelper.GetMonitorList())
            {
                if (desktopLeft > monitor.WorkArea.Left)
                {
                    desktopLeft = monitor.MonitorArea.Left;
                }

                if (desktopTop > monitor.WorkArea.Top)
                {
                    desktopTop = monitor.MonitorArea.Top;
                }

                if (desktopRight < monitor.WorkArea.Right)
                {
                    desktopRight = monitor.MonitorArea.Right;
                }

                if (desktopBottom < monitor.WorkArea.Bottom)
                {
                    desktopBottom = monitor.MonitorArea.Bottom;
                }

                monitorList.Add(new Session.Data.SubData.MonitorInfo()
                {
                    LeftPos   = monitor.MonitorArea.Left,
                    TopPos    = monitor.MonitorArea.Top,
                    RightPos  = monitor.MonitorArea.Right,
                    BottomPos = monitor.MonitorArea.Bottom
                });
            }

            // send user data to client
            UserSettingData settingData = Server.ServerDbHelper.GetInstance().GetUserSetting(model.DbUserId);

            Session.Data.ServerUserSetting userSetting = new ServerUserSetting()
            {
                UserSetting = new UserSetting()
                {
                    gridX  = settingData.gridX,
                    gridY  = settingData.gridY,
                    isSnap = settingData.isSnap,
                }
            };

            // get user's application list
            ServerApplicationStatus serverAppStatus = new ServerApplicationStatus();

            serverAppStatus.UserApplicationList = new List <ApplicationEntry>();
            foreach (ApplicationData appData in Server.ServerDbHelper.GetInstance().GetAppsWithUserId(model.DbUserId))
            {
                serverAppStatus.UserApplicationList.Add(new ApplicationEntry()
                {
                    Identifier = appData.id,
                    Name       = appData.name
                });
            }

            // get user's preset list
            ServerPresetsStatus serverPresetStatus = new ServerPresetsStatus();

            serverPresetStatus.UserPresetList = new List <PresetsEntry>();
            foreach (PresetData presetData in Server.ServerDbHelper.GetInstance().GetPresetByUserId(model.DbUserId))
            {
                List <ApplicationEntry> presetAppEntries = new List <ApplicationEntry>();
                foreach (ApplicationData appData in presetData.AppDataList)
                {
                    presetAppEntries.Add(new ApplicationEntry()
                    {
                        Identifier = appData.id,
                        Name       = appData.name
                    });
                }

                List <VncEntry> presetVncEntries = new List <VncEntry>();
                foreach (RemoteVncData vncData in presetData.VncDataList)
                {
                    presetVncEntries.Add(new VncEntry()
                    {
                        Identifier  = vncData.id,
                        DisplayName = vncData.name,
                        IpAddress   = vncData.remoteIp,
                        Port        = vncData.remotePort,
                    });
                }

                // get all vision inputs
                List <InputAttributes> allInputList = Server.ServerVisionHelper.getInstance().GetAllVisionInputsAttributes();
                List <InputAttributes> inputEntries = new List <InputAttributes>();
                foreach (VisionData inputData in presetData.InputDataList)
                {
                    inputEntries.Add(new InputAttributes()
                    {
                        InputId     = inputData.id,
                        DisplayName = allInputList.First(inputAtt => inputAtt.InputId == inputData.id).DisplayName,
                    });
                }

                serverPresetStatus.UserPresetList.Add(new PresetsEntry()
                {
                    Identifier      = presetData.Id,
                    Name            = presetData.Name,
                    ApplicationList = presetAppEntries,
                    VncList         = presetVncEntries,
                    InputList       = inputEntries,
                });
            }

            // get user's priviledge
            ServerMaintenanceStatus maintenanceStatus = new ServerMaintenanceStatus();
            GroupData groupData = Server.ServerDbHelper.GetInstance().GetGroupByUserId(model.DbUserId);

            maintenanceStatus.AllowMaintenance   = groupData.allow_maintenance;
            maintenanceStatus.AllowRemoteControl = groupData.allow_remote;

            MonitorInfo allowViewingArea = new MonitorInfo();

            if (groupData.share_full_desktop)
            {
                // same as full desktop
                allowViewingArea.LeftPos   = desktopLeft;
                allowViewingArea.TopPos    = desktopTop;
                allowViewingArea.RightPos  = desktopRight;
                allowViewingArea.BottomPos = desktopBottom;
            }
            else
            {
                // get monitor info
                MonitorData monitorData = Server.ServerDbHelper.GetInstance().GetMonitorByGroupId(groupData.id);

                allowViewingArea.LeftPos   = monitorData.Left;
                allowViewingArea.TopPos    = monitorData.Top;
                allowViewingArea.RightPos  = monitorData.Right;
                allowViewingArea.BottomPos = monitorData.Bottom;
            }

            // prepare the VNC list
            ServerVncStatus vncStatus  = new ServerVncStatus();
            List <VncEntry> vncEntries = new List <VncEntry>();

            vncStatus.UserVncList = vncEntries;
            foreach (RemoteVncData vncData in ServerDbHelper.GetInstance().GetRemoteVncList())
            {
                vncEntries.Add(new VncEntry()
                {
                    Identifier  = vncData.id,
                    DisplayName = vncData.name,
                    IpAddress   = vncData.remoteIp,
                    Port        = vncData.remotePort,
                });
            }

            ServerLoginReply reply = new ServerLoginReply()
            {
                LoginName    = model.Name,
                UserId       = model.DbUserId,
                ServerLayout = new ServerScreenInfo()
                {
                    MatrixCol          = desktopCol,
                    MatrixRow          = dekstopRow,
                    ServerMonitorsList = monitorList
                },
                // UserApplications
                UserApplications = serverAppStatus,

                // UserPresets
                UserPresets = serverPresetStatus,

                // UserMaintenance
                UserMaintenance = maintenanceStatus,

                // allowed viewing area
                ViewingArea = allowViewingArea,

                // Current vnc list
                VncStatus = vncStatus,

                // user settings
                UserSetting = userSetting,
            };

            connectionMgr.SendData(
                (int)CommandConst.MainCommandServer.UserPriviledge,
                (int)CommandConst.SubCommandServer.DisplayInfo,
                reply,
                new List <string>()
            {
                model.SocketUserId
            });


            // send Input info to client
            Session.Data.ServerInputStatus inputStatus = new Session.Data.ServerInputStatus()
            {
                InputAttributesList = Server.ServerVisionHelper.getInstance().GetAllVisionInputsAttributes(),
            };

            connectionMgr.SendData(
                (int)CommandConst.MainCommandServer.Presents,
                (int)CommandConst.SubCommandServer.VisionInput,
                inputStatus,
                new List <string>()
            {
                model.SocketUserId
            });
        }