コード例 #1
0
        /// <summary>
        /// Populates the page with content passed during navigation.  Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="sender">
        /// The source of the event; typically <see cref="NavigationHelper"/>
        /// </param>
        /// <param name="e">Event data that provides both the navigation parameter passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
        /// a dictionary of state preserved by this page during an earlier
        /// session.  The state will be null the first time a page is visited.</param>
        private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            //try
            //DeleteButtonEd.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
            activId = (int)e.NavigationParameter;
            FootballMatch Data = await DataSource.GetItemAsync((int)e.NavigationParameter);
            dataGroupsMatchPlayerTeam1 = new ObservableCollection<DataGroupMatchPlayers>();
            dataGroupsMatchPlayerTeam2 = new ObservableCollection<DataGroupMatchPlayers>();
            DataGroupMatchPlayers dp = null;
            loadingRectangle.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
            foreach (Player pl in Data.team1_players)
            {
                dp = new DataGroupMatchPlayers(Data, Data.team1, pl);
                foreach (MatchPlayer mp in Data.matchPlayers)
                {
                    if (dp.player.id == mp.Player_idValue)
                    {
                        dp.matchPlayer = mp;
                        if (mp.objectStatus != (int)DataSource.status.Deleted && mp.objectStatus != (int)DataSource.status.needDelete) dp.showProperties = true;
                    }
                }
                if (dp.matchPlayer.IdValue == -1)
                {
                    dp.matchPlayer.Match_idValue = Data.id;
                    dp.matchPlayer.Player_idValue = pl.id;
                    dp.matchPlayer.Team_idValue = Data.team1.id;
                    dp.matchPlayer.TeamsheetValue = 0;
                }
                dataGroupsMatchPlayerTeam1.Add(dp);
            }
            foreach (Player pl in Data.team2_players)
            {
                dp = new DataGroupMatchPlayers(Data, Data.team2, pl);
                foreach (MatchPlayer mp in Data.matchPlayers)
                {
                    if (dp.player.id == mp.Player_idValue)
                    {
                        dp.matchPlayer = mp;
                        if (mp.objectStatus != (int)DataSource.status.Deleted && mp.objectStatus != (int)DataSource.status.needDelete) dp.showProperties = true;
                    }
                }
                if (dp.matchPlayer.IdValue == -1)
                {
                    dp.matchPlayer.Match_idValue = Data.id;
                    dp.matchPlayer.Player_idValue = pl.id;
                    dp.matchPlayer.Team_idValue = Data.team2.id;
                    dp.matchPlayer.TeamsheetValue = 0;
                }
                dataGroupsMatchPlayerTeam2.Add(dp);
            }

            this.DefaultViewModel["Match"] = Data;
            if (dataGroupsMatchPlayerTeam1.Count() > 0)
            {
                this.DefaultViewModel["Team1MatchPlayers"] = dataGroupsMatchPlayerTeam1;
            }
            if (dataGroupsMatchPlayerTeam2.Count() > 0)
            {
                this.DefaultViewModel["Team2MatchPlayers"] = dataGroupsMatchPlayerTeam2;
            }
            TeamComboBox.SelectedIndex = 0;

        }
コード例 #2
0
        /// <summary>
        /// Populates the page with content passed during navigation.  Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="sender">
        /// The source of the event; typically <see cref="NavigationHelper"/>
        /// </param>
        /// <param name="e">Event data that provides both the navigation parameter passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
        /// a dictionary of state preserved by this page during an earlier
        /// session.  The state will be null the first time a page is visited.</param>
        private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            //try
            //DeleteButtonEd.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
            activId = (int)e.NavigationParameter;
            FootballMatch Data = await DataSource.GetItemAsync((int)e.NavigationParameter);

            dataGroupsMatchPlayerTeam1 = new ObservableCollection <DataGroupMatchPlayers>();
            dataGroupsMatchPlayerTeam2 = new ObservableCollection <DataGroupMatchPlayers>();
            DataGroupMatchPlayers dp = null;

            loadingRectangle.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
            foreach (Player pl in Data.team1_players)
            {
                dp = new DataGroupMatchPlayers(Data, Data.team1, pl);
                foreach (MatchPlayer mp in Data.matchPlayers)
                {
                    if (dp.player.id == mp.Player_idValue)
                    {
                        dp.matchPlayer = mp;
                        if (mp.objectStatus != (int)DataSource.status.Deleted && mp.objectStatus != (int)DataSource.status.needDelete)
                        {
                            dp.showProperties = true;
                        }
                    }
                }
                if (dp.matchPlayer.IdValue == -1)
                {
                    dp.matchPlayer.Match_idValue  = Data.id;
                    dp.matchPlayer.Player_idValue = pl.id;
                    dp.matchPlayer.Team_idValue   = Data.team1.id;
                    dp.matchPlayer.TeamsheetValue = 0;
                }
                dataGroupsMatchPlayerTeam1.Add(dp);
            }
            foreach (Player pl in Data.team2_players)
            {
                dp = new DataGroupMatchPlayers(Data, Data.team2, pl);
                foreach (MatchPlayer mp in Data.matchPlayers)
                {
                    if (dp.player.id == mp.Player_idValue)
                    {
                        dp.matchPlayer = mp;
                        if (mp.objectStatus != (int)DataSource.status.Deleted && mp.objectStatus != (int)DataSource.status.needDelete)
                        {
                            dp.showProperties = true;
                        }
                    }
                }
                if (dp.matchPlayer.IdValue == -1)
                {
                    dp.matchPlayer.Match_idValue  = Data.id;
                    dp.matchPlayer.Player_idValue = pl.id;
                    dp.matchPlayer.Team_idValue   = Data.team2.id;
                    dp.matchPlayer.TeamsheetValue = 0;
                }
                dataGroupsMatchPlayerTeam2.Add(dp);
            }

            this.DefaultViewModel["Match"] = Data;
            if (dataGroupsMatchPlayerTeam1.Count() > 0)
            {
                this.DefaultViewModel["Team1MatchPlayers"] = dataGroupsMatchPlayerTeam1;
            }
            if (dataGroupsMatchPlayerTeam2.Count() > 0)
            {
                this.DefaultViewModel["Team2MatchPlayers"] = dataGroupsMatchPlayerTeam2;
            }
            TeamComboBox.SelectedIndex = 0;
        }