コード例 #1
0
        private void HeaderMenuItem_Click(object sender, RoutedEventArgs e)
        {
            switch ((sender as MenuItem).Header as string)
            {
            case "新增":
                tapHeaderClear();
                break;

            case "修改":
                headerSelected = HeaderBox.SelectedIndex;
                if (headerSelected < 0)
                {
                    tapHeaderClear();
                    return;
                }
                var item = ViewModel.HeaderItems[headerSelected];
                HeaderTb.Text      = item.Name;
                HeaderValueTb.Text = item.Value;
                break;

            case "选中":
                var items = new HeaderItem[HeaderBox.SelectedItems.Count];
                HeaderBox.SelectedItems.CopyTo(items, 0);
                ListExtension.Remove(ViewModel.HeaderItems, items);
                break;

            case "全部":
                ViewModel.HeaderItems.Clear();
                break;

            default:
                break;
            }
        }
コード例 #2
0
        private void RuleMenuItem_Click(object sender, RoutedEventArgs e)
        {
            switch ((sender as MenuItem).Header as string)
            {
            case "选中":
                var items = new RuleGroupItem[RuleBox.SelectedItems.Count];
                RuleBox.SelectedItems.CopyTo(items, 0);
                ListExtension.Remove(ViewModel.RuleItems, items);
                break;

            case "全部":
                ViewModel.RuleItems.Clear();
                break;

            default:
                break;
            }
        }
コード例 #3
0
        private void MenuItem_Click(object sender, RoutedEventArgs e)
        {
            switch ((sender as MenuItem).Header as string)
            {
            case "新增":
                tapClear();
                break;

            case "修改":
                var item = ViewModel.RuleItems[RuleBox.SelectedIndex];
                ViewModel.SelectedIndex = RuleBox.SelectedIndex;
                PluginCb.SelectedIndex  = ViewModel.PluginIndexOf(item.Name);
                Param2Tb.Text           = item.Param2;
                Param1Tb.Text           = item.Param1;
                break;

            case "上移":
                ViewModel.MoveUp(RuleBox.SelectedIndex);
                break;

            case "下移":
                ViewModel.MoveDown(RuleBox.SelectedIndex);
                break;

            case "选中":
                var items = new RuleItem[RuleBox.SelectedItems.Count];
                RuleBox.SelectedItems.CopyTo(items, 0);
                ListExtension.Remove(ViewModel.RuleItems, items);
                break;

            case "全部":
                ViewModel.RuleItems.Clear();
                break;

            default:
                break;
            }
        }