コード例 #1
0
        public ExerciseInformation()
        {
            InitializeComponent();

            var panel = new StackPanel();

            using (ExerciseContext db = new ExerciseContext())
            {
                db.Exercises.Load();
                var list = db.Exercises.Local.ToBindingList();
                foreach (var item in list)
                {
                    var a = new Exercise_block_learn(item, this);
                    panel.Children.Add(a);
                }
            }
            this.List_train.Content = panel;
        }
コード例 #2
0
        private void Button_Click_Search(object sender, RoutedEventArgs e)
        {
            var             panel  = new StackPanel();
            List <Exercise> search = new List <Exercise>();

            using (ExerciseContext db = new ExerciseContext())
            {
                db.Exercises.Load();
                var list = db.Exercises.Local.ToBindingList();

                if (this.Search_name.Text != "")
                {
                    string ser_name;
                    ser_name = this.Search_name.Text;
                    Regex text = new Regex(ser_name, RegexOptions.IgnoreCase);
                    foreach (var item in list)
                    {
                        string          line    = item.Name_ex.ToString();
                        MatchCollection matches = text.Matches(line);
                        if (matches.Count > 0)
                        {
                            search.Add(item);
                        }
                    }
                }
                if (Groupe_num != 0)
                {
                    if (search.Count != 0)
                    {
                        List <Exercise> search_step = new List <Exercise>();
                        foreach (var item in search)
                        {
                            search_step.Add(item);
                        }
                        search.Clear();
                        foreach (var item in search_step)
                        {
                            if (item.Groupe == Groupe_num)
                            {
                                search.Add(item);
                            }
                        }
                    }
                    else
                    {
                        foreach (var item in list)
                        {
                            if (item.Groupe == Groupe_num)
                            {
                                search.Add(item);
                            }
                        }
                    }
                }
                if (Intensity_num != 0)
                {
                    if (search.Count != 0)
                    {
                        List <Exercise> search_step = new List <Exercise>();

                        foreach (var item in search)
                        {
                            search_step.Add(item);
                        }
                        search.Clear();
                        foreach (var item in search_step)
                        {
                            if (item.Intensity == Intensity_num)
                            {
                                search.Add(item);
                            }
                        }
                    }
                    else
                    {
                        foreach (var item in list)
                        {
                            if (item.Intensity == Intensity_num && Groupe_num == 0)
                            {
                                search.Add(item);
                            }
                        }
                    }
                }
            }


            foreach (var item in search)
            {
                var a = new Exercise_block_learn(item, this);

                panel.Children.Add(a);
            }
            this.List_train.Content = panel;

            this.Groupe_1.Background = new SolidColorBrush(Color.FromRgb(67, 67, 67));
            this.Groupe_1.Foreground = new SolidColorBrush(Color.FromRgb(222, 222, 222));

            this.Groupe_2.Background = new SolidColorBrush(Color.FromRgb(67, 67, 67));
            this.Groupe_2.Foreground = new SolidColorBrush(Color.FromRgb(222, 222, 222));

            this.Groupe_3.Background = new SolidColorBrush(Color.FromRgb(67, 67, 67));
            this.Groupe_3.Foreground = new SolidColorBrush(Color.FromRgb(222, 222, 222));

            this.Groupe_4.Background = new SolidColorBrush(Color.FromRgb(67, 67, 67));
            this.Groupe_4.Foreground = new SolidColorBrush(Color.FromRgb(222, 222, 222));

            this.Button_intens_one.Background   = new SolidColorBrush(Color.FromRgb(67, 67, 67));
            this.Button_intens_two.Background   = new SolidColorBrush(Color.FromRgb(67, 67, 67));
            this.Button_intens_three.Background = new SolidColorBrush(Color.FromRgb(67, 67, 67));

            Groupe_num    = 0;
            Intensity_num = 0;
        }