コード例 #1
0
		public async Task OnRefresh()
		{
			try {
				if (!SettingsApp.refreshFlag) 
				{
					SettingsApp.refreshFlag = true;
					cts = new CancellationTokenSource ();
					cts.Token.ThrowIfCancellationRequested ();
					APIRequest ApiReq = new APIRequest ();
					var jListMatch = await ApiReq.GetJsonAsync (SettingsApp.ServerAPIAddress+SettingsApp.GameName+"/GetUpcomingMatches");
					var listMatch = JsonConvert.DeserializeObject<List<SimpleMatchInfo>> (jListMatch.ToString());
					SimpleMatchInfo_2 s2 = new SimpleMatchInfo_2 ();
					listTeams = await s2.ConvertToSimple2 (listMatch,cts.Token);
					if(this.Activity!=null)
						this.ListAdapter = new SimpleMatchAdapter(this.Activity,listTeams,3,cts.Token);
					cts = null;
					SettingsApp.refreshFlag = false;
					Toast.MakeText (context, context.Resources.GetString(Resource.String.updated), ToastLength.Long).Show ();
				}
			}
			catch {
				cts = null;
				SettingsApp.refreshFlag = false;
				Toast.MakeText (context, context.Resources.GetString(Resource.String.error), ToastLength.Long).Show ();
			}
		}
コード例 #2
0
 		protected  override async void OnCreate (Bundle bundle)
		{
			try{
				base.OnCreate (bundle);
				SetContentView (Resource.Layout.LayoutMatchInfo);

				title=Intent.GetStringExtra("title");
				ActionBarTitle.SetTitle (this,Resource.Layout.ActionBarLayout,title,Resources.GetString (Resource.String.nameDota2));
				buttonRefresh=FindViewById<Button>(Resource.Id.buttonRefreshActionBar);
				buttonRefresh.Click+=ButtonRefreshClick;
				buttonRefresh.Visibility=ViewStates.Invisible;
				var buttonBack=FindViewById<Button>(Resource.Id.buttonBackActionBar);
				buttonBack.Click+=ButtonBackClick;
				//var rl=FindViewById<RelativeLayout>(Resource.Id.rlayout_match_info);
				//var buttonPickBan = rl.FindViewById<Button> (Resource.Id.button_picks_bans);
				//var rlTowersViews=FindViewById<RelativeLayout>(Resource.Id.towersState);
				Button buttonPickBan =FindViewById<Button> (Resource.Id.buttonBattle);
				buttonPickBan.Click += buttonPickBansClick;
				Button buttonGameStats = FindViewById<Button> (Resource.Id.buttonGameStats);
				buttonGameStats.Click += buttomGameStatsClick;
				pb=FindViewById<ProgressBar> (Resource.Id.progressBar3);
				pb.Visibility= ViewStates.Visible;
				APIRequest apiReq = new APIRequest ();
				int match_id=Convert.ToInt32( Intent.GetStringExtra("match_id"));
				var url =SettingsApp.ServerAPIAddress+SettingsApp.GameName+"/GetDetailInfo?match_id=" + match_id;
				var jMatchResponce = await apiReq.GetJsonAsync (url);
				gameInfo=jMatchResponce.ToString();
				var jDetailMatchInfo= JsonConvert.DeserializeObject<JDetailMatchInfo>(gameInfo);
				var jMatchDetails=JToken.Parse(jDetailMatchInfo.JMatchDetails);
				matchDetail=JsonConvert.DeserializeObject<MatchInfo>(jMatchDetails.ToString());
				dotaMatchInfo=JsonConvert.DeserializeObject<List<DotaMatchInfo>>(jMatchDetails.SelectToken("DetailsMatch").ToString());
				List<DetailInfo> listDetail=new List<DetailInfo>();
				listDetail.AddRange(dotaMatchInfo);
				matchDetail.DetailsMatch=listDetail;
				liveFlag=Intent.GetStringExtra("liveFlag");
				cts= new CancellationTokenSource();
				cts.Token.ThrowIfCancellationRequested ();
				dotaMatchInfo_2=new DotaMatchInfo_2();
				refreshFlag = true;

				dotaMatchInfo_2 = await dotaMatchInfo_2.ParseMatchTitle (matchDetail);
				//Title match
				await RefreshData(cts.Token);

			}catch(Exception e) {
				Console.WriteLine (e.Data);
				Console.WriteLine (e.Message);
			}
			cts = null;
			pb.Visibility= ViewStates.Gone;
			buttonRefresh.Visibility = ViewStates.Visible;
		}
