/// <summary>
        /// 加载配置信息,及创建主控窗体
        /// </summary>
        private void OnLoadConfiguration()
        {
            this.Text = "SiMay远程监控管理系统-IOASJHD 正式版_" + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();

            if (AppConfiguration.WindowMaximize)
            {
                this.WindowState = FormWindowState.Maximized;
            }

            this._imgList = new ImageList();
            this._imgList.Images.Add("ok", Resources.ok);
            this._imgList.Images.Add("error", Resources.erro);

            //计算实时上下传输流量
            this._flowCalcTimer          = new System.Timers.Timer();
            this._flowCalcTimer.Interval = 1000;
            this._flowCalcTimer.Elapsed += (a, b) =>
            {
                if (!_isRun)
                {
                    _flowCalcTimer.Stop();
                    _flowCalcTimer.Dispose();
                    return;
                }

                this.BeginInvoke(new Action(() =>
                {
                    this.strdownflow.Text         = (this._receiveTransferredBytes / (float)1024).ToString("0.00");
                    this._receiveTransferredBytes = 0;

                    this.struflow.Text         = (this._sendTransferredBytes / (float)1024).ToString("0.00");
                    this._sendTransferredBytes = 0;
                }));
            };
            this._flowCalcTimer.Start();
            if (AppConfiguration.SessionMode == "1")
            {
                this.stripHost.Text = AppConfiguration.ServiceIPAddress;
                this.stripPort.Text = AppConfiguration.ServicePort.ToString();
            }
            else
            {
                this.stripHost.Text = AppConfiguration.IPAddress;
                this.stripPort.Text = AppConfiguration.Port.ToString();
            }

            this.rowtrackBar.Value               = this._viewCarouselContext.ViewRow;
            this.columntrackBar.Value            = this._viewCarouselContext.ViewColum;
            this.viewRow.Text                    = columntrackBar.Value.ToString();
            this.viewColumn.Text                 = rowtrackBar.Value.ToString();
            this.splitContainer.SplitterDistance = (splitContainer.Width / 4);

            this.logList.SmallImageList = _imgList;
            this.logList.Columns.Add("发生时间", 150);
            this.logList.Columns.Add("发生事件", 1000);

            this.groupBox.Text = GROUP_ALL;
            string[] columnsTitle = new string[]
            {
                "IP地址",
                "计算机名",
                "操作系统",
                "处理器信息",
                "核心数量",
                "运行内存",
                "系统账户",
                "摄像设备",
                "录音设备",
                "播放设备",
                "备注信息",
                "服务版本",
                "启动时间",
                "分组名称"
            };

            for (int i = 0; i < columnsTitle.Length; i++)
            {
                this.servicesOnlineList.Columns.Insert(i, columnsTitle[i], 150);
            }

            var apps = SysUtil.ApplicationTypes.OrderByDescending(x => x.Rank).ToList();

            apps.ForEach(c =>
            {
                var type         = c.Type;
                var stripMenu    = new UToolStripMenuItem(type.GetApplicationName(), c.Type);
                stripMenu.Click += StripMenu_Click;
                this.cmdContext.Items.Insert(0, stripMenu);

                if (c.Type.OnTools())
                {
                    var stripButton    = new UToolStripButton(type.GetApplicationName(), SysUtilExtend.GetResourceImageByName(type.GetIconResourceName()), type);
                    stripButton.Click += StripButton_Click;
                    this.toolStrip1.Items.Insert(3, stripButton);
                }
            });

            if (AppConfiguration.WindowsIsLock) //锁住主控界面
            {
                LockWindow();
            }

            _viewCarouselTimer          = new System.Timers.Timer(_viewCarouselContext.ViewCarouselInterval);
            _viewCarouselTimer.Elapsed += ViewCarouselFunc;

            if (_viewCarouselContext.CarouselEnabled)
            {
                _viewCarouselTimer.Start();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 加载配置信息,及创建主控窗体
        /// </summary>
        private void OnLoadConfiguration()
        {
            this.Text = "SiMay远程监控管理系统-IOASJHD 正式版_" + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();

            bool maximized;

            if (bool.TryParse(AppConfiguration.WindowMaximize, out maximized))
            {
                if (maximized)
                {
                    this.WindowState = FormWindowState.Maximized;
                }
            }

            this._imgList = new ImageList();
            this._imgList.Images.Add("ok", Resources.ok);
            this._imgList.Images.Add("error", Resources.erro);

            //计算实时上下传输流量
            this._timer          = new System.Timers.Timer();
            this._timer.Interval = 1000;
            this._timer.Elapsed += (a, b) =>
            {
                if (!_isRun)
                {
                    _timer.Stop();
                    _timer.Dispose();
                    return;
                }

                this.BeginInvoke(new Action(() =>
                {
                    this.strdownflow.Text         = (this._receiveTransferredBytes / (float)1024).ToString("0.00");
                    this._receiveTransferredBytes = 0;

                    this.struflow.Text         = (this._sendTransferredBytes / (float)1024).ToString("0.00");
                    this._sendTransferredBytes = 0;
                }));
            };
            this._timer.Start();

            if (!int.TryParse(AppConfiguration.DesktopViewHeight, out this._desktopViewHeight))
            {
                this._desktopViewHeight = 220;
            }

            if (!int.TryParse(AppConfiguration.DesktopViewWidth, out this._desktopViewWidth))
            {
                this._desktopViewHeight = 280;
            }

            if (!int.TryParse(AppConfiguration.DesktopRefreshTimeSpan, out this._deskrefreshTimeSpan))
            {
                this._deskrefreshTimeSpan = 1500;
            }

            this.columntrackBar.Value             = this._desktopViewHeight;
            this.rowtrackBar.Value                = this._desktopViewWidth;
            this.row.Text                         = rowtrackBar.Value.ToString();
            this.column.Text                      = columntrackBar.Value.ToString();
            this.deskrefreshTimeSpan.Value        = _deskrefreshTimeSpan;
            this.splitContainer2.SplitterDistance = (splitContainer2.Width / 4);

            this.logList.SmallImageList = _imgList;
            this.logList.Columns.Add("发生时间", 150);
            this.logList.Columns.Add("发生事件", 1000);

            string[] columnsTitle = new string[]
            {
                "IP地址",
                "计算机名",
                "操作系统",
                "处理器信息",
                "核心数量",
                "运行内存",
                "系统账户",
                "摄像设备",
                "录音设备",
                "播放设备",
                "备注信息",
                "服务版本",
                "启动时间"
            };

            for (int i = 0; i < columnsTitle.Length; i++)
            {
                this.onlineList.Columns.Insert(i, columnsTitle[i], 150);
            }

            this._resetPool = new ResetPool(_syncContexts);

            var controls = SysUtil.ControlTypes.OrderByDescending(x => x.Rank).ToList();

            controls.ForEach(c =>
            {
                var stripMenu    = new UToolStripMenuItem(c.DisplayName, c.CtrlType);
                stripMenu.Click += StripMenu_Click;
                this.CmdContext.Items.Insert(0, stripMenu);

                var stripButton    = new UToolStripButton(c.DisplayName, SysUtil.GetResourceImageByName(c.ResourceName), c.CtrlType);
                stripButton.Click += StripButton_Click;
                this.toolStrip1.Items.Insert(3, stripButton);
            });

            bool isLock;

            if (bool.TryParse(AppConfiguration.WindowsIsLock, out isLock))
            {
                if (isLock) //锁住主控界面
                {
                    LockWindow();
                }
            }
        }