Esempio n. 1
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();
                }
            }
        }