Exemplo n.º 1
0
        public async Task LoadState()
        {
            DeleteButtonEd.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
            FootballMatch Data = await DataSource.GetItemAsync(activId);

            dataGroupsRCPlayer = new ObservableCollection <DataGroupRCPlayers>();
            foreach (RedCard mp in Data.redcards)
            {
                DataGroupRCPlayers dp = null;
                if (mp.objectStatus != (int)DataSource.status.Deleted || mp.objectStatus != (int)DataSource.status.needDelete)
                {
                    if (mp.Team_idValue == Data.team1.id)
                    {
                        var matches = Data.team1_players.Where((player) => player.id.Equals(mp.Player_idValue));
                        if (matches.Count() > 0)
                        {
                            dp           = new DataGroupRCPlayers(Data, Data.team1, matches.First(), mp);
                            dp.firstTeam = true;
                        }
                    }
                    else
                    {
                        var matches = Data.team2_players.Where((player) => player.id.Equals(mp.Player_idValue));
                        if (matches.Count() > 0)
                        {
                            dp           = new DataGroupRCPlayers(Data, Data.team2, matches.First(), mp);
                            dp.firstTeam = false;
                        }
                    }
                    if (dp != null)
                    {
                        dataGroupsRCPlayer.Add(dp);
                    }
                }
            }
            this.DefaultViewModel["Match"] = Data;
            if (dataGroupsRCPlayer.Count() > 0)
            {
                this.DefaultViewModel["ActivElement"]          = dataGroupsRCPlayer.First();
                this.DefaultViewModel["dataGroupsMatchPlayer"] = dataGroupsRCPlayer;
                this.DefaultViewModel["Team1MatchPlayers"]     = dataGroupsRCPlayer.Where((team) => team.team.id.Equals(Data.team1.id));
                this.DefaultViewModel["Team2MatchPlayers"]     = dataGroupsRCPlayer.Where((team) => team.team.id.Equals(Data.team2.id));
            }
            if (TeamComboBox.SelectedIndex == 0)
            {
                if (this.DefaultViewModel.ContainsKey("Team1MatchPlayers"))
                {
                    mainListView.ItemsSource = this.DefaultViewModel["Team1MatchPlayers"];
                }
            }
            else
            {
                if (this.DefaultViewModel.ContainsKey("Team2MatchPlayers"))
                {
                    mainListView.ItemsSource = this.DefaultViewModel["Team2MatchPlayers"];
                }
            }
        }
