private void buttonChooseFile_Click(object sender, EventArgs e)
 {
     storage = utils.getInfoStorage();
     if (storage != null)
     {
         checkFileIsCorrect();
         setRadioButton();
     }
 }
        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);
        }
        private void buttonCreateNewConfiguration_Click(object sender, EventArgs e)
        {
            if (storage != null && storage.instanceOrType != 0 && MessageBox.Show("При создании нового конфигурационного файла, старый будет удалён!", "Внимание!", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.Cancel)
            {
                return;
            }

            if (allCats == null)
            {
                allCats = new List <BuiltInCategory>();
                foreach (var item in Enum.GetValues(typeof(BuiltInCategory)))
                {
                    allCats.Add((BuiltInCategory)item);
                }
                allCats.Sort((x, y) => x.ToString().CompareTo(y.ToString()));
            }
            this.Hide();
            storage = new InfosStorage();
            form    = new MainWindow(this, storage, allCats);
            form.ShowDialog();
        }