public void InitializeMyGames() { BTProgressHUD.Show("Loading Games", -1, ProgressHUD.MaskType.Black); var repository = AppDelegate.Repository; if (repository != null) { this.viewModel = new MyGamesViewModel(AppDelegate.Repository); this.viewModel.InitializeAsync().ContinueWith((t) => { if (!t.IsFaulted && t.Result) { BeginInvokeOnMainThread(() => { LoadGameControllers(); gamesControllers[0].SetData(this.viewModel.MyTurnGames); gamesControllers[1].SetData(this.viewModel.TheirTurnGames); gamesControllers[2].SetData(this.viewModel.CompletedGames); BTProgressHUD.Dismiss(); }); } // TODO handle error }); } }
protected void ReloadList(string gameGuidToStart = "") { ((POPpicApplication)Application).GetGameRepository(this).ContinueWith(r => { this.viewModel = new MyGamesViewModel(r.Result); viewModel.InitializeAsync().ContinueWith(t => { RunOnUiThread(() => { if (!t.IsFaulted && t.Result) { this.myTurnAdapter = new AndroidGameListAdapter(this, this.viewModel, MyGamesViewModel.ListType.MY_TURN); this.theirTurnAdapter = new AndroidGameListAdapter(this, this.viewModel, MyGamesViewModel.ListType.THEIR_TURN); this.completedAdapter = new AndroidGameListAdapter(this, this.viewModel, MyGamesViewModel.ListType.COMPLETED); this.myTurnFragment.ListAdapter = this.myTurnAdapter; this.theirTurnFragment.ListAdapter = this.theirTurnAdapter; this.completedFragment.ListAdapter = this.completedAdapter; this.myTurnAdapter.GameSelected += this.OnGameSelected; this.theirTurnAdapter.GameSelected += this.OnGameSelected; this.completedAdapter.GameSelected += this.OnGameSelected; } else { // TODO Show error } SetProgressBarVisibility(false); }); }); }); }
public AndroidGameListAdapter(Activity context, MyGamesViewModel model, MyGamesViewModel.ListType listType) // , ActionMode.ICallback contextMenuCallback) { this.context = context; this.listType = listType; this.model = model; this.games = model.GetMyGames(listType); }
public void SetGameList(IList <GameViewModel> games) { InvokeOnMainThread(() => { this.games = games; var newRoot = new RootElement("Games"); var mainSection = new Section(MyGamesViewModel.GetGameTypeDescription(ListType)); newRoot.Add(mainSection); StringElement ele = new StringElement("ABC", () => { Console.WriteLine("String clicked"); }); // mainSection.Add(ele); // mainSection.Add(new UIViewElement("", new UILabel(new RectangleF(0, 0, 100, 100)) { Text = "ABCDEFEFDF"}, false)); foreach (var game in this.games) { var cell = TestTVC.Create(); cell.SetData(game); var customelement = new CustomView(cell); mainSection.Add(customelement); } Root = this.rootElement = newRoot; }); }
public MyGamesPage(User _user) { var vm = new MyGamesViewModel(_user); this.BindingContext = vm; vm.DisplayGameDeleted += () => DisplayAlert("Success", "The game was deleted!", "OK"); InitializeComponent(); }
public DVCGames(IntPtr handle) : base(handle) { Root = rootElement = new RootElement("Games") { new Section(MyGamesViewModel.GetGameTypeDescription(ListType)) { new ActivityElement(), } }; }
public ActionResult MyGames() { var model = new MyGamesViewModel(); string error = ""; int userId = GetUserId(out error); if (string.IsNullOrWhiteSpace(error)) { model.Games = _bgcServices.GetUsersGames(userId, out error); return(View(model)); } ViewBag.Error = error; return(View("Error")); }
/// <summary> /// Called by the TableView to retrieve the header text for the particular section(group) /// </summary> public override string TitleForHeader(UITableView tableView, int section) { return(MyGamesViewModel.GetGameTypeDescription(ListType)); }