Exemple #1
0
		// 删除页面
		public bool DeleteView(View view)
		{
			views.Remove(view);
			SaveViews();
			return true;
		}
Exemple #2
0
		// 新增页面
		public void AddView(View view)
		{
			view.ID = nextViewID++;
			views.Add(view);
			SaveViews();
		}
Exemple #3
0
        // 检查是否已经存在页面,无则为true.
		public bool CheckView(View view)
		{
			foreach (View v in views)
			{
				if ((view.Name == v.Name) && ((view.ID == 0) || (view.ID != v.ID)))
					return false;
			}
			return true;
		}
Exemple #4
0
        // 把页面从集合中移除
		public void Remove(View view)
		{
			InnerList.Remove(view);
		}
Exemple #5
0
        // 从Xml中加载单个页面节点信息
        private void LoadViews(XmlTextReader reader)
        {
            while (reader.Name == "View")
            {
                int	depth = reader.Depth;

                View view = new View(reader.GetAttribute("name"));
                view.ID				= int.Parse(reader.GetAttribute("id"));
                view.Description	= reader.GetAttribute("desc");
                view.Rows			= short.Parse(reader.GetAttribute("rows"));
                view.Cols			= short.Parse(reader.GetAttribute("cols"));
                view.CellWidth		= short.Parse(reader.GetAttribute("width"));
                view.CellHeight		= short.Parse(reader.GetAttribute("height"));

                string[] strIDs = reader.GetAttribute("cameras").Split(',');
                for (int i = 0, k = 0; i < View.MaxRows; i++)
                {
                    for (int j = 0; j < View.MaxCols; j++, k++)
                    {
                        view.SetCamera(i, j, int.Parse(strIDs[k]));
                    }
                }

                views.Add(view);

                if (view.ID >= nextViewID)
                    nextViewID = view.ID + 1;

                // 读取下一节点
                reader.Read();
                while (reader.NodeType == XmlNodeType.EndElement)
                    reader.Read();
                if (reader.Depth < depth)
                    return;
            }
        }
Exemple #6
0
		// 把新页面加到集合中
		public void Add(View view)
		{
			InnerList.Add(view);
		}
Exemple #7
0
        // 增加摄像头
        private void AddCamera()
        {
            摄像头新增窗体 form = new 摄像头新增窗体();
            // 设置提供商
            form.VideoProviders = config.providers;
            // 设置回调函数,用于测试摄像头
            form.CheckCameraFunction = new CheckCameraHandler(CheckCamera);

            // 显示界面
            if (form.ShowDialog() == DialogResult.OK)
            {
                CountCamera++;      //统计已经添加的摄像头数
                Camera camera = form.Camera;
                config.AddCamera(camera);
                cameraToEdit = camera;
                switch (CountCamera)
                {
                    case 1:
                        View1.SetCamera(0, 0, camera.ID);
                        View2.SetCamera(0, 0, camera.ID);
                        View3.SetCamera(0, 0, camera.ID);
                        View4.SetCamera(0, 0, camera.ID);
                        View9.SetCamera(0, 0, camera.ID);
                        SelectedView = View1;
                        break;
                    case 2:
                        View2.SetCamera(0, 1, camera.ID);
                        View3.SetCamera(0, 1, camera.ID);
                        View4.SetCamera(0, 1, camera.ID);
                        View9.SetCamera(0, 1, camera.ID);
                        SelectedView = View2;
                        break;
                    case 3:
                        View3.SetCamera(0, 2, camera.ID);
                        View4.SetCamera(1, 0, camera.ID);
                        View9.SetCamera(0, 2, camera.ID);
                        SelectedView = View3;
                        break;
                    case 4:
                        View4.SetCamera(1, 1, camera.ID);
                        View9.SetCamera(1, 0, camera.ID);
                        SelectedView = View4;
                        break;
                    case 5:
                        View9.SetCamera(1, 1, camera.ID);
                        SelectedView = View9;
                        break;
                    case 6:
                        View9.SetCamera(1, 2, camera.ID);
                        SelectedView = View9;
                        break;
                    case 7:
                        View9.SetCamera(2, 0, camera.ID);
                        SelectedView = View9;
                        break;
                    case 8:
                        View9.SetCamera(2, 1, camera.ID);
                        SelectedView = View9;
                        break;
                    case 9:
                        View9.SetCamera(2, 2, camera.ID);
                        SelectedView = View9;
                        break;
                    default: break;
                }
                OpenView();
            }
        }
Exemple #8
0
 // 视图模式改变
 private void changeView()
 {
     removeform();
     if (tsmi页面1.Checked == true)
     {
         SelectedView = View2;
         tsmi页面2.Checked = true;
     }
     else if (tsmi页面2.Checked)
     {
         SelectedView = View3;
         tsmi页面3.Checked = true;
     }
     else if (tsmi页面3.Checked)
     {
         SelectedView = View4;
         tsmi页面4.Checked = true;
     }
     else if (tsmi页面4.Checked)
     {
         SelectedView = View9;
         tsmi页面9.Checked = true;
     }
     else if (tsmi页面9.Checked)
     {
         SelectedView = View1;
         tsmi页面1.Checked = true;
     }
     OpenView();
 }
Exemple #9
0
 //视图模式
 private void tsb视图模式_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e)
 {
     removeform();
     switch (e.ClickedItem.Text)
     {
         case "1个页面":                
             SelectedView = View1;
             tsmi页面1.Checked = true;
             break;
         case "2个页面":
             SelectedView = View2;
             tsmi页面2.Checked = true;
             break;
         case "3个页面":
             SelectedView = View3;
             tsmi页面3.Checked = true;
             break;
         case "4个页面":
             SelectedView = View4;
             tsmi页面4.Checked = true;
             break;
         case "9个页面":
             SelectedView = View9;
             tsmi页面9.Checked = true;
             break;
         default:
             return;
     }
     OpenView();
 }
Exemple #10
0
 // 视图->页面模式->页面9
 private void tsmi页面9_Click(object sender, EventArgs e)
 {
     removeform();
     SelectedView = View9;
     OpenView();
 }