Beispiel #1
0
 public ConfigurationForm(ClassificatorForm classificatorForm)
 {
     InitializeComponent();
     this.classificatorForm = classificatorForm;
     boxes = new List <GroupBoxRules>();
     boxes.Add(new GroupBoxRules(groupBox, new List <GroupBox>()
     {
         groupBoxValueField
     }));
     rulesCount = 1;
 }
        public MainWindow(ClassificatorForm classificatorForm, InfosStorage storage, List <BuiltInCategory> allCats)
        {
            InitializeComponent();
            this.classificatorForm                = classificatorForm;
            this.storage                          = storage;
            this.ruleItems                        = new ObservableCollection <RuleItem>();
            this.Collection.ItemsSource           = ruleItems;
            this.settings                         = new Settings();
            this.CollectionParamNames.ItemsSource = settings.paramNameItems;
            RuleItem.builtInCats                  = allCats;
            this.checkedExit                      = true;

            if (storage.classificator == null)
            {
                this.storage.classificator  = new List <Classificator>();
                this.storage.instanseParams = new List <string>();
                RuleItem firstRuleItem = new RuleItem("", "", BuiltInCategory.INVALID);
                firstRuleItem.addValueOfParam("Пустое значение параметра");
                ruleItems.Add(firstRuleItem);
                settings.addParamName("Введите имя параметра");
            }
            else
            {
                if (storage.instanceOrType == 1)
                {
                    InstanceRadioButton.IsChecked = true;
                }
                else if (storage.instanceOrType == 2)
                {
                    TypeRadioButton.IsChecked = true;
                }
                foreach (var item in storage.classificator)
                {
                    RuleItem ruleItem = new RuleItem(item.FamilyName, item.TypeName, item.BuiltInName);
                    foreach (var pv in item.paramsValues)
                    {
                        ruleItem.addValueOfParam(pv);
                    }
                    ruleItem.colourOfRule = "#4C87B3";
                    ruleItems.Add(ruleItem);
                }
                foreach (var item in storage.instanseParams)
                {
                    settings.addParamName(item);
                }
            }

            refreshNumbersOfRules(ruleItems);
        }