Exemplo n.º 1
0
        public static void AddHost(string ip, string name, string desc, bool use, bool addLine)
        {
            List <HostItem> hosts = HostsDal.GetHosts("");
            HostItem        item  = new HostItem(ip, name, desc, use, addLine);

            hosts.Add(item);
            HostsDal.SaveHosts("", hosts);
        }
Exemplo n.º 2
0
        private void SaveHistoryToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string          name     = ((ToolStripMenuItem)sender).Text.Split(new char[] { ' ' })[1];
            List <HostItem> gridHost = this.GetGridHost();

            if (gridHost != null)
            {
                HostsDal.SaveHosts(name, gridHost);
            }
        }
Exemplo n.º 3
0
        private void SaveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            List <HostItem> gridHost = this.GetGridHost();

            if (gridHost != null)
            {
                HostsDal.SaveHosts(string.Empty, gridHost);
                this.BindHosts(string.Empty);
                MessageBox.Show("应用成功");
            }
        }
Exemplo n.º 4
0
        private void SaveAsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string str = Interaction.InputBox("请输入快捷方式名", "请输入快捷方式名", "", 100, 100);

            if (!string.IsNullOrEmpty(str) && (!File.Exists(HostsDal.GetFileName(str)) || (MessageBox.Show("快捷方式文件已存在,是否覆盖?", "文件已存在", MessageBoxButtons.YesNo) == DialogResult.Yes)))
            {
                List <HostItem> gridHost = this.GetGridHost();
                if (gridHost != null)
                {
                    HostsDal.SaveHosts(str, gridHost);
                    this.BindHistory();
                }
            }
        }