Exemple #1
0
        protected override void InitControls()
        {
            if (IsAdding)
            {
                this.Text = Resources.Resource1.Form_Add;
            }
            this.comWorkStation.Init();
            this.comPort.Init();

            this.comDeviceType.Items.Clear();
            this.comDeviceType.Items.Add(EntranceDeviceTypeDescription.GetDescription(EntranceDeviceType.CANEntrance));
            this.comDeviceType.Items.Add(EntranceDeviceTypeDescription.GetDescription(EntranceDeviceType.NETEntrance));
            this.comDeviceType.Enabled = (IsAdding && ParentPark == null);

            this.comWorkMode.Items.Clear();
            this.comWorkMode.Items.Add(ParkWorkModeDescription.GetDescription(ParkWorkMode.OffLine));
            this.comWorkMode.Items.Add(ParkWorkModeDescription.GetDescription(ParkWorkMode.Fool));
            this.comWorkMode.Enabled = (IsAdding && ParentPark == null);//不允许修改停车场工作模式

            this.comListMode.Items.Clear();
            this.comListMode.Items.Add(ParkListModeDescription.GetDescription(ParkListMode.Card));
            this.comListMode.Items.Add(ParkListModeDescription.GetDescription(ParkListMode.CarPlate));
            this.comListMode.Items.Add(ParkListModeDescription.GetDescription(ParkListMode.CarPlateAndCard));
            this.comListMode.Enabled = (IsAdding && ParentPark == null);

            if (ParentPark != null || (UpdatingItem != null && (UpdatingItem as ParkInfo).IsRootPark == false)) //非项级停车场不能设置串口号和通讯工作站
            {
                if (ParentPark != null)
                {
                    this.comDeviceType.SelectedIndex = (int)ParentPark.DeviceType;
                    this.comWorkMode.SelectedIndex   = (int)ParentPark.WorkMode;
                    this.comListMode.SelectedIndex   = (int)ParentPark.ListMode;
                }
                this.comWorkStation.Enabled = false;
                this.comPort.Enabled        = false;
                this.chkIsNested.Enabled    = true;
                this.comDeviceType.Enabled  = false;
                this.comWorkMode.Enabled    = false;
                this.comListMode.Enabled    = false;
            }
            else
            {
                this.comWorkStation.Enabled = true;
                this.comPort.Enabled        = true;
                this.chkIsNested.Checked    = false;
                this.chkIsNested.Enabled    = false;
            }

            RoleInfo role = OperatorInfo.CurrentOperator.Role;

            this.btnOk.Enabled = role.Permit(Permission.EditPark);
        }
Exemple #2
0
 /// <summary>
 /// 显示PARK节点
 /// </summary>
 /// <param name="node"></param>
 /// <param name="park"></param>
 public void RenderPark(TreeNode node, ParkInfo park)
 {
     if (park.IsRootPark)
     {
         node.Text = string.Format("{0}[{1}/{2}][{3}]", park.ParkName, park.Vacant, park.TotalPosition, ParkWorkModeDescription.GetDescription(park.WorkMode));
     }
     else
     {
         node.Text = string.Format("{0}[{1}/{2}]", park.ParkName, park.Vacant, park.TotalPosition);
     }
     node.Tag                = park;
     node.ForeColor          = (park.Status == EntranceStatus.Ok) ? Color.Black : Color.Red;
     node.ImageIndex         = (park.Status == EntranceStatus.Ok) ? 1 : 4;
     node.SelectedImageIndex = (park.Status == EntranceStatus.Ok) ? 1 : 4;
 }