コード例 #1
0
        void AddAndSaveMruIp()
        {
            int i = 0;

            if (toolStripComboBox_Hostname.Text != "")
            {
                if (toolStripComboBox_Hostname.Items.Contains(toolStripComboBox_Hostname.Text))
                {
                    string s   = toolStripComboBox_Hostname.Text;
                    int    idx = toolStripComboBox_Hostname.Items.IndexOf(s);
                    toolStripComboBox_Hostname.Items.RemoveAt(idx);
                    toolStripComboBox_Hostname.Items.Insert(0, s);
                    toolStripComboBox_Hostname.SelectedIndex = 0;
                }
                else
                {
                    if (toolStripComboBox_Hostname.Items.Count >= maxHistory)
                    {
                        toolStripComboBox_Hostname.Items.RemoveAt(toolStripComboBox_Hostname.Items.Count - 1);
                    }
                    toolStripComboBox_Hostname.Items.Insert(0, toolStripComboBox_Hostname.Text);
                    toolStripComboBox_Hostname.SelectedIndex = 0;
                }
            }
            foreach (string s in toolStripComboBox_Hostname.Items)
            {
                ini.writeString("MruIp", "Ip" + i++, s);
            }
            i = 0;
        }
コード例 #2
0
        private void toolStripButtonConnParam_Click(object sender, EventArgs e)
        {
            try { isoPar = iedsDb[toolStripComboBox_Hostname.Text]; }
            catch { isoPar = null; }   // read parameters of the current ied
            if (isoPar == null)
            {
                isoPar          = new IsoConnectionParameters((IsoAcse.AcseAuthenticationParameter)null);
                isoPar.hostname = toolStripComboBox_Hostname.Text;
            }

            ConnParamDialog cd  = new ConnParamDialog(isoPar, iedsDb);
            DialogResult    res = cd.ShowDialog();

            if (res == System.Windows.Forms.DialogResult.OK)
            {
                StringDictionary std = new StringDictionary();
                isoPar.Save(std);   // Write parameters to dictionary
                foreach (string key in std.Keys)
                {
                    ieds.writeString(std["hostname"], key, std[key]);
                }
                iedsDb[std["hostname"]] = isoPar;
            }
        }