Exemplo n.º 1
0
        private async void GetTeamDataAsync(ChampionshipType championshipType)
        {
            switch (championshipType)
            {
            case ChampionshipType.Male:
                RepresentationRepo = new MaleRepresentation();
                break;

            case ChampionshipType.Female:
                RepresentationRepo = new FemaleRepresentation();
                break;
            }

            Cursor = Cursors.WaitCursor;
            RepresentationsData = (List <Representation>) await RepresentationRepo.GetAllTeams();

            Cursor = Cursors.Default;

            if (RepresentationsData == null)
            {
                MessageBox.Show("Unable to fetch player data");
            }
            else
            {
                RepresentationsData.Sort();
                FillRepresentationCombobox();
            }
        }
Exemplo n.º 2
0
        public static void SavePlayersToFile(List <PlayerVM> playersData, ChampionshipType championshipType, Representation representation, string filePath)
        {
            var jsonString = JsonConvert.SerializeObject(new PlayersSaveFile {
                Players = playersData, ChampionshipType = championshipType, Representation = representation
            });

            File.WriteAllText(filePath, jsonString);
        }
Exemplo n.º 3
0
        public static void SaveSettings(ChampionshipType championshipType, string filePath)
        {
            Settings settings = new Settings(Thread.CurrentThread.CurrentUICulture.Name, championshipType);

            string serializedString = JsonConvert.SerializeObject(settings);

            File.WriteAllText(filePath, serializedString);
        }
Exemplo n.º 4
0
        public RepresentationWindow(ChampionshipType championshipType)
        {
            InitializeComponent();

            ChampionshipType = championshipType;

            FillCbChampionship();

            LoadCbRepresentations();
        }
Exemplo n.º 5
0
 public static string Translate(ChampionshipType type)
 {
     if (type == ChampionshipType.ZawodyWyciskanieSztangi)
     {
         return(InstructorStrings.ChampionshipType_ZawodyWyciskanieSztangi);
     }
     else
     {
         return(InstructorStrings.ChampionshipType_Trojboj);
     }
 }
Exemplo n.º 6
0
        public static void SavePlayersToFile(List <Player> playersData, ChampionshipType championshipType, Representation representation, string filePath)
        {
            List <PlayerVM> players = new List <PlayerVM>();

            foreach (var player in playersData)
            {
                players.Add(new PlayerVM {
                    Player = player
                });
            }

            var jsonString = JsonConvert.SerializeObject(new PlayersSaveFile {
                Players = players, ChampionshipType = championshipType, Representation = representation
            });

            File.WriteAllText(filePath, jsonString);
        }
Exemplo n.º 7
0
 private void OpenChampionshipForm(ChampionshipType championshipType)
 {
     this.Hide();
     new PlayersForm(championshipType).Show();
 }
 public RepresentationSaveFile(Representation representation, ChampionshipType championshipType)
 {
     Representation   = representation;
     ChampionshipType = championshipType;
 }
Exemplo n.º 9
0
 public PlayersForm(ChampionshipType championshipType)
 {
     InitializeComponent();
     ChampionshipType = championshipType;
 }
Exemplo n.º 10
0
 public Settings(string language, ChampionshipType championshipType)
 {
     Language         = language;
     ChampionshipType = championshipType;
 }