コード例 #3
0
ファイル: CSMapDb.cs プロジェクト: mexaniksay/GamePro02
		public async Task<CSMap> AddMap(int id)
		{
			string url = SettingsDB.ServerAPIAddress+"CSGO/GetMap?map_id="+id;
			var ApiReq = new APIRequest ();
			DBComm command = new DBComm ("CSGO");
			JToken temp = await ApiReq.GetJsonAsync (url);
			var map = JsonConvert.DeserializeObject<CSMap> (temp.ToString ());
			if (temp.ToString () != "") {
				command.Connect.Insert (map);
				command.Connect.Dispose ();
			}
			return map;
		}
コード例 #4
0
ファイル: LeagueDb.cs プロジェクト: mexaniksay/GamePro02
		public async Task<League> AddLeague(int id,string gameName)
		{
			string url = SettingsDB.ServerAPIAddress+gameName+"/GetLeague?league_id="+id;
			var ApiReq = new APIRequest ();
			var comm = new DBComm ();
			JToken temp = await ApiReq.GetJsonAsync (url);
			var league = JsonConvert.DeserializeObject<League> (temp.ToString ());
			if (temp.ToString () != "") {
				comm.Connect.Insert (league);
				comm.Connect.Dispose ();
			}
			return league;
		}
コード例 #5
0
		protected async override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);
			SetContentView (Resource.Layout.CSMatchInfoLayout);
			title=Intent.GetStringExtra("title");
			pb = FindViewById<ProgressBar> (Resource.Id.progressBar3);
			ActionBarTitle.SetTitle (this,Resource.Layout.ActionBarLayout,title,Resources.GetString(Resource.String.nameCSGO));
			var buttonBack=FindViewById<Button>(Resource.Id.buttonBackActionBar);
			buttonBack.Click+=ButtonBackClick;
			buttonRefresh=FindViewById<Button>(Resource.Id.buttonRefreshActionBar);
			buttonRefresh.Click+=ButtonRefreshClick;
			buttonRefresh.Visibility=ViewStates.Invisible;
			pb=FindViewById<ProgressBar> (Resource.Id.progressBar3);
			pb.Visibility= ViewStates.Visible;
			APIRequest apiReq = new APIRequest ();
			int match_id=Convert.ToInt32( Intent.GetStringExtra("match_id"));
			var url =SettingsApp.ServerAPIAddress+SettingsApp.GameName+"/GetDetailInfo?match_id=" + match_id;
			var jMatchResponce = await apiReq.GetJsonAsync (url);

			gameInfo=jMatchResponce.ToString ();
			liveFlag=Intent.GetStringExtra("liveFlag");
			var jDetailMatchInfo= JsonConvert.DeserializeObject<JDetailMatchInfo>(gameInfo);
			var jMatchDetails=JToken.Parse(jDetailMatchInfo.JMatchDetails);
			matchInfo=JsonConvert.DeserializeObject<MatchInfo>(jMatchDetails.ToString());
			csMatchInfo=JsonConvert.DeserializeObject<List<CSMatchInfo>>(jMatchDetails.SelectToken("DetailsMatch").ToString());
			List<DetailInfo> listDetail=new List<DetailInfo>();
			listDetail.AddRange(csMatchInfo);
			matchInfo.DetailsMatch=listDetail;

			cts = new CancellationTokenSource ();
			matchInfo_2 = new CSMatchInfo_2 ();
			listMatchInfo = await matchInfo_2.ParseMatchTitle (matchInfo);
			if (listMatchInfo.Count > 0) {
				matchInfo_2 = listMatchInfo [0];
			}
			FillTitleMatch ();

			CreateFragment (Resource.Id.cs_llayout_match_draft, new FragmentCSMatchDraft (listMatchInfo));
			cts = null;
			pb.Visibility= ViewStates.Gone;
			buttonRefresh.Visibility = ViewStates.Visible;
			// Create your application here
		}
