Ejemplo n.º 1
0
 private void m_pRules_Rules_DoubleClick(object sender, EventArgs e)
 {
     if(m_pRules_Rules.SelectedItems.Count > 0){
         UserMessageRule rule = (UserMessageRule)m_pRules_Rules.SelectedItems[0].Tag;
         wfrm_User_MessageRule frm = new wfrm_User_MessageRule(
             m_pUser,
             rule
         );
         if(frm.ShowDialog(this) == DialogResult.OK){
             LoadRules(rule.ID);
         }
     }
 }
Ejemplo n.º 2
0
        private void m_pTab_Rules_Toolbar_ItemClicked(object sender,ToolStripItemClickedEventArgs e)
        {
            if(e.ClickedItem.Tag == null){
                return;
            }

            if(e.ClickedItem.Tag.ToString() == "add"){
                wfrm_User_MessageRule frm = new wfrm_User_MessageRule(m_pUser);
                if(frm.ShowDialog(this) == DialogResult.OK){
                    LoadRules(frm.RuleID);
                }
            }
            else if(e.ClickedItem.Tag.ToString() == "edit"){
                UserMessageRule rule = (UserMessageRule)m_pRules_Rules.SelectedItems[0].Tag;
                wfrm_User_MessageRule frm = new wfrm_User_MessageRule(
                    m_pUser,
                    rule
                );
                if(frm.ShowDialog(this) == DialogResult.OK){
                    LoadRules(rule.ID);
                }
            }
            else if(e.ClickedItem.Tag.ToString() == "delete"){
                UserMessageRule rule = (UserMessageRule)m_pRules_Rules.SelectedItems[0].Tag;
                if(MessageBox.Show(this,"Are you sure you want to delete Rule '" + rule.Description + "' !","Confirm Delete",MessageBoxButtons.YesNo,MessageBoxIcon.Question,MessageBoxDefaultButton.Button2) == DialogResult.Yes){
                    rule.Owner.Remove(rule);
                    LoadRules("");
                }
            }
            else if(e.ClickedItem.Tag.ToString() == "up"){
                if(m_pRules_Rules.SelectedItems.Count > 0 && m_pRules_Rules.SelectedItems[0].Index > 0){
                    SwapRules(m_pRules_Rules.SelectedItems[0],m_pRules_Rules.Items[m_pRules_Rules.SelectedItems[0].Index - 1]);
                }
            }
            else if(e.ClickedItem.Tag.ToString() == "down"){
                if(m_pRules_Rules.SelectedItems.Count > 0 && m_pRules_Rules.SelectedItems[0].Index < m_pRules_Rules.Items.Count - 1){
                    SwapRules(m_pRules_Rules.SelectedItems[0],m_pRules_Rules.Items[m_pRules_Rules.SelectedItems[0].Index + 1]);
                }
            }
        }