コード例 #1
0
        private void UpdateAdapter(GamesJson obj)
        {
            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                for (int i = 0; i < obj.Games.Count; i++)
                    this.Games.Add(obj.Games[i]);
                IsLoading = false;
            });

        }
コード例 #2
0
        protected override void OnCreate(Bundle bundle)
        {
            try
            {
                RequestWindowFeature(WindowFeatures.NoTitle);

                base.OnCreate(bundle);
                LoggerMobile.Instance.logMessage("Opening GamesActivity", LoggerEnum.message);
                SetContentView(Resource.Layout.PublicGames);
                LegacyBar = FindViewById<LegacyBar.Library.Bar.LegacyBar>(Resource.Id.actionbar);
                LegacyBar.SeparatorColor = Color.Purple;

                AddHomeAction(typeof(Main), Resource.Drawable.icon);
                // Get our button from the layout resource,
                // and attach an event to it

                LegacyBar.ProgressBarVisibility = ViewStates.Visible;
                //currentGamesList = FindViewById<ListView>(Resource.Id.currentGamesList);
                pastGamesList = FindViewById<ListView>(Resource.Id.pastGamesList);
                LegacyBarAction loginAction = new RefreshAction(this, null, Resource.Drawable.ic_action_refresh, this);
                LegacyBar.AddAction(loginAction);

                initialPastArray = new GamesJson();
                //initialCurrentArray = new GamesJson();
                Action pullMorePast = new Action(PullMorePast);
                //Action pullCurrent = new Action(PullMorePast);

                PastGamesAdapter = new GamesAdapter(this, initialPastArray.Games, pullMorePast);
                //CurrentGamesAdapter = new GamesAdapter(this, initialCurrentArray.Games, null);

                //currentGamesList.Adapter = CurrentGamesAdapter;
                pastGamesList.Adapter = PastGamesAdapter;
                Game.PullCurrentGames(this, UpdateCurrentAdapter);
                Game.PullPastGames(PAGE_COUNT, lastPagePulled, this, UpdatePastAdapter);

                //currentGamesList.ItemClick += currentGamesList_ItemClick;
                pastGamesList.ItemClick += pastGamesList_ItemClick;
                var myString = new SpannableStringBuilder("lol");
                Selection.SelectAll(myString); // needs selection or Index Out of bounds

                LegacyBarAction infoAction = new DefaultLegacyBarAction(this, CreateInfoIntent(), Resource.Drawable.action_about);
                LegacyBar.AddAction(infoAction);

                m_AdView = FindViewById(Resource.Id.adView);
                if (SettingsMobile.Instance.User != null && SettingsMobile.Instance.User.IsValidSub)
                {
                }
            }
            catch (Exception exception)
            {
                ErrorHandler.Save(exception, MobileTypeEnum.Android, (Context)this);
            }
        }
コード例 #3
0
        public Games()
        {
            try
            {
                InitializeComponent();
                LoggerMobile.Instance.logMessage("Opening Games", Portable.Util.Log.Enums.LoggerEnum.message);
                _viewModel = (GamesViewModel)Resources["viewModel"];
                resultListBox.ItemRealized += resultListBox_ItemRealized;
                this.Loaded += new RoutedEventHandler(MainPage_Loaded);
                initialArray = new GamesJson();

           
            }
            catch (Exception exception)
            { ErrorHandler.Save(exception, MobileTypeEnum.WP8); }
        }
コード例 #4
0
 public GamesJson Get(int take = 10, int skip = 0, string filter = "", string order = "")
 {
     try
     {
         GamesJson game = new GamesJson();
         game.ManualGames = GameFactory.Initialize().GetManualGames(take, skip);
         return game;
     }
     catch (UnauthorizedAccessException)
     {
         throw new HttpResponseException(HttpStatusCode.Unauthorized);
     }
     catch (Exception exception)
     {
         ErrorDatabaseManager.AddException(exception, GetType());
         throw new HttpResponseException(HttpStatusCode.InternalServerError);
     }
 }
コード例 #5
0
 void UpdateAdapter(GamesJson skaters)
 {
     initialArray.Games.AddRange(skaters.Games);
     InvokeOnMainThread(() =>
     {
         try
         {
             table.ReloadData();
             loading.Hide();
         }
         catch (Exception exception)
         {
             ErrorHandler.Save(exception, MobileTypeEnum.iPhone);
         }
     });
 }