Exemplo n.º 11
0
        public void BuildColumns(ChampionshipType championshipType)
        {
            EnsureNotEditMode();
            Columns.Clear();

            DataGridTemplateColumn colOptions = new DataGridTemplateColumn();

            colOptions.Width        = DataGridLength.Auto;
            colOptions.CellTemplate = (DataTemplate)this.FindResource("ButtonsColumn");
            colOptions.IsReadOnly   = true;
            Columns.Add(colOptions);

            DataGridTemplateColumn colCustomer = new DataGridTemplateColumn();

            colCustomer.Width          = DataGridLength.SizeToCells;
            colCustomer.MinWidth       = 100;
            colCustomer.SortDirection  = ListSortDirection.Ascending;
            colCustomer.SortMemberPath = "Customer.FullName";
            colCustomer.Header         = InstructorStrings.ChampionshipDataGrid_Grid_Customer;
            colCustomer.CellTemplate   = (DataTemplate)this.FindResource("customerColumn");
            colCustomer.IsReadOnly     = true;
            Columns.Add(colCustomer);


            DataGridTemplateColumn colGroup = new DataGridTemplateColumn();

            colGroup.Header              = InstructorStrings.ChampionshipDataGrid_Grid_Team;
            colGroup.SortMemberPath      = "SelectedGroup.Text";
            colGroup.CellTemplate        = (DataTemplate)this.FindResource("GroupViewColumn");
            colGroup.CellEditingTemplate = (DataTemplate)this.FindResource("GroupColumn");
            colGroup.Width    = DataGridLength.SizeToCells;
            colGroup.MinWidth = 70;
            Columns.Add(colGroup);

            DataGridTemplateColumn colComment = new DataGridTemplateColumn();

            colComment.Header              = InstructorStrings.ChampionshipDataGrid_Grid_Comment;
            colComment.SortMemberPath      = "Comment";
            colComment.CellTemplate        = (DataTemplate)this.FindResource("commentViewColumn");
            colComment.CellEditingTemplate = (DataTemplate)this.FindResource("commentEditColumn");
            colComment.Width    = DataGridLength.SizeToHeader;
            colComment.MinWidth = 100;
            Columns.Add(colComment);

            DataGridTemplateColumn colWeight = new DataGridTemplateColumn();

            colWeight.Width               = DataGridLength.SizeToCells;
            colWeight.SortMemberPath      = "Weight";
            colWeight.MinWidth            = 70;
            colWeight.Header              = InstructorStrings.ChampionshipDataGrid_Grid_Weight;
            colWeight.CellTemplate        = (DataTemplate)this.FindResource("wagaViewColumn");
            colWeight.CellEditingTemplate = (DataTemplate)this.FindResource("wagaEditColumn");
            Columns.Add(colWeight);

            DataGridTemplateColumn colExercise1 = new DataGridTemplateColumn();

            colExercise1.Width               = new DataGridLength(1, DataGridLengthUnitType.Star);
            colExercise1.MinWidth            = 100;
            colExercise1.HeaderTemplate      = createExerciseHeader(ExercisesReposidory.Instance.BenchPress.Name);
            colExercise1.CellTemplate        = createContentPresenterTemplate("exerciseCellView", "Exercise1");
            colExercise1.CellEditingTemplate = createContentPresenterTemplate("exerciseCellEdit", "Exercise1");
            Columns.Add(colExercise1);

            if (championshipType == ChampionshipType.Trojboj)
            {
                DataGridTemplateColumn colExercise2 = new DataGridTemplateColumn();
                colExercise2.Width               = new DataGridLength(1, DataGridLengthUnitType.Star);
                colExercise2.MinWidth            = 60;
                colExercise2.HeaderTemplate      = createExerciseHeader(ExercisesReposidory.Instance.Deadlift.Name);
                colExercise2.CellTemplate        = createContentPresenterTemplate("exerciseCellView", "Exercise2");
                colExercise2.CellEditingTemplate = createContentPresenterTemplate("exerciseCellEdit", "Exercise2");
                Columns.Add(colExercise2);

                DataGridTemplateColumn colExercise3 = new DataGridTemplateColumn();
                colExercise3.Width               = new DataGridLength(1, DataGridLengthUnitType.Star);
                colExercise3.MinWidth            = 60;
                colExercise3.HeaderTemplate      = createExerciseHeader(ExercisesReposidory.Instance.Sqad.Name);
                colExercise3.CellTemplate        = createContentPresenterTemplate("exerciseCellView", "Exercise3");
                colExercise3.CellEditingTemplate = createContentPresenterTemplate("exerciseCellEdit", "Exercise3");
                Columns.Add(colExercise3);
            }
        }