Beispiel #1
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            backgroundWorker1.WorkerReportsProgress      = true;
            backgroundWorker1.WorkerSupportsCancellation = true;
            CsConst.mstrDefaultPath = Application.StartupPath + @"\Database\Easy_Design.mdb";
            LoadControlsText.LoadButtonCoontrolTypeFromDatabaseToPublicClass();
            HDLSysPF.GetWeekdaysFromPublicStruct();
            //LoadControlsText.CheckAndLoadControlsNew();
            LoadControlsText.LoadControlsTextIdListFromXML();
            LoadControlsText.DisplayTextToFormWhenFirstShow(this);

            CsConst.mstrINIDefault = new IniFile(Application.StartupPath + @"\ini\LAN0.ini");
            ButtonMode.LoadButtonModeFromDatabaseToPublicClass();
            DryMode.LoadButtonModeFromDatabaseToPublicClass();
            ButtonControlType.LoadButtonCoontrolTypeFromDatabaseToPublicClass();
            DryControlType.LoadButtonCoontrolTypeFromDatabaseToPublicClass();
            DeviceTypeList.LoadButtonCoontrolTypeFromDatabaseToPublicClass();
            ControlTemplates.ReadAllGroupCommandsFrmDatabase();


            HDLSysPF.AutoScale((Form)sender);

            HDLSysPF.AddedDevicesIndexToAPublicListInt();
            GetDeviceList();
            // dgOnline.RowCount = 28;
        }
Beispiel #2
0
        public String ModeName; //中文

        public static void LoadButtonModeFromDatabaseToPublicClass()
        {
            CsConst.myPublicDryMode = new List <DryMode>();

            string          strsql = string.Format("select * from DryMode order by DryMode");
            OleDbDataReader dr     = DataModule.SearchAResultSQLDB(strsql, CsConst.mstrDefaultPath);

            if (dr != null)
            {
                while (dr.Read())
                {
                    DryMode TmpButtonMode = new DryMode();
                    TmpButtonMode.ModeSaveID = (Byte)(dr.GetInt16(0));
                    if (CsConst.iLanguageId == 0) //
                    {
                        TmpButtonMode.ModeName = dr.GetString(2);
                    }
                    else
                    {
                        TmpButtonMode.ModeName = dr.GetString(1);
                    }

                    CsConst.myPublicDryMode.Add(TmpButtonMode);
                }
                dr.Close();
            }
        }
Beispiel #3
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
            }
        }