public RecordsOldestPage(string title, RecordsViewModel recordsViewModel, EFilter_Game game, EFilter_Mode mode) { this.recordsViewModel = recordsViewModel; this.game = game; this.mode = mode; this.oldestType = EFilter_ORType.map; InitializeComponent(); Title = title; }
public static string toString(EFilter_ORType type) { string typeString = ""; switch (type) { case EFilter_ORType.map: typeString = "map"; break; case EFilter_ORType.stage: typeString = "stage"; break; case EFilter_ORType.bonus: typeString = "bonus"; break; default: break; } return(typeString); }
public static string toString2(EFilter_ORType type) { string typeString = ""; switch (type) { case EFilter_ORType.map: typeString = otype_arr[0]; break; case EFilter_ORType.stage: typeString = otype_arr[1]; break; case EFilter_ORType.bonus: typeString = otype_arr[2]; break; default: break; } return(typeString); }
// UI ----------------------------------------------------------------------------------------------- #region UI private async Task ChangeRecords(EFilter_ORType type) { var oldRecordDatum = await recordsViewModel.GetOldestRecords(game, type, mode, list_index); oldRecordData = oldRecordDatum?.data; if (oldRecordData is null) { return; } ORTypeOptionLabel.Text = "Type: " + EFilter_ToString.toString2(type); if (list_index == 1) { ORStack.Children.Clear(); } LayoutRecords(); }
internal async Task <OldestRecordsRootObject> GetOldestRecords(EFilter_Game game, EFilter_ORType type, EFilter_Mode mode, int start_index) { if (!BaseViewModel.hasConnection()) { return(null); } string gameString = EFilter_ToString.toString(game); string typeString = EFilter_ToString.toString(type); string modeString = ((int)mode).ToString(); if (gameString == "" || typeString == "") { return(null); } client.BaseUrl = new Uri("http://surf.ksfclan.com/api2/" + gameString + "/oldestrecords/server/" + typeString + "/" + start_index + ",10/" + modeString); await Task.Run(() => response = client.Execute(request)); if (response.StatusCode == System.Net.HttpStatusCode.OK) { return(JsonConvert.DeserializeObject <OldestRecordsRootObject>(response.Content)); } else { return(null); } }