private void LoadFormula()
        {
            List <TFormula> Formulas = TFormulaController.GetFormulas();

            foreach (TFormula Formula in Formulas)
            {
                this.FormulaVMs.Add(new TFormulaViewModel(Formula));
            }
        }
Пример #2
0
        private void btnTest_Click(object sender, RoutedEventArgs e)
        {
            //flowJumps = this.FlowJumps;
            ////按工序groupby flowjumps
            //IEnumerable<IGrouping<int, FlowJump>> query =
            //flowJumps.GroupBy(pet => pet.processID, pet => pet);
            //foreach (IGrouping<int, FlowJump> info in query)
            //{
            //    List<FlowJump> sl = info.ToList<FlowJump>();//分组后的集合
            //                                                //也可循环得到分组后,集合中的对象,你可以用info.Key去控制
            //                                                //foreach (FlowJump set in info)
            //                                                //{
            //                                                //}
            //}

            //List<TFormula> formulas = TFormulaController.GetFormulas();

            //IEnumerable<IGrouping<string, TFormula>> query =
            //    formulas.GroupBy(pet => pet.StrId, pet => pet);

            List <TFormula> formulas = TFormulaController.GetFormulas();

            //IEnumerable<IGrouping<string, List<TFormula>>> query =
            //    formulas.GroupBy(x => x.StrId).Select(x=>new List<IGrouping<string, List<TFormula>>> {});

            bool flag = true;

            var groupInfo = formulas.GroupBy(m => m.StrId).ToList();

            foreach (IGrouping <string, TFormula> info in groupInfo)
            {
                List <TFormula> s1 = info.ToList <TFormula>();

                foreach (TFormula f in s1)
                {
                    f.ColorFlag = flag;
                }

                flag = !flag;

                int j = 0;
            }


            int i = 0;

            //IEnumerable<IGrouping<string, List<TFormula>>> query =
            //    formulas.GroupBy(x => x.StrId).Select(x => new List<TFormula> { StrId = x.Key, Formulas = x.ToList() });

            // var groupTest = formulas.GroupBy(x => x.StrId).Select(x => new FormulaGroup { StrId = x.Key, Formulas = x.ToList() });


            TFormulaController.GetFormulaGroup();
        }