コード例 #6
0
 public GamesViewController()
 {
     initialArray = new GamesJson();
 }
コード例 #7
0
ファイル: Game.cs プロジェクト: mukhtiarlander/git_demo_torit
        public static GamesJson GetCurrentGamesMobile()
        {
            var gs = GameCache.GetCurrentLiveGames();
            GamesJson gj = new GamesJson();
            gj.Games = new List<CurrentGameJson>();
            gj.Count = gs.Count;
            foreach (var game in gs)
            {
                if (game.GameIsConfirmedOnline && game.HasGameStarted)
                {
                    CurrentGameJson g = new CurrentGameJson();
                    g.StartTime = game.GameDate;
                    g.JamNumber = game.CurrentJam.JamNumber;
                    g.PeriodNumber = game.CurrentPeriod;
                    g.GameId = game.GameId;
                    g.GameName = game.GameName;
                    g.Team2Name = game.Team2.TeamName;
                    g.Team1Name = game.Team1.TeamName;
                    g.Team1Score = game.CurrentTeam1Score;
                    g.Team2Score = game.CurrentTeam2Score;
                    g.GameUrl = ServerConfig.WEBSITE_DEFAULT_LOCATION_FOR_PAST_GAMES + "/" + g.GameId + "/" + RDN.Utilities.Strings.StringExt.ToSearchEngineFriendly(g.GameName) + "/" + RDN.Utilities.Strings.StringExt.ToSearchEngineFriendly(g.Team1Name) + "/" + RDN.Utilities.Strings.StringExt.ToSearchEngineFriendly(g.Team2Name);
                    g.HasGameEnded = game.HasGameEnded;
                    if (!g.HasGameEnded)
                    {
                        if (game.CurrentJam != null && game.CurrentJam.JamClock != null)
                            g.JamTimeLeft = game.CurrentJam.JamClock.TimeRemaining;
                        if (game.PeriodClock != null)
                            g.PeriodTimeLeft = game.PeriodClock.TimeRemaining;
                    }
                    g.RuleSet = game.Policy.GameSelectionType.ToString();
                    if (game.Team1 != null && game.Team1.Logo != null)
                        g.Team1LogoUrl = game.Team1.Logo.ImageUrlThumb;
                    if (game.Team2 != null && game.Team2.Logo != null)
                        g.Team2LogoUrl = game.Team2.Logo.ImageUrlThumb;

                    if (!String.IsNullOrEmpty(game.EmbededVideoHtml))
                        g.IsLiveStreaming = true;
                    gj.Games.Add(g);
                }
            }

            return gj;
        }
コード例 #8
0
        public ActionResult PastGames(string p, string c)
        {
            try
            {
                GamesJson gj = new GamesJson();

                gj.Games = SiteCache.GetPastGames(Convert.ToInt32(p), Convert.ToInt32(c));
                gj.Count = gj.Games.Count;
                gj.Page = Convert.ToInt32(p);
                return Json(gj, JsonRequestBehavior.AllowGet);
            }
            catch (Exception exception)
            {
                ErrorDatabaseManager.AddException(exception, GetType());
            }
            return Json(new { result = false }, JsonRequestBehavior.AllowGet);
        }
コード例 #9
0
        void UpdateCurrentAdapter(GamesJson games)
        {
            initialPastArray.Games.AddRange(games.Games);

            RunOnUiThread(() =>
            {
                try
                {
                    if (games.Games.Count > 0)
                    {
                        PastGamesAdapter.NotifyDataSetChanged();
                    }
                }
                catch (Exception exception)
                {
                    ErrorHandler.Save(exception, MobileTypeEnum.Android, (Context)this);
                }
            });
        }
コード例 #10
0
 void UpdatePastAdapter(GamesJson games)
 {
     initialPastArray.Games.AddRange(games.Games);
     RunOnUiThread(() =>
     {
         try
         {
             int firstPosition = pastGamesList.ScrollY;
             PastGamesAdapter.NotifyDataSetChanged();
             LegacyBar.ProgressBarVisibility = ViewStates.Gone;
             pastGamesList.ScrollTo(0, firstPosition);
         }
         catch (Exception exception)
         {
             ErrorHandler.Save(exception, MobileTypeEnum.Android, (Context)this);
         }
     });
 }