Пример #1
0
        /// <summary>
        /// Set up the form controls with the intial values from the model
        /// </summary>
        public void SetValues()
        {
            this.paramSet = StockList.MakeParamSet("");   // can use the param filename from component inits

            genoList.Clear();
            string[] genoNames = new string[genotypeInits.Length];
            for (int i = 0; i < genotypeInits.Length; i++)
            {
                genoNames[i] = genotypeInits[i].Name;
                genoList.AppendValues(genotypeInits[i].Name);
            }
            cbxGroupGenotype.Values = genoNames;        // animals tab

            GenotypeInitArgs args = new GenotypeInitArgs();

            args.Genotypes = genotypeInits;
            args.ParamSet  = this.paramSet;
            for (int idx = 0; idx < genotypeInits.Length; idx++)
            {
                args.index = idx;
                GetGenoParams.Invoke(null, args);   // gets params from the stock model

                if (this.genotypeSet != null)
                {
                    FGenotypeAnimals[idx] = this.genotypeSet.Animal;
                }
                else
                {
                    FGenotypeAnimals[idx] = GrazType.AnimalType.Sheep;
                }
            }
            FCurrGenotype = Math.Min(0, genotypeInits.Length - 1);
            FillCurrGenotype();

            FILLING = true;
            if (FCurrGenotype >= 0)
            {
                SelectedGenoIndex = FCurrGenotype;
            }
            FILLING = false;

            EnableButtons();
        }