Пример #1
0
        private GameDetailView GameDetailViewInit(MatchReferenceBinding dcMrb)
        {
            GameDetailView      gdv  = new GameDetailView();
            GameDetailViewModel gdvm = new GameDetailViewModel();

            if (dcMrb.MatchDetail == null)
            {
                dcMrb.MatchDetail = MainWindow.m_RiotApi.GetMatch(MainWindow.m_Region, dcMrb.MatchReference.GameId);
            }

            gdvm.Teams        = dcMrb.MatchDetail.Teams;
            gdvm.GameCreation = dcMrb.MatchDetail.GameCreation;
            //gdvm.GameDuration = dcMrb.MatchDetail.GameDuration;

            //gdvm.Timeline = dcMrb.MatchDetail.Timeline;
            //gdvm.MapType = dcMrb.MatchDetail.MapType;
            //gdvm.MatchId = dcMrb.MatchDetail.MatchId;
            //gdvm.MatchMode = dcMrb.MatchDetail.MatchMode;
            //gdvm.MatchType = dcMrb.MatchDetail.MatchType;
            //gdvm.MatchVersion = dcMrb.MatchDetail.MatchVersion;
            //gdvm.QueueType = dcMrb.MatchDetail.QueueType;
            //gdvm.Region = dcMrb.MatchDetail.Region;
            //gdvm.Season = dcMrb.MatchDetail.Season;
            gdv.DataContext = gdvm;

            if (dcMrb.MatchDetail.Participants.Count > 10)
            {
            }
            else
            {
                ParticipantDto[] lstPart1 = dcMrb.MatchDetail.Participants.Where(part => part.TeamId == TEAM_ID_1).ToArray();
                ParticipantDto[] lstPart2 = dcMrb.MatchDetail.Participants.Where(part => part.TeamId == TEAM_ID_2).ToArray();

                GameDetailItemViewsInit(dcMrb, lstPart1, gdv.SP1.Children);
                GameDetailItemViewsInit(dcMrb, lstPart2, gdv.SP2.Children);
            }

            return(gdv);
        }
Пример #2
0
        private void Row_DoubleClick(object sender, MouseButtonEventArgs e)
        {
            // Some operations with this row
            GameDetailView gdv = new GameDetailView();
            DataGridRow    row = sender as DataGridRow;
            MainWindow     mw  = this.TryFindParent <MetroWindow>() as MainWindow;

            try
            {
                MatchReferenceBinding dcMrb = (MatchReferenceBinding)row.DataContext;
                gdv = GameDetailViewInit(dcMrb);
                mw.GameDetailChildWindow.Content = gdv;
            }
            catch (Exception ex)
            {
                ((GameDetailViewModel)gdv.DataContext).ErrorMessage = ex.Message;
            }
            finally
            {
                mw.LoLDataRefresh.IsEnabled     = false;
                mw.LoLSummonerLogin.IsEnabled   = false;
                mw.GameDetailChildWindow.IsOpen = true;
            }
        }