コード例 #1
0
        private void Click_Button_AddCondtion(object sender, RoutedEventArgs e)
        {
            if (ucCondition1 == null)
            {
                if (ComboBox_SelectCondition.SelectedValue != null)
                {
                    switch ((ComboBox_SelectCondition.SelectedValue as ComboBoxItem).Content.ToString())
                    {
                    case "Find":
                        ucCondition1 = new UCOptimizeScriptEntryFind();
                        break;

                    case "If":
                        ucCondition1 = new UCOptimizeScriptEntryIF();
                        break;

                    case "Find same char in a row":
                        ucCondition1 = new UCOptimizeScriptEntrySameChars();
                        break;

                    case "Find number":
                        ucCondition1 = new UCOptimizeScriptEntryFindNumber();
                        break;

                    default:
                        ucCondition1 = new UCOptimizeScriptEntryFind();
                        break;
                    }
                }
                else
                {
                    ucCondition1 = new UCOptimizeScriptEntryFind();
                }


                ParentPanel_Condition1.Children.Add(ucCondition1);
            }
            else if (ucCondition2 == null)
            {
                if (ucCondition1.GetType() == typeof(UCOptimizeScriptEntryIF))
                {
                    if (ComboBox_SelectCondition.SelectedValue != null)
                    {
                        switch ((ComboBox_SelectCondition.SelectedValue as ComboBoxItem).Content.ToString())
                        {
                        case "Find":
                            ucCondition2 = new UCOptimizeScriptEntryFind();
                            break;

                        case "If":
                            ucCondition2 = new UCOptimizeScriptEntryIF();
                            break;

                        case "Find same char in a row":
                            ucCondition2 = new UCOptimizeScriptEntrySameChars();
                            break;

                        case "Find number":
                            ucCondition2 = new UCOptimizeScriptEntryFindNumber();
                            break;

                        default:
                            ucCondition2 = new UCOptimizeScriptEntryFind();
                            break;
                        }
                    }

                    if (ucCondition2 != null)
                    {
                        ParentPanel_Condition2.Children.Add(ucCondition2);
                    }
                }
                else
                {
                    MessageBox.Show("Only possible after first condition = If");
                }
            }
        }
コード例 #2
0
 private void Click_Button_RemoveCondition2(object sender, RoutedEventArgs e)
 {
     ParentPanel_Condition2.Children.Remove(ucCondition2);
     ucCondition2 = null;
 }