Exemplo n.º 2
0
        private void GroupSection_ItemClick(object sender, ItemClickEventArgs e)
        {
            //var groupId = ((SampleDataGroup)e.ClickedItem).UniqueId;
            //if (!Frame.Navigate(typeof(SectionPage), groupId))
            //{
            //    throw new Exception(this.resourceLoader.GetString("NavigationFailedExceptionMessage"));
            //}
            // var itemId = ((FootballMatch)e.ClickedItem).id;
            //Frame.Navigate(typeof(ItemPage), itemId);
            this.DefaultViewModel["ActivElement"] = (DataGroupRCPlayers)e.ClickedItem;
            ActiveDataGroupRCPlayersItem          = (DataGroupRCPlayers)e.ClickedItem;
            viewPanel.Visibility      = Windows.UI.Xaml.Visibility.Collapsed;
            editorPanel.Visibility    = Windows.UI.Xaml.Visibility.Visible;
            DeleteButtonEd.Visibility = Windows.UI.Xaml.Visibility.Visible;
            AcceptButtonEd.Content    = "Изменить";
            editorPanel.Tag           = "Edit";
            if (ActiveDataGroupRCPlayersItem.firstTeam)
            {
                TeamComboBoxEd.SelectedIndex = 0;
            }
            else
            {
                TeamComboBoxEd.SelectedIndex = 1;
            }
            PlayerComboBoxEd.SelectedItem = ActiveDataGroupRCPlayersItem.player;

            NoteTextBox.Text            = ActiveDataGroupRCPlayersItem.redCard.NoteValue;
            MinuteTextBox.Text          = ActiveDataGroupRCPlayersItem.redCard.MinuteValue.ToString();
            AdditionMinuteTextBox.Text  = ActiveDataGroupRCPlayersItem.redCard.Addition_minuteValue.ToString();
            IsTwoYellowCardEd.IsChecked = ActiveDataGroupRCPlayersItem.redCard.Is_two_yellowValue;
            //if (ActiveDataGroupYCPlayersItem.matchPlayer.TeamsheetValue != 4)
            //{
            //    PositionComboBoxEd.SelectedIndex = ActiveDataGroupYCPlayersItem.matchPlayer.TeamsheetValue;
            //}
            //else
            //{
            //    PositionComboBoxEd.SelectedIndex = 3;
            //}
            //IsCapitanEd.IsChecked = ActiveDataGroupMatchPlayersItem.matchPlayer.Is_capitanValue;
            //IsGoalkeeperEd.IsChecked = ActiveDataGroupMatchPlayersItem.matchPlayer.Is_goalkeeperValue;
        }
        private void GroupSection_ItemClick(object sender, ItemClickEventArgs e)
        {
            this.DefaultViewModel["ActivElement"] = (DataGroupRCPlayers)e.ClickedItem;
            ActiveDataGroupRCPlayersItem          = (DataGroupRCPlayers)e.ClickedItem;
            viewPanel.Visibility      = Windows.UI.Xaml.Visibility.Collapsed;
            editorPanel.Visibility    = Windows.UI.Xaml.Visibility.Visible;
            DeleteButtonEd.Visibility = Windows.UI.Xaml.Visibility.Visible;
            AcceptButtonEd.Content    = "Изменить";
            editorPanel.Tag           = "Edit";
            if (ActiveDataGroupRCPlayersItem.firstTeam)
            {
                TeamComboBoxEd.SelectedIndex = 0;
            }
            else
            {
                TeamComboBoxEd.SelectedIndex = 1;
            }
            PlayerComboBoxEd.SelectedItem = ActiveDataGroupRCPlayersItem.player;

            NoteTextBox.Text            = ActiveDataGroupRCPlayersItem.redCard.NoteValue;
            MinuteTextBox.Text          = ActiveDataGroupRCPlayersItem.redCard.MinuteValue.ToString();
            AdditionMinuteTextBox.Text  = ActiveDataGroupRCPlayersItem.redCard.Addition_minuteValue.ToString();
            IsTwoYellowCardEd.IsChecked = ActiveDataGroupRCPlayersItem.redCard.Is_two_yellowValue;
        }
        private void GroupSection_ItemClick(object sender, ItemClickEventArgs e)
        {
            //var groupId = ((SampleDataGroup)e.ClickedItem).UniqueId;
            //if (!Frame.Navigate(typeof(SectionPage), groupId))
            //{
            //    throw new Exception(this.resourceLoader.GetString("NavigationFailedExceptionMessage"));
            //}
            // var itemId = ((FootballMatch)e.ClickedItem).id;
            //Frame.Navigate(typeof(ItemPage), itemId);
            this.DefaultViewModel["ActivElement"] = (DataGroupRCPlayers)e.ClickedItem;
            ActiveDataGroupRCPlayersItem = (DataGroupRCPlayers)e.ClickedItem;
            viewPanel.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
            editorPanel.Visibility = Windows.UI.Xaml.Visibility.Visible;
            DeleteButtonEd.Visibility = Windows.UI.Xaml.Visibility.Visible;
            AcceptButtonEd.Content = "Изменить";
            editorPanel.Tag = "Edit";
            if (ActiveDataGroupRCPlayersItem.firstTeam)
            {
                TeamComboBoxEd.SelectedIndex = 0;
            }
            else
            {
                TeamComboBoxEd.SelectedIndex = 1;
            }
            PlayerComboBoxEd.SelectedItem = ActiveDataGroupRCPlayersItem.player;

            NoteTextBox.Text = ActiveDataGroupRCPlayersItem.redCard.NoteValue;
            MinuteTextBox.Text = ActiveDataGroupRCPlayersItem.redCard.MinuteValue.ToString();
            AdditionMinuteTextBox.Text = ActiveDataGroupRCPlayersItem.redCard.Addition_minuteValue.ToString();
            IsTwoYellowCardEd.IsChecked = ActiveDataGroupRCPlayersItem.redCard.Is_two_yellowValue;
            //if (ActiveDataGroupYCPlayersItem.matchPlayer.TeamsheetValue != 4)
            //{
            //    PositionComboBoxEd.SelectedIndex = ActiveDataGroupYCPlayersItem.matchPlayer.TeamsheetValue;
            //}
            //else
            //{
            //    PositionComboBoxEd.SelectedIndex = 3;
            //}
            //IsCapitanEd.IsChecked = ActiveDataGroupMatchPlayersItem.matchPlayer.Is_capitanValue;
            //IsGoalkeeperEd.IsChecked = ActiveDataGroupMatchPlayersItem.matchPlayer.Is_goalkeeperValue;


        }
 public async Task LoadState()
 {
     DeleteButtonEd.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
     FootballMatch Data = await DataSource.GetItemAsync(activId);
     dataGroupsRCPlayer = new ObservableCollection<DataGroupRCPlayers>();
     foreach (RedCard mp in Data.redcards)
     {
         DataGroupRCPlayers dp = null;
         if (mp.objectStatus != (int)DataSource.status.Deleted || mp.objectStatus != (int)DataSource.status.needDelete)
         {
             if (mp.Team_idValue == Data.team1.id)
             {
                 var matches = Data.team1_players.Where((player) => player.id.Equals(mp.Player_idValue));
                 if (matches.Count() > 0)
                 {
                     dp = new DataGroupRCPlayers(Data, Data.team1, matches.First(), mp);
                     dp.firstTeam = true;
                 }
             }
             else
             {
                 var matches = Data.team2_players.Where((player) => player.id.Equals(mp.Player_idValue));
                 if (matches.Count() > 0)
                 {
                     dp = new DataGroupRCPlayers(Data, Data.team2, matches.First(), mp);
                     dp.firstTeam = false;
                 }
             }
             if (dp != null) dataGroupsRCPlayer.Add(dp);
         }
     }
     this.DefaultViewModel["Match"] = Data;
     if (dataGroupsRCPlayer.Count() > 0)
     {
         this.DefaultViewModel["ActivElement"] = dataGroupsRCPlayer.First();
         this.DefaultViewModel["dataGroupsMatchPlayer"] = dataGroupsRCPlayer;
         this.DefaultViewModel["Team1MatchPlayers"] = dataGroupsRCPlayer.Where((team) => team.team.id.Equals(Data.team1.id));
         this.DefaultViewModel["Team2MatchPlayers"] = dataGroupsRCPlayer.Where((team) => team.team.id.Equals(Data.team2.id));
     }
     if (TeamComboBox.SelectedIndex == 0)
     {
         if (this.DefaultViewModel.ContainsKey("Team1MatchPlayers")) mainListView.ItemsSource = this.DefaultViewModel["Team1MatchPlayers"];
     }
     else
     {
         if (this.DefaultViewModel.ContainsKey("Team2MatchPlayers")) mainListView.ItemsSource = this.DefaultViewModel["Team2MatchPlayers"];
     }
 }