Example #1
0
        void BtnEditClick(object sender, System.EventArgs e)
        {
            listView1.Focus();
            PolicyForm dialog   = new PolicyForm();
            HostItem   hostitem = new HostItem();

            if (listView1.SelectedItems.Count > 0)
            {
                foreach (ListViewItem item in listView1.SelectedItems)
                {
                    string key = item.SubItems[1].Text;
                    hostitem = PLink.host.getHostItem(key);
                    break;
                }
            }

            dialog.Modify = true;
            if (hostitem.type == 0)
            {
                MessageBox.Show("Check Host!", "Alert");
                return;
            }

            dialog.SetHostItem(hostitem);
            if (dialog.ShowDialog(this) == DialogResult.OK)
            {
                PLink.host.removeHost(hostitem.Before);
                PLink.host.setHost(new HostItem(hostitem.Checked, dialog.TypeNo, dialog.Pattern, dialog.Change, dialog.Description));

                dialog.Init();
                reloadListView();
            }
        }
Example #2
0
        void BtnPlusPolicyClick(object sender, EventArgs e)
        {
            listView1.Focus();
            PolicyForm dialog   = new PolicyForm();
            HostItem   hostitem = new HostItem();

            if (listView1.SelectedItems.Count > 0)
            {
                foreach (ListViewItem item in listView1.SelectedItems)
                {
                    string key = item.SubItems[1].Text;
                    hostitem = PLink.host.getHostItem(key);
                    break;
                }
            }

            dialog.SetHostItem(hostitem);
            if (dialog.ShowDialog(this) == DialogResult.OK)
            {
                HostItem it = PLink.host.getHostItem(dialog.Pattern);
                if (it.type == 0)
                {
                    PLink.host.setHost(new HostItem(true, dialog.TypeNo, dialog.Pattern, dialog.Change, dialog.Description));
                    dialog.Init();

                    reloadListView();
                }
                else
                {
                    MessageBox.Show("Already same host exists : " + dialog.Pattern, "Error");
                }
            }
        }
Example #3
0
        void BtnPlusPolicyClick(object sender, EventArgs e)
        {
            listView1.Focus();
            PolicyForm dialog = new PolicyForm();
            HostItem hostitem = new HostItem();

            if (listView1.SelectedItems.Count > 0) {

                foreach (ListViewItem item in listView1.SelectedItems) {
                    string key = item.SubItems[1].Text;
                    hostitem = PLink.host.getHostItem(key);
                    break;
                }
            }

            dialog.SetHostItem(hostitem);
            if (dialog.ShowDialog(this) == DialogResult.OK) {

                HostItem it = PLink.host.getHostItem(dialog.Pattern);
                if (it.type == 0) {
                    PLink.host.setHost(new HostItem(true, dialog.TypeNo, dialog.Pattern, dialog.Change, dialog.Description));
                    dialog.Init();

                    reloadListView();
                } else {
                    MessageBox.Show("Already same host exists : " + dialog.Pattern, "Error");
                }
            }
        }
Example #4
0
        void BtnEditClick(object sender, System.EventArgs e)
        {
            listView1.Focus();
            PolicyForm dialog = new PolicyForm();
            HostItem hostitem = new HostItem();

            if (listView1.SelectedItems.Count > 0) {

                foreach (ListViewItem item in listView1.SelectedItems) {
                    string key = item.SubItems[1].Text;
                    hostitem = PLink.host.getHostItem(key);
                    break;
                }
            }

            dialog.Modify = true;
            if (hostitem.type == 0) {
                MessageBox.Show("Check Host!", "Alert");
                return ;
            }

            dialog.SetHostItem(hostitem);
            if (dialog.ShowDialog(this) == DialogResult.OK) {

                PLink.host.removeHost(hostitem.Before);
                PLink.host.setHost(new HostItem(hostitem.Checked, dialog.TypeNo, dialog.Pattern, dialog.Change, dialog.Description));

                dialog.Init();
                reloadListView();
            }
        }