示例#1
0
 private void m_pRules_DoubleClick(object sender, EventArgs e)
 {
     if (this.m_pRules.SelectedItems.Count > 0)
     {
         GlobalMessageRule            globalMessageRule            = (GlobalMessageRule)this.m_pRules.SelectedItems[0].Tag;
         AddEditGlobalMessageRuleForm addEditGlobalMessageRuleForm = new AddEditGlobalMessageRuleForm(this.m_pVirtualServer, globalMessageRule);
         if (addEditGlobalMessageRuleForm.ShowDialog(this) == DialogResult.OK)
         {
             this.LoadRules(globalMessageRule.ID);
         }
     }
 }
示例#2
0
 private void SwitchToolBarTask(string taskID)
 {
     if (taskID == "add")
     {
         AddEditGlobalMessageRuleForm addEditGlobalMessageRuleForm = new AddEditGlobalMessageRuleForm(this.m_pVirtualServer);
         if (addEditGlobalMessageRuleForm.ShowDialog(this) == DialogResult.OK)
         {
             this.LoadRules("");
             return;
         }
     }
     else if (taskID == "edit")
     {
         GlobalMessageRule            globalMessageRule             = (GlobalMessageRule)this.m_pRules.SelectedItems[0].Tag;
         AddEditGlobalMessageRuleForm addEditGlobalMessageRuleForm2 = new AddEditGlobalMessageRuleForm(this.m_pVirtualServer, globalMessageRule);
         if (addEditGlobalMessageRuleForm2.ShowDialog(this) == DialogResult.OK)
         {
             this.LoadRules(globalMessageRule.ID);
             return;
         }
     }
     else if (taskID == "delete")
     {
         GlobalMessageRule globalMessageRule2 = (GlobalMessageRule)this.m_pRules.SelectedItems[0].Tag;
         if (MessageBox.Show(this, "Are you sure you want to delete Rule '" + globalMessageRule2.Description + "' !", "Confirm Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
         {
             globalMessageRule2.Owner.Remove(globalMessageRule2);
             this.m_pRules.SelectedItems[0].Remove();
             return;
         }
     }
     else
     {
         if (taskID == "refresh")
         {
             this.LoadRules("");
             return;
         }
         if (taskID == "up")
         {
             if (this.m_pRules.SelectedItems.Count > 0 && this.m_pRules.SelectedItems[0].Index > 0)
             {
                 this.SwapRules(this.m_pRules.SelectedItems[0], this.m_pRules.Items[this.m_pRules.SelectedItems[0].Index - 1]);
                 return;
             }
         }
         else if (taskID == "down" && this.m_pRules.SelectedItems.Count > 0 && this.m_pRules.SelectedItems[0].Index < this.m_pRules.Items.Count - 1)
         {
             this.SwapRules(this.m_pRules.SelectedItems[0], this.m_pRules.Items[this.m_pRules.SelectedItems[0].Index + 1]);
         }
     }
 }