示例#1
0
        private void btnCreate_Click(object sender, EventArgs e)
        {
            // создание каналов
            string logFileName = AppData.AppDirs.LogDir + "ScadaAdminCreateCnls.txt";
            bool   logCreated;
            string msg;

            bool createOK = CreateCnls.CreateChannels(kpInfoList,
                                                      chkInsertKPName.Checked, logFileName, out logCreated, out msg);

            if (msg != "")
            {
                if (createOK)
                {
                    ScadaUiUtils.ShowInfo(msg);
                }
                else
                {
                    AppUtils.ProcError(msg);
                }
            }

            if (logCreated)
            {
                Process.Start(logFileName);
            }
        }
示例#2
0
        /// <summary>
        /// Рассчитать и отобразить номера каналов
        /// </summary>
        private void CalcAndShowCnlNums(bool showError)
        {
            // получение номеров существующих каналов
            if (inCnlNums == null)
            {
                inCnlNums = Tables.GetInCnlNums();
            }
            if (ctrlCnlNums == null)
            {
                ctrlCnlNums = Tables.GetCtrlCnlNums();
            }

            // получение параметров нумерации
            CreateCnls.CnlNumParams inCnlNumParams = new CreateCnls.CnlNumParams()
            {
                Start    = decimal.ToInt32(numInCnlsStart.Value),
                Multiple = decimal.ToInt32(numInCnlsMultiple.Value),
                Shift    = decimal.ToInt32(numInCnlsShift.Value),
                Space    = decimal.ToInt32(numInCnlsSpace.Value)
            };

            CreateCnls.CnlNumParams ctrlCnlNumParams = new CreateCnls.CnlNumParams()
            {
                Start    = decimal.ToInt32(numCtrlCnlsStart.Value),
                Multiple = decimal.ToInt32(numCtrlCnlsMultiple.Value),
                Shift    = decimal.ToInt32(numCtrlCnlsShift.Value),
                Space    = decimal.ToInt32(numCtrlCnlsSpace.Value)
            };

            // рассчёт номеров каналов
            string errMsg;
            bool   calcOk = CreateCnls.CalcCnlNums(kpViewTypes, kpInfoList, commDirs,
                                                   inCnlNums, inCnlNumParams, ctrlCnlNums, ctrlCnlNumParams, out errMsg);

            // вывод на форму
            SwitchCalcCreateEnabled(!calcOk);
            gvKPSel.Invalidate();
            if (showError && errMsg != "")
            {
                AppUtils.ProcError(errMsg);
            }
        }
示例#3
0
        /// <summary>
        /// Calculate and display channel numbers
        /// </summary>
        private void CalcAndShowCnlNums(bool showError)
        {
            // getting numbers of existing channels
            if (inCnlNums == null)
            {
                inCnlNums = Tables.GetInCnlNums();
            }
            if (ctrlCnlNums == null)
            {
                ctrlCnlNums = Tables.GetCtrlCnlNums();
            }

            // getting numbering parameters
            var inCnlNumParams = new CreateCnls.CnlNumParams()
            {
                Start    = decimal.ToInt32(numInCnlsStart.Value),
                Multiple = decimal.ToInt32(numInCnlsMultiple.Value),
                Shift    = decimal.ToInt32(numInCnlsShift.Value),
                Space    = decimal.ToInt32(numInCnlsSpace.Value)
            };

            var ctrlCnlNumParams = new CreateCnls.CnlNumParams()
            {
                Start    = decimal.ToInt32(numCtrlCnlsStart.Value),
                Multiple = decimal.ToInt32(numCtrlCnlsMultiple.Value),
                Shift    = decimal.ToInt32(numCtrlCnlsShift.Value),
                Space    = decimal.ToInt32(numCtrlCnlsSpace.Value)
            };

            // calculation of channel numbers
            string errMsg;
            bool   calcOk = CreateCnls.CalcCnlNums(kpViewTypes, kpInfoList, commDirs,
                                                   inCnlNums, inCnlNumParams, ctrlCnlNums, ctrlCnlNumParams, out errMsg);

            // output to form
            SwitchCalcCreateEnabled(!calcOk);
            gvKPSel.Invalidate();
            if (showError && errMsg != "")
            {
                AppUtils.ProcError(errMsg);
            }
        }