Ejemplo n.º 1
0
        public frmIPMod(IPModule oIPModule, string strName, int intDIndex, int intDeviceType)
        {
            InitializeComponent();

            this.myIPModule      = oIPModule;
            this.myDevName       = strName;
            this.mintIDIndex     = intDIndex;
            this.mywdDevicerType = intDeviceType;

            string strDevName = strName.Split('\\')[0].ToString();

            HDLSysPF.DisplayDeviceNameModeDescription(strName, mywdDevicerType, cboDevice, tbModel, tbDescription);

            SubNetID                = Convert.ToByte(strDevName.Split('-')[0]);
            DeviceID                = Convert.ToByte(strDevName.Split('-')[1]);
            tsl3.Text               = strName;
            txtCommand              = new TextBox();
            txtCommand.KeyPress    += txtCommand_KeyPress;
            txtCommand.TextChanged += txtCommand_TextChanged;
            dgvFilter.Controls.Add(txtCommand);
            txtCommand.Visible   = false;
            txtCommand.MaxLength = 4;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 刷新当前
        /// </summary>
        void RefreshButtonParametersToDataGrid()
        {
            if (MyActiveObject is IPModule)
            {
                #region
                IPModule TmpIpModule = (IPModule)MyActiveObject;
                if (TmpIpModule == null)
                {
                    return;
                }
                if (TmpIpModule.MyRemoteControllers == null)
                {
                    return;
                }
                if (cboController.SelectedIndex == -1)
                {
                    return;
                }
                Byte RemoteControllerID = (Byte)cboController.SelectedIndex;
                Byte PageID             = (Byte)cboPages.SelectedIndex;

                Byte[] ArayButtonDimAndSaveDim = TmpIpModule.ReadButtonDimFlagFrmDeviceToBuf(RemoteControllerID, SubNetID, DeviceID);

                for (Byte bytI = 0; bytI < IPmoduleDeviceTypeList.HowManyButtonsEachPage; bytI++)
                {
                    TmpIpModule.MyRemoteControllers[RemoteControllerID * IPmoduleDeviceTypeList.HowManyButtonsEachPage + bytI].IsDimmer   = (Byte)(ArayButtonDimAndSaveDim[bytI] >> 4);
                    TmpIpModule.MyRemoteControllers[RemoteControllerID * IPmoduleDeviceTypeList.HowManyButtonsEachPage + bytI].SaveDimmer = (Byte)(ArayButtonDimAndSaveDim[bytI] & 0x01);
                }
                cboPages_SelectedIndexChanged(cboPages, null);
                #endregion
            }
            else if (MyActiveObject is Panel)
            {
                #region
                Panel TmpPanel = (Panel)MyActiveObject;
                if (TmpPanel == null)
                {
                    return;
                }
                if (TmpPanel.PanelKey == null)
                {
                    return;
                }

                Byte[] ArayButtonLedBuf        = new Byte[TmpPanel.PanelKey.Count];
                Byte[] ArayButtonDimAndSaveDim = new Byte[TmpPanel.PanelKey.Count];
                Byte[] ArayButtonMutux         = new Byte[TmpPanel.PanelKey.Count];
                Byte[] ArayButtonLink          = new Byte[TmpPanel.PanelKey.Count];
                if (clLed.Visible == true)
                {
                    ArayButtonLedBuf = TmpPanel.ReadButtonLEDFrmDeviceToBuf(SubNetID, DeviceID);
                }

                if (clMutux.Visible == true)
                {
                    ArayButtonMutux = TmpPanel.ReadButtonMutuxFrmDeviceToBuf(SubNetID, DeviceID);
                }

                if (clLink.Visible == true)
                {
                    ArayButtonLink = TmpPanel.ReadButtonLinkableFrmDeviceToBuf(SubNetID, DeviceID);
                }

                if (ClDim.Visible == true)
                {
                    ArayButtonDimAndSaveDim = TmpPanel.ReadButtonDimFlagFrmDeviceToBuf(SubNetID, DeviceID);
                    for (Byte bytI = 0; bytI < TmpPanel.PanelKey.Count; bytI++)
                    {
                        TmpPanel.PanelKey[bytI].IsDimmer   = (Byte)(ArayButtonDimAndSaveDim[bytI] >> 4);
                        TmpPanel.PanelKey[bytI].SaveDimmer = (Byte)(ArayButtonDimAndSaveDim[bytI] & 0x01);
                        TmpPanel.PanelKey[bytI].IsLEDON    = ArayButtonLedBuf[bytI];
                        TmpPanel.PanelKey[bytI].bytMutex   = ArayButtonMutux[bytI];
                        TmpPanel.PanelKey[bytI].byteLink   = ArayButtonLink[bytI];
                    }
                }

                DisplayButtonParametersToGridTable();
                #endregion
            }
            else if (MyActiveObject is MS04)
            {
                #region
                MS04 TmpPanel = (MS04)MyActiveObject;
                if (TmpPanel == null)
                {
                    return;
                }
                if (TmpPanel.MSKeys == null)
                {
                    return;
                }

                Byte[] ArayButtonDimAndSaveDim = new Byte[TmpPanel.MSKeys.Count];
                Byte[] ArayButtonDimDirection  = new Byte[TmpPanel.MSKeys.Count];

                if (DryDim.Visible == true)
                {
                    ArayButtonDimDirection = TmpPanel.ReadButtonDimDirectionFrmDeviceToBuf(SubNetID, DeviceID);
                }

                if (ClDimValue.Visible == true)
                {
                    ArayButtonDimAndSaveDim = TmpPanel.ReadButtonDimFlagFrmDeviceToBuf(SubNetID, DeviceID);

                    for (Byte bytI = 0; bytI < TmpPanel.MSKeys.Count; bytI++)
                    {
                        TmpPanel.MSKeys[bytI].IsDimmer   = ArayButtonDimDirection[bytI];
                        TmpPanel.MSKeys[bytI].SaveDimmer = ArayButtonDimAndSaveDim[bytI];
                    }
                }

                DisplayButtonParametersToGridTable();
                #endregion
            }
            else if (MyActiveObject is MHRCU)
            {
                #region
                MHRCU TmpPanel = (MHRCU)MyActiveObject;
                if (TmpPanel == null)
                {
                    return;
                }
                if (TmpPanel.MSKeys == null)
                {
                    return;
                }

                Byte[] ArayButtonDimAndSaveDim = new Byte[TmpPanel.MSKeys.Count];
                Byte[] ArayButtonDimDirection  = new Byte[TmpPanel.MSKeys.Count];

                if (DryDim.Visible == true)
                {
                    ArayButtonDimDirection = TmpPanel.ReadButtonDimDirectionFrmDeviceToBuf(SubNetID, DeviceID);
                }

                if (ClDimValue.Visible == true)
                {
                    ArayButtonDimAndSaveDim = TmpPanel.ReadButtonDimFlagFrmDeviceToBuf(SubNetID, DeviceID);

                    for (Byte bytI = 0; bytI < TmpPanel.MSKeys.Count; bytI++)
                    {
                        TmpPanel.MSKeys[bytI].IsDimmer   = ArayButtonDimDirection[bytI];
                        TmpPanel.MSKeys[bytI].SaveDimmer = ArayButtonDimAndSaveDim[bytI];
                    }
                }

                DisplayButtonParametersToGridTable();
                #endregion
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 更新到结构体 需要则上传到设备
        /// </summary>
        void SaveButtonParametersToBuf()
        {
            if (MyActiveObject is IPModule)
            {
                #region
                IPModule TmpIpModule = (IPModule)MyActiveObject;
                if (TmpIpModule == null)
                {
                    return;
                }
                if (TmpIpModule.MyRemoteControllers == null)
                {
                    return;
                }
                if (cboController.SelectedIndex == -1)
                {
                    return;
                }
                Byte RemoteControllerID = (Byte)cboController.SelectedIndex;
                Byte PageID             = (Byte)cboPages.SelectedIndex;

                Byte[] DimEnable     = GetDataFromDataGridToPublicBuf(4);
                Byte[] SaveDimEnable = GetDataFromDataGridToPublicBuf(5);

                for (Byte bytI = 0; bytI < 8; bytI++)
                {
                    TmpIpModule.MyRemoteControllers[RemoteControllerID * IPmoduleDeviceTypeList.HowManyButtonsEachPage + bytI + PageID * 8].IsDimmer   = DimEnable[bytI];
                    TmpIpModule.MyRemoteControllers[RemoteControllerID * IPmoduleDeviceTypeList.HowManyButtonsEachPage + bytI + PageID * 8].SaveDimmer = SaveDimEnable[bytI];
                }

                if (CsConst.MyEditMode == 1)
                {
                    TmpIpModule.SaveButtonDimFlagToDeviceFrmBuf(RemoteControllerID, SubNetID, DeviceID, mywdDevicerType);
                }
                #endregion
            }
            else if (MyActiveObject is Panel)
            {
                #region
                Panel TmpPanel = (Panel)MyActiveObject;
                if (TmpPanel == null)
                {
                    return;
                }
                if (TmpPanel.PanelKey == null)
                {
                    return;
                }

                Byte PageID = 0;
                if (cboPages.Visible)
                {
                    PageID = Convert.ToByte(cboPages.SelectedIndex);
                }
                int wdMaxValue = int.Parse(CsConst.mstrINIDefault.IniReadValue("DeviceType" + mywdDevicerType.ToString(), "MaxValue", "0"));

                Byte[] ArayButtonLedBuf  = new Byte[TmpPanel.PanelKey.Count];
                Byte[] ArayButtonDim     = new Byte[TmpPanel.PanelKey.Count];
                Byte[] ArayButtonSaveDim = new Byte[TmpPanel.PanelKey.Count];
                Byte[] ArayButtonMutux   = new Byte[TmpPanel.PanelKey.Count];
                Byte[] ArayButtonLink    = new Byte[TmpPanel.PanelKey.Count];

                if (clLed.Visible == true)
                {
                    ArayButtonLedBuf = GetDataFromDataGridToPublicBuf(3);
                    for (int i = 0; i < ArayButtonLedBuf.Length; i++)
                    {
                        if (ArayButtonLedBuf[i] == 0)
                        {
                            ArayButtonLedBuf[i] = 1;
                        }
                        else
                        {
                            ArayButtonLedBuf[i] = 0;
                        }
                    }
                }

                if (ClDim.Visible == true)
                {
                    ArayButtonDim = GetDataFromDataGridToPublicBuf(4);
                }

                if (ClDimValue.Visible == true)
                {
                    ArayButtonSaveDim = GetDataFromDataGridToPublicBuf(5);
                }

                if (clMutux.Visible == true)
                {
                    ArayButtonMutux = GetDataFromDataGridToPublicBuf(6);
                }

                if (clLink.Visible == true)
                {
                    ArayButtonLink = GetDataFromDataGridToPublicBuf(7);
                }

                for (Byte bytI = 0; bytI < dgvListA.RowCount; bytI++)
                {
                    TmpPanel.PanelKey[bytI + wdMaxValue * PageID].IsDimmer   = ArayButtonDim[bytI];
                    TmpPanel.PanelKey[bytI + wdMaxValue * PageID].SaveDimmer = ArayButtonSaveDim[bytI];
                    TmpPanel.PanelKey[bytI + wdMaxValue * PageID].IsLEDON    = ArayButtonLedBuf[bytI];
                    TmpPanel.PanelKey[bytI + wdMaxValue * PageID].bytMutex   = ArayButtonMutux[bytI];
                    TmpPanel.PanelKey[bytI + wdMaxValue * PageID].byteLink   = ArayButtonLink[bytI];
                }

                if (CsConst.MyEditMode == 1)
                {
                    if (clLed.Visible == true)
                    {
                        TmpPanel.SaveButtonLEDEnableToDeviceFrmBuf(SubNetID, DeviceID, mywdDevicerType);
                    }
                    if (ClDim.Visible == true)
                    {
                        TmpPanel.SaveButtonDimFlagToDeviceFrmBuf(SubNetID, DeviceID, mywdDevicerType);
                    }
                    if (clMutux.Visible == true)
                    {
                        TmpPanel.SaveButtonMutuxToDeviceFrmBuf(SubNetID, DeviceID, mywdDevicerType);
                    }
                    if (clLink.Visible == true)
                    {
                        TmpPanel.SaveButtonLinkageToDeviceFrmBuf(SubNetID, DeviceID, mywdDevicerType);
                    }
                }
                #endregion
            }
            else if (MyActiveObject is MS04)
            {
                #region
                MS04 TmpPanel = (MS04)MyActiveObject;
                if (TmpPanel == null)
                {
                    return;
                }
                if (TmpPanel.MSKeys == null)
                {
                    return;
                }

                Byte[] ArayButtonDim     = new Byte[TmpPanel.MSKeys.Count];
                Byte[] ArayButtonSaveDim = new Byte[TmpPanel.MSKeys.Count];

                if (DryDim.Visible == true)
                {
                    ArayButtonDim = GetDataFromDataGridToPublicBuf(8);
                }

                if (ClDimValue.Visible == true)
                {
                    ArayButtonSaveDim = GetDataFromDataGridToPublicBuf(5);
                }

                for (Byte bytI = 0; bytI < TmpPanel.MSKeys.Count; bytI++)
                {
                    TmpPanel.MSKeys[bytI].IsDimmer   = ArayButtonDim[bytI];
                    TmpPanel.MSKeys[bytI].SaveDimmer = ArayButtonSaveDim[bytI];
                }

                if (CsConst.MyEditMode == 1)
                {
                    if (ClDimValue.Visible == true)
                    {
                        TmpPanel.SaveButtonDimFlagToDeviceFrmBuf(SubNetID, DeviceID, mywdDevicerType);
                    }
                    if (DryDim.Visible == true)
                    {
                        TmpPanel.SaveButtonDimDirectionsToDeviceFrmBuf(SubNetID, DeviceID, mywdDevicerType);
                    }
                }
                #endregion
            }
            else if (MyActiveObject is MHRCU)
            {
                #region
                MHRCU TmpPanel = (MHRCU)MyActiveObject;
                if (TmpPanel == null)
                {
                    return;
                }
                if (TmpPanel.MSKeys == null)
                {
                    return;
                }

                Byte[] ArayButtonDim     = new Byte[TmpPanel.MSKeys.Count];
                Byte[] ArayButtonSaveDim = new Byte[TmpPanel.MSKeys.Count];

                if (DryDim.Visible == true)
                {
                    ArayButtonDim = GetDataFromDataGridToPublicBuf(8);
                }

                if (ClDimValue.Visible == true)
                {
                    ArayButtonSaveDim = GetDataFromDataGridToPublicBuf(5);
                }

                for (Byte bytI = 0; bytI < TmpPanel.MSKeys.Count; bytI++)
                {
                    TmpPanel.MSKeys[bytI].IsDimmer   = ArayButtonDim[bytI];
                    TmpPanel.MSKeys[bytI].SaveDimmer = ArayButtonSaveDim[bytI];
                }

                if (CsConst.MyEditMode == 1)
                {
                    if (ClDimValue.Visible == true)
                    {
                        TmpPanel.SaveButtonDimFlagToDeviceFrmBuf(SubNetID, DeviceID, mywdDevicerType);
                    }
                    if (DryDim.Visible == true)
                    {
                        TmpPanel.SaveButtonDimDirectionsToDeviceFrmBuf(SubNetID, DeviceID, mywdDevicerType);
                    }
                }
                #endregion
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 不同类型显示到界面
        /// </summary>
        void DisplayButtonParametersToGridTable()
        {
            if (MyActiveObject is IPModule)
            {
                #region
                IPModule TmpIpModule = (IPModule)MyActiveObject;
                if (TmpIpModule == null)
                {
                    return;
                }
                if (cboController.SelectedIndex == -1)
                {
                    return;
                }
                if (cboPages.SelectedIndex == -1)
                {
                    return;
                }
                dgvListA.Rows.Clear();
                Byte ControllerID = Convert.ToByte(cboController.SelectedIndex);
                Byte PageID       = Convert.ToByte(cboPages.SelectedIndex);

                for (int i = 0; i < 8; i++)
                {
                    HDLButton obutton = TmpIpModule.MyRemoteControllers[ControllerID * 64 + PageID * 8 + i];
                    if (obutton == null)
                    {
                        obutton = new HDLButton();
                    }
                    String   ButtonModeTmp = ButtonMode.ConvertorKeyModeToPublicModeGroup(obutton.Mode);
                    Object[] obj           = new object[] { (i + 1).ToString(), obutton.Remark, ButtonModeTmp, (obutton.IsLEDON == 1), (obutton.IsDimmer == 1),
                                                            (obutton.SaveDimmer == 1), clMutux.Items[obutton.bytMutex], clLink.Items[obutton.byteLink] };
                    dgvListA.Rows.Add(obj);
                }
                #endregion
            }
            else if (MyActiveObject is DLP) //
            {
                Panel TmpPanel = (Panel)MyActiveObject;
                if (TmpPanel == null)
                {
                    return;
                }

                dgvListA.Rows.Clear();
                Byte PageID     = Convert.ToByte(cboPages.SelectedIndex);
                int  wdMaxValue = int.Parse(CsConst.mstrINIDefault.IniReadValue("DeviceType" + mywdDevicerType.ToString(), "MaxValue", "0"));
                for (int i = 0; i < 8; i++)
                {
                    HDLButton obutton = TmpPanel.PanelKey[PageID * 8 + i];
                    if (obutton == null)
                    {
                        obutton = new HDLButton();
                    }
                    String   ButtonModeTmp = ButtonMode.ConvertorKeyModeToPublicModeGroup(obutton.Mode);
                    Object[] obj           = new object[] { (i + 1).ToString(), obutton.Remark, ButtonModeTmp, (obutton.IsLEDON == 0), (obutton.IsDimmer == 1),
                                                            (obutton.SaveDimmer == 1), clMutux.Items[obutton.bytMutex], clLink.Items[obutton.byteLink] };
                    dgvListA.Rows.Add(obj);
                }
            }
            else if (MyActiveObject is Panel)
            {
                #region
                Panel TmpPanel = (Panel)MyActiveObject;
                if (TmpPanel == null)
                {
                    return;
                }

                dgvListA.Rows.Clear();

                for (int i = 0; i < TmpPanel.PanelKey.Count; i++)
                {
                    HDLButton obutton = TmpPanel.PanelKey[i];
                    if (obutton == null)
                    {
                        obutton = new HDLButton();
                    }
                    String ButtonModeTmp = ButtonMode.ConvertorKeyModeToPublicModeGroup(obutton.Mode);
                    if (obutton.bytMutex >= clMutux.Items.Count)
                    {
                        obutton.bytMutex = (Byte)(clMutux.Items.Count - 1);
                    }
                    Object[] obj = new object[] { (i + 1).ToString(), obutton.Remark, ButtonModeTmp, (obutton.IsLEDON == 0), (obutton.IsDimmer == 1),
                                                  (obutton.SaveDimmer == 1), clMutux.Items[obutton.bytMutex], clLink.Items[obutton.byteLink] };
                    dgvListA.Rows.Add(obj);
                }
                #endregion
            }
            else if (MyActiveObject is MS04)
            {
                #region
                MS04 TmpPanel = (MS04)MyActiveObject;
                if (TmpPanel == null)
                {
                    return;
                }

                dgvListA.Rows.Clear();

                for (int i = 0; i < TmpPanel.MSKeys.Count; i++)
                {
                    HDLButton obutton = TmpPanel.MSKeys[i];
                    if (obutton == null)
                    {
                        obutton = new HDLButton();
                    }
                    String   ButtonModeTmp = DryMode.ConvertorKeyModeToPublicModeGroup(obutton.Mode);
                    Object[] obj           = new object[] { (i + 1).ToString(), obutton.Remark, ButtonModeTmp, (obutton.IsLEDON == 0), (obutton.IsDimmer == 1),
                                                            (obutton.SaveDimmer == 1), clMutux.Items[obutton.bytMutex], clLink.Items[obutton.byteLink], DryDim.Items[obutton.IsDimmer] };
                    dgvListA.Rows.Add(obj);
                }
                #endregion
            }
            else if (MyActiveObject is MHRCU)
            {
                #region
                MHRCU TmpPanel = (MHRCU)MyActiveObject;
                if (TmpPanel == null)
                {
                    return;
                }

                dgvListA.Rows.Clear();

                for (int i = 0; i < TmpPanel.MSKeys.Count; i++)
                {
                    HDLButton obutton = TmpPanel.MSKeys[i];
                    if (obutton == null)
                    {
                        obutton = new HDLButton();
                    }
                    String   ButtonModeTmp = DryMode.ConvertorKeyModeToPublicModeGroup(obutton.Mode);
                    Object[] obj           = new object[] { (i + 1).ToString(), obutton.Remark, ButtonModeTmp, (obutton.IsLEDON == 0), (obutton.IsDimmer == 1),
                                                            (obutton.SaveDimmer == 1), clMutux.Items[obutton.bytMutex], clLink.Items[obutton.byteLink], DryDim.Items[obutton.IsDimmer] };
                    dgvListA.Rows.Add(obj);
                }
                #endregion
            }
        }