예제 #1
0
        private TreeNode selNode; // выбранный узел дерева

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Конструктор
        /// </summary>
        public FrmDevTemplate()
        {
            InitializeComponent();

            devTemplate = new Modbus.DeviceModel();
            modified = false;
            fileName = "";
            selElemGroup = null;
            selElemInfo = null;
            selCmd = null;
            selNode = null;
            grsNode = treeView.Nodes["grsNode"];
            cmdsNode = treeView.Nodes["cmdsNode"];
            procChangedEv = false;

            ConfigDir = "";
            LangDir = "";
        }
예제 #2
0
        private void btnOpen_Click(object sender, EventArgs e)
        {
            // открытие шаблона устройства из файла
            if (CheckChanges())
            {
                openFileDialog.FileName = "";

                if (openFileDialog.ShowDialog() == DialogResult.OK)
                {
                    saveFileDialog.FileName = openFileDialog.FileName;
                    Modbus.DeviceModel templ = new Modbus.DeviceModel();
                    string errMsg;

                    if (templ.LoadTemplate(openFileDialog.FileName, out errMsg))
                    {
                        devTemplate = templ;
                        fileName = openFileDialog.FileName;
                        FillTree();
                    }
                    else
                    {
                        ScadaUtils.ShowError(errMsg);
                    }
                }
            }
        }
예제 #3
0
 private void btnNew_Click(object sender, EventArgs e)
 {
     // создание шаблона устройства
     if (CheckChanges())
     {
         saveFileDialog.FileName = "";
         devTemplate = new Modbus.DeviceModel();
         fileName = "";
         FillTree();
     }
 }