コード例 #6
0
		async Task OnRefresh(CancellationToken token)
		{
			APIRequest ApiReq = new APIRequest ();
			PicksBansOld pickBans=new PicksBansOld();
			//cts = new CancellationTokenSource ();
			refreshFlag = true;
			token.ThrowIfCancellationRequested ();
			var url =SettingsApp.ServerAPIAddress+SettingsApp.GameName+"/GetDetailInfo?match_id="+matchInfo.MatchId;
			var jMatchResponce = await ApiReq.GetJsonAsync (url);

			var jDetailMatchInfo= JsonConvert.DeserializeObject<JDetailMatchInfo>(jMatchResponce.ToString());
			var jMatchDetails=JToken.Parse(jDetailMatchInfo.JMatchDetails);
			matchInfo=JsonConvert.DeserializeObject<MatchInfo>(jMatchDetails.ToString());
			dotaMatchInfo=JsonConvert.DeserializeObject<List<DotaMatchInfo>>(jMatchDetails.SelectToken("DetailsMatch").ToString());
			List<DetailInfo> listDetail=new List<DetailInfo>();
			listDetail.AddRange(dotaMatchInfo);
			matchInfo.DetailsMatch=listDetail;

			radiantPB = pickBans.ParseJsonToRadPick (dotaMatchInfo[0].RadiantPicks);
			direPB = pickBans.ParseJsonToDirePick (dotaMatchInfo[0].DirePicks);
			token.ThrowIfCancellationRequested ();
			await SetHeroesImageInLayout (token);

			var analisPick=new AnalysisPick();
			var textRadiant=FindViewById<TextView>(Resource.Id.textTeamFP);
			var textDire=FindViewById<TextView>(Resource.Id.textTeamSP);
			var value=analisPick.GetAnalysisTeam(dotaMatchInfo[0].RadiantPicks.ListPicks,dotaMatchInfo[0].DirePicks.ListPicks);
			textRadiant.Text=Resources.GetString(Resource.String.radiant)+"  "+value[0].ToString();
			textDire.Text=Resources.GetString(Resource.String.dire)+"  "+(value[1].ToString());
			Toast.MakeText (this, Resources.GetString(Resource.String.updated), ToastLength.Short).Show ();
			refreshFlag = false;
		}
コード例 #7
0
ファイル: TeamDb.cs プロジェクト: mexaniksay/GamePro02
		public async Task<Team> AddTeam(int id,string gameName)
		{
			string url = SettingsDB.ServerAPIAddress + gameName + "/GetTeam?team_id=" + id;
			var ApiReq = new APIRequest ();
			//var PlayerReq = new Player ();
			var comm = new DBComm (gameName);
			JToken temp = await ApiReq.GetJsonAsync (url);
			var team = JsonConvert.DeserializeObject<Team> (temp.ToString ());
			if (temp.ToString () != "") {
				comm.Connect.Insert (team);
				comm.Connect.Dispose ();
			}
			return team;


		}
コード例 #8
0
		async Task OnRefresh (CancellationToken token){

			APIRequest ApiReq = new APIRequest ();
			refreshFlag = true;
			titleFlag = false;
			token.ThrowIfCancellationRequested ();
			var url =SettingsApp.ServerAPIAddress+SettingsApp.GameName+"/GetDetailInfo?match_id="+matchDetail.MatchId;
			var jMatchResponce = await ApiReq.GetJsonAsync (url);

			var jDetailMatchInfo= JsonConvert.DeserializeObject<JDetailMatchInfo>(jMatchResponce.ToString());
			var jMatchDetails=JToken.Parse(jDetailMatchInfo.JMatchDetails);
			matchDetail=JsonConvert.DeserializeObject<MatchInfo>(jMatchDetails.ToString());
			dotaMatchInfo=JsonConvert.DeserializeObject<List<DotaMatchInfo>>(jMatchDetails.SelectToken("DetailsMatch").ToString());
			List<DetailInfo> listDetail=new List<DetailInfo>();
			listDetail.AddRange(dotaMatchInfo);
			matchDetail.DetailsMatch=listDetail;

			dotaMatchInfo_2 = await dotaMatchInfo_2.ParseMatchTitle (matchDetail);

			await RefreshData (token);
			Toast.MakeText (this, Resources.GetString(Resource.String.updated), ToastLength.Short).Show ();
			refreshFlag = false;

		}