Exemple #1
0
 /// <summary>
 /// Отобразить свойства типа КП
 /// </summary>
 private void ShowKPTypeProps(KPView kpView)
 {
     try
     {
         if (kpView != null && kpView.CanShowProps)
             kpView.ShowProps();
     }
     catch (Exception ex)
     {
         string errMsg = AppPhrases.ShowKpPropsError + ":\r\n" + ex.Message;
         errLog.WriteAction(errMsg);
         ScadaUtils.ShowError(errMsg);
     }
 }
Exemple #2
0
        /// <summary>
        /// Создать строку канала управления
        /// </summary>
        private static DataRow CreateCtrlCnlRow(DataTable tblCtrlCnl, SortedList<string, int> cmdValList,
            KPView.CtrlCnlPrototype ctrlCnl, object objNum, int kpNum, string kpNameToInsert)
        {
            DataRow newCtrlCnlRow = tblCtrlCnl.NewRow();
            newCtrlCnlRow["CtrlCnlNum"] = ctrlCnl.CtrlCnlNum;
            newCtrlCnlRow["Active"] = true;
            newCtrlCnlRow["Name"] = kpNameToInsert + ctrlCnl.CtrlCnlName;
            newCtrlCnlRow["CmdTypeID"] = ctrlCnl.CmdTypeID;
            newCtrlCnlRow["ObjNum"] = objNum;
            newCtrlCnlRow["KPNum"] = kpNum;
            newCtrlCnlRow["CmdNum"] = ctrlCnl.CmdNum;
            newCtrlCnlRow["CmdValID"] = string.IsNullOrEmpty(ctrlCnl.CmdValName) ?
                DBNull.Value : (object)cmdValList[ctrlCnl.CmdValName];
            newCtrlCnlRow["FormulaUsed"] = ctrlCnl.FormulaUsed;
            newCtrlCnlRow["Formula"] = ctrlCnl.Formula;
            newCtrlCnlRow["EvEnabled"] = ctrlCnl.EvEnabled;
            newCtrlCnlRow["ModifiedDT"] = DateTime.Now;

            return newCtrlCnlRow;
        }
Exemple #3
0
        /// <summary>
        /// Отобразить свойства КП
        /// </summary>
        private bool ShowKPProps(KPView kpView)
        {
            if (kpView.CanShowProps)
            {
                // вызов формы отображения свойств КП
                kpView.KPProps = new KPView.KPProperties(lastLine.CustomParams, lastKP.CmdLine);
                kpView.AppDirs = appDirs;
                kpView.ShowProps();

                if (kpView.KPProps.Modified)
                {
                    // обновление пользовательских параметров линии связи на форме
                    CustomParamsToPage();

                    // обновление командной строки на форме, если необходимо
                    if (tabControl.SelectedTab == pageReqSequence)
                        txtCmdLine.Text = kpView.KPProps.CmdLine;
                    else
                        lastKP.CmdLine = kpView.KPProps.CmdLine;

                    SetModified();
                }

                return true;
            }
            else
            {
                return false;
            }
        }
Exemple #4
0
        /// <summary>
        /// Создать строку входного канала
        /// </summary>
        private static DataRow CreateInCnlRow(DataTable tblInCnl, DataTable tblFormat, 
            SortedList<string, int> paramList, SortedList<string, int> unitList, 
            KPView.InCnlPrototype inCnl, object objNum, int kpNum, string kpNameToInsert, StreamWriter writer)
        {
            DataRow newInCnlRow = tblInCnl.NewRow();
            newInCnlRow["CnlNum"] = inCnl.CnlNum;
            newInCnlRow["Active"] = true;
            newInCnlRow["Name"] = kpNameToInsert + inCnl.CnlName;
            newInCnlRow["CnlTypeID"] = inCnl.CnlTypeID;
            newInCnlRow["ObjNum"] = objNum;
            newInCnlRow["KPNum"] = kpNum;
            newInCnlRow["Signal"] = inCnl.Signal;
            newInCnlRow["FormulaUsed"] = inCnl.FormulaUsed;
            newInCnlRow["Formula"] = inCnl.Formula;
            newInCnlRow["Averaging"] = inCnl.Averaging;
            newInCnlRow["ParamID"] = string.IsNullOrEmpty(inCnl.ParamName) ?
                DBNull.Value : (object)paramList[inCnl.ParamName];

            newInCnlRow["FormatID"] = DBNull.Value;
            if (inCnl.ShowNumber)
            {
                int ind = tblFormat.DefaultView.Find(new object[] { true, inCnl.DecDigits });
                if (ind >= 0)
                {
                    newInCnlRow["FormatID"] = tblFormat.DefaultView[ind]["FormatID"];
                }
                else
                {
                    writer.WriteLine(string.Format(
                        AppPhrases.NumFormatNotFound, inCnl.CnlNum, inCnl.DecDigits));
                }
            }
            else
            {
                int ind = tblFormat.DefaultView.Find(new object[] { false, DBNull.Value });
                if (ind >= 0)
                {
                    newInCnlRow["FormatID"] = tblFormat.DefaultView[ind]["FormatID"];
                }
                else
                {
                    writer.WriteLine(string.Format(AppPhrases.TextFormatNotFound, inCnl.CnlNum));
                }
            }

            newInCnlRow["UnitID"] = string.IsNullOrEmpty(inCnl.UnitName) ?
                DBNull.Value : (object)unitList[inCnl.UnitName];
            newInCnlRow["CtrlCnlNum"] =
                inCnl.CtrlCnlProps != null && inCnl.CtrlCnlProps.CtrlCnlNum > 0 ?
                    (object)inCnl.CtrlCnlProps.CtrlCnlNum : DBNull.Value;
            newInCnlRow["EvEnabled"] = inCnl.EvEnabled;
            newInCnlRow["EvSound"] = inCnl.EvSound;
            newInCnlRow["EvOnChange"] = inCnl.EvOnChange;
            newInCnlRow["EvOnUndef"] = inCnl.EvOnUndef;
            newInCnlRow["LimLowCrash"] = double.IsNaN(inCnl.LimLowCrash) ?
                DBNull.Value : (object)inCnl.LimLowCrash;
            newInCnlRow["LimLow"] = double.IsNaN(inCnl.LimLow) ?
                DBNull.Value : (object)inCnl.LimLow;
            newInCnlRow["LimHigh"] = double.IsNaN(inCnl.LimHigh) ?
                DBNull.Value : (object)inCnl.LimHigh;
            newInCnlRow["LimHighCrash"] = double.IsNaN(inCnl.LimHighCrash) ?
                DBNull.Value : (object)inCnl.LimHighCrash;
            newInCnlRow["ModifiedDT"] = DateTime.Now;

            return newInCnlRow;
        }