Esempio n. 1
0
        private SolidColorBrush GenderBackGround(GenderEnum genderEnum)
        {
            SolidColorBrush solidColor = new SolidColorBrush();

            switch (genderEnum)
            {
            case GenderEnum.man:
                solidColor = SolidColorBrushHelper.Blue();
                break;

            case GenderEnum.woman:
                solidColor = SolidColorBrushHelper.Red();
                break;

            case GenderEnum.other:
                solidColor = SolidColorBrushHelper.LightGreen();
                break;
            }
            return(solidColor);
        }
Esempio n. 2
0
        private Grid GetGrid(People people)
        {
            Grid grid = new Grid()
            {
                Margin            = new Thickness(0.5, 1, 0.5, 1),
                Background        = new SolidColorBrush(Colors.White),
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                }
            };

            Button change = new Button()
            {
                Background      = SolidColorBrushHelper.LightGreen(),
                BorderThickness = new Thickness(0),
                Margin          = MARGINENUMCOLOR,
                Content         = GetTextBlock("Modifier", new Thickness(0)),
                Foreground      = new SolidColorBrush(Colors.White),
            };

            change.Click += (s, e) =>
            {
                CreationWindows newWindows = new CreationWindows(this._save, people, true)
                {
                    WindowStartupLocation = WindowStartupLocation.CenterScreen
                };
                newWindows.ShowDialog();
                //Save = newWindows.CreationVM.Save;

                InitializeList(this._save.Peoples);
            };

            Button delet = new Button()
            {
                Background      = SolidColorBrushHelper.Red(),
                BorderThickness = new Thickness(0),
                Margin          = MARGINENUMCOLOR,
                Content         = GetTextBlock("Supprimer", new Thickness(0)),
                Foreground      = new SolidColorBrush(Colors.White),
            };

            delet.Click += (s, e) =>
            {
                Data data = new Data();
                data.Load();
                this._save.Peoples.Remove(people);
                data.AddSave(this._save);

                //Save = this._save;
                data.Write();
                InitializeList(this._save.Peoples);
            };

            grid.Children.Add(change);
            grid.Children.Add(delet);

            Grid.SetColumn(change, 0);
            Grid.SetColumn(delet, 1);

            return(grid);
        }