コード例 #1
0
        public SamplingFormVM(StudyUnitVM studyUnit)
            : base(studyUnit)
        {
            samplings = new ObservableCollection <SamplingVM>();

            //change how to name the title
            //*Find the unique title like unsed
            //*The title such as Concept and Amount can be changed manually,
            //Cannot do here
            HashSet <string> titles = Sampling.CollectTitles(studyUnit.SamplingModels);

            foreach (Sampling samplingModel in studyUnit.SamplingModels)
            {
                int        uniqIndex = EDOUtils.UniqOrderNo(titles, samplingModel.Title, PREFIX);
                SamplingVM sampling  = new SamplingVM(samplingModel)
                {
                    Parent      = this,
                    OrderNo     = uniqIndex,
                    OrderPrefix = PREFIX
                };
                sampling.Init();
                samplings.Add(sampling);
                titles.Add(sampling.Title); //Add in title set.
            }
            modelSyncher = new ModelSyncher <SamplingVM, Sampling>(this, samplings, studyUnit.SamplingModels);
        }
コード例 #2
0
        public void AddSampling()
        {
            HashSet <string> titles = Sampling.CollectTitles(StudyUnit.SamplingModels);
            int uniqIndex           = EDOUtils.UniqOrderNo(titles, null, PREFIX);

            SamplingVM sampling = new SamplingVM();

            sampling.Parent      = this;
            sampling.OrderNo     = uniqIndex;
            sampling.OrderPrefix = PREFIX;
            sampling.Init();
            samplings.Add(sampling);
            SelectedSamplingItem = sampling;
            Memorize();
        }