protected override void OnNavigatedTo(NavigationEventArgs e) { Frame rootFrame = Window.Current.Content as Frame; DataTransferManager dataTransferManager = DataTransferManager.GetForCurrentView(); if (e.Parameter.GetType() == typeof(Models.Users)) { currentUser = (Models.Users)(e.Parameter); } else { return; } ImageBrush im = new ImageBrush(); im.ImageSource = currentUser.background; bg.Background = im; publisher.Text = currentUser.userName; username.Text = currentUser.userName; score.Text = currentUser.score.ToString(); if (currentUser.localsource != null) { touxiang.ImageSource = currentUser.localsource; } }
protected override void OnNavigatedTo(NavigationEventArgs e) { Frame rootFrame = Window.Current.Content as Frame; DataTransferManager dataTransferManager = DataTransferManager.GetForCurrentView(); //dataTransferManager.DataRequested += new TypedEventHandler<DataTransferManager, DataRequestedEventArgs>(this.DataRequested); if (e.Parameter.GetType() == typeof(Models.Users)) { currentUser = (Models.Users)(e.Parameter); } else { return; } ImageBrush im = new ImageBrush(); im.ImageSource = currentUser.background; bg.Background = im; username.Text = currentUser.userName; phone.Text = currentUser.phone; user.Text = username.Text; score.Text = currentUser.score.ToString(); if (currentUser.localsource != null) { touxiang.ImageSource = currentUser.localsource; headSculpture.ImageSource = currentUser.localsource; } }
protected override void OnNavigatedTo(NavigationEventArgs e) { Frame rootFrame = Window.Current.Content as Frame; DataTransferManager dataTransferManager = DataTransferManager.GetForCurrentView(); //dataTransferManager.DataRequested += new TypedEventHandler<DataTransferManager, DataRequestedEventArgs>(this.DataRequested); if (e.Parameter.GetType() == typeof(Models.Users)) { currentUser = (Models.Users)(e.Parameter); } /*if (rootFrame.CanGoBack) * { * SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = * AppViewBackButtonVisibility.Visible; * } * else * { * SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = * AppViewBackButtonVisibility.Collapsed; * }*/ username.Text = currentUser.userName; phone.Text = currentUser.phone; user.Text = username.Text; score.Text = currentUser.score.ToString(); if (currentUser.localsource != null) { touxiang.ImageSource = currentUser.localsource; headSculpture.ImageSource = currentUser.localsource; } }
protected override async void OnNavigatedTo(NavigationEventArgs e) { Frame rootFrame = Window.Current.Content as Frame; if (e.Parameter.GetType() == typeof(Models.Users)) { var presentUser = (Models.Users)(e.Parameter); currentUser = presentUser; string errorMessage = ""; using (HttpClient client = new HttpClient()) { try { HttpResponseMessage response = await client.GetAsync("http://paradox5.cn/initItemInfo?itemId=" + presentUser.currentTarget); string responseBody = await response.Content.ReadAsStringAsync(); var responseJson = JsonConvert.DeserializeObject <JObject>(responseBody); var currentItem = responseJson["list"]; errorMessage = responseJson["statusCode"].ToString(); if (responseJson["statusCode"].ToString() == "ok") { publisherId = currentItem["publisherId"].ToString(); publisher.Text = currentItem["publisherName"].ToString(); type.Text = currentItem["type"].ToString(); location.Text = currentItem["location"].ToString(); time.Text = currentItem["dateTime"].ToString(); commission.Text = currentItem["commission"].ToString(); details.Text = currentItem["details"].ToString(); } else { await new MessageDialog(errorMessage).ShowAsync(); } } catch (HttpRequestException ex) { await new MessageDialog(errorMessage).ShowAsync(); } } username.Text = currentUser.userName; score.Text = currentUser.score.ToString(); if (currentUser.localsource != null) { touxiang.ImageSource = currentUser.localsource; } } /*if (rootFrame.CanGoBack) * { * SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = * AppViewBackButtonVisibility.Visible; * } * else * { * SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = * AppViewBackButtonVisibility.Collapsed; * }*/ }
private async void signinClick(object sender, RoutedEventArgs e) { string errorMessage = ""; using (HttpClient client = new HttpClient()) { try { var kvp = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("userName", username.Text), new KeyValuePair <string, string>("password", password.Password) }; HttpResponseMessage response = await client.PostAsync("http://paradox5.cn/signin", new FormUrlEncodedContent(kvp)); string responseBody = await response.Content.ReadAsStringAsync(); var responceJson1 = JsonConvert.DeserializeObject <JObject>(responseBody); var responceJson = responceJson1["list"]; errorMessage = responceJson1["statusCode"].ToString(); if (responceJson1["statusCode"].ToString() == "ok") { var head = responceJson["headSculpture"]; var itId = responceJson["itemId"]; var fId = responceJson["friendsId"]; var headString = head == null ? "" : head.ToString(); var itIdString = itId == null ? "" : itId.ToString(); var fIdString = fId == null ? "" : fId.ToString(); var phone = responceJson["phone"].ToString(); Models.Users regster = new Models.Users(responceJson["userId"].ToString(), responceJson["userName"].ToString(), responceJson["password"].ToString(), headString, itIdString, fIdString, int.Parse(responceJson["score"].ToString()), phone); if (headString != "") { regster.localsource = new BitmapImage(new Uri(headString)); } else { regster.localsource = null; } Frame.Navigate(typeof(MainPage), regster); } else { await new MessageDialog(errorMessage).ShowAsync(); } } catch (HttpRequestException ex) { await new MessageDialog(errorMessage).ShowAsync(); } } }
protected override void OnNavigatedTo(NavigationEventArgs e) { Frame rootFrame = Window.Current.Content as Frame; DataTransferManager dataTransferManager = DataTransferManager.GetForCurrentView(); //dataTransferManager.DataRequested += new TypedEventHandler<DataTransferManager, DataRequestedEventArgs>(this.DataRequested); if (e.Parameter.GetType() == typeof(Models.Users)) { currentUser = (Models.Users)(e.Parameter); } else { return; } ImageBrush im = new ImageBrush(); im.ImageSource = currentUser.background; bg.Background = im; /*if (rootFrame.CanGoBack) * { * SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = * AppViewBackButtonVisibility.Visible; * } * else * { * SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = * AppViewBackButtonVisibility.Collapsed; * }*/ if (currentUser.localsource != null) { touxiang.ImageSource = currentUser.localsource; } username.Text = currentUser.userName; score.Text = currentUser.score.ToString(); askForFriendsInfo(); }
protected override async void OnNavigatedTo(NavigationEventArgs e) { Frame rootFrame = Window.Current.Content as Frame; DataTransferManager dataTransferManager = DataTransferManager.GetForCurrentView(); dataTransferManager.DataRequested += new TypedEventHandler <DataTransferManager, DataRequestedEventArgs>(DataRequested); if (e.Parameter.GetType() == typeof(Models.Users)) { var presentUser = (Models.Users)(e.Parameter); currentUers = presentUser; username.Text = presentUser.userName; score.Text = presentUser.score.ToString(); string errorMessage = ""; using (HttpClient client = new HttpClient()) { try { HttpResponseMessage response = await client.GetAsync("http://paradox5.cn/main?userId=" + presentUser.userId); string responseBody = await response.Content.ReadAsStringAsync(); var responseJson = JsonConvert.DeserializeObject <JObject>(responseBody); errorMessage = responseJson["statusCode"].ToString(); JArray items = JsonConvert.DeserializeObject <JArray>(responseJson["list"].ToString()); if (responseJson["statusCode"].ToString() == "ok") { for (int i = 0; i < items.Count; ++i) { JObject presentItem = (JObject)items[i]; string publisherid = presentItem["publisherId"].ToString(); string ty = presentItem["type"].ToString(); string detail = presentItem["details"].ToString(); string location = presentItem["location"].ToString(); string date = presentItem["dateTime"].ToString(); string itemid = presentItem["itemId"].ToString(); string image = ""; int c; try { c = int.Parse(presentItem["commission"].ToString()); } catch (Exception ex) { c = 0; } helpItemViewModel.AddHelpItem(itemid, publisherid, "", ty, detail, location, date, image, false, c); } } } catch (HttpRequestException ex) { await new MessageDialog(errorMessage).ShowAsync(); } username.Text = currentUers.userName; score.Text = (currentUers.score).ToString(); if (currentUers.localsource != null) { touxiang.ImageSource = currentUers.localsource; } } UpdatePrimaryTile(); } /*if (rootFrame.CanGoBack) * { * SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = * AppViewBackButtonVisibility.Visible; * } * else * { * SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = * AppViewBackButtonVisibility.Collapsed; * }*/ }