Example #1
0
        private void NewButtonClick(object sender, RoutedEventArgs e)
        {
            CreationWindows newWindows = new CreationWindows(this._memberVM.Save) //on importe la sauvegarde pour la modifier dans la fonction
            {
                WindowStartupLocation = WindowStartupLocation.CenterScreen
            };

            newWindows.ShowDialog();
            //this._memberVM.

            if (this._memberSelected)
            {
                this._memberVM.SelectedUserControl = new MemberListUserControl(this._memberVM.Sort(), this._memberVM.Save);
            }
            else
            {
                this._memberVM.SelectedUserControl = new EmployeeListUserControl(this._memberVM.Sort(), this._memberVM.Save);
            }
        }
Example #2
0
        private Grid GetGrid(People people)
        {
            Grid grid = new Grid()
            {
                Margin            = new Thickness(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      = new SolidColorBrush(Colors.Green),
                BorderThickness = new Thickness(0),
                MaxHeight       = 15,
                MaxWidth        = 15,
                Margin          = new Thickness(5)
            };

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

                InitializeList(this._save.Peoples);
            };

            Button delet = new Button()
            {
                Background      = new SolidColorBrush(Colors.Red),
                BorderThickness = new Thickness(0),
                MaxHeight       = 15,
                MaxWidth        = 15,
                Margin          = new Thickness(5)
            };

            delet.Click += (s, e) =>
            {
                Data data = new Data();
                data.Load();
                this._save.Peoples.Remove(people);
                data.AddSave(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);
        }
Example #3
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);
        }