private void CommunityAddAppBarButton_Click(object sender, RoutedEventArgs e) { //TODO:未登陆时 无法发表新帖 CommunityFrame.Visibility = Visibility.Visible; SystemNavigationManager.GetForCurrentView().BackRequested += App_BackRequested; SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible; //if (appSetting.Values.ContainsKey("idNum")) try { var vault = new Windows.Security.Credentials.PasswordVault(); var credentialList = vault.FindAllByResource(resourceName); credentialList[0].RetrievePassword(); if (credentialList.Count > 0) { CommunityFrame.Navigate(typeof(CommunityAddPage)); } else { var msgPopup = new Data.loginControl("您还没有登录 无法发布新帖~"); msgPopup.LeftClick += (s, c) => { Frame rootFrame = Window.Current.Content as Frame; rootFrame.Navigate(typeof(LoginPage)); }; msgPopup.RightClick += (s, c) => { Debug.WriteLine("您可以先去社区逛一逛~"); }; msgPopup.ShowWIndow(); } } catch { var msgPopup = new Data.loginControl("您还没有登录 无法发布新帖~"); msgPopup.LeftClick += (s, c) => { Frame rootFrame = Window.Current.Content as Frame; rootFrame.Navigate(typeof(LoginPage)); }; msgPopup.RightClick += (s, c) => { Debug.WriteLine("您可以先去社区逛一逛~"); }; msgPopup.ShowWIndow(); } }
//TODO:未登录时不能选择上传头像 private async void headimgRectangle_Tapped(object sender, TappedRoutedEventArgs e) { //if (appSetting.Values.ContainsKey("idNum")) try { var vault = new Windows.Security.Credentials.PasswordVault(); var credentialList = vault.FindAllByResource(resourceName); credentialList[0].RetrievePassword(); if (credentialList.Count > 0) { FileOpenPicker openPicker = new FileOpenPicker(); openPicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary; openPicker.FileTypeFilter.Add(".png"); openPicker.FileTypeFilter.Add(".jpg"); openPicker.FileTypeFilter.Add(".bmp"); openPicker.FileTypeFilter.Add(".gif"); openPicker.ContinuationData["Operation"] = "img"; StorageFile file = await openPicker.PickSingleFileAsync(); if (file != null) { ClipHeadGrid.Visibility = Visibility.Visible; BackOpacityGrid.Visibility = Visibility.Visible; SoftwareBitmap sb = null; using (IRandomAccessStream stream = await file.OpenAsync(FileAccessMode.Read)) { // Create the decoder from the stream BitmapDecoder decoder = await BitmapDecoder.CreateAsync(stream); // Get the SoftwareBitmap representation of the file SoftwareBitmap softwareBitmap = await decoder.GetSoftwareBitmapAsync(BitmapPixelFormat.Bgra8, BitmapAlphaMode.Premultiplied); sb = softwareBitmap; // return softwareBitmap; } SoftwareBitmapSource source = new SoftwareBitmapSource(); await source.SetBitmapAsync(sb); headImage.Source = source; } } else { var msgPopup = new Data.loginControl("您还没有登录 不能上传头像哦~"); msgPopup.LeftClick += (s, c) => { Frame rootFrame = Window.Current.Content as Frame; rootFrame.Navigate(typeof(LoginPage)); }; msgPopup.RightClick += (s, c) => { new MessageDialog("您可以先去社区逛一逛~"); }; msgPopup.ShowWIndow(); } } catch { var msgPopup = new Data.loginControl("您还没有登录 不能上传头像哦~"); msgPopup.LeftClick += (s, c) => { Frame rootFrame = Window.Current.Content as Frame; rootFrame.Navigate(typeof(LoginPage)); }; msgPopup.RightClick += (s, c) => { new MessageDialog("您可以先去社区逛一逛~"); }; msgPopup.ShowWIndow(); } }
private void StackPanel_Tapped(object sender, TappedRoutedEventArgs e) { //if (appSetting.Values.ContainsKey("idNum")) var vault = new Windows.Security.Credentials.PasswordVault(); var credentialList = vault.FindAllByResource(resourceName); credentialList[0].RetrievePassword(); if (credentialList.Count > 0) { BBDDFeed b = ((StackPanel)sender).DataContext as BBDDFeed; App.ViewModel = ViewModel; App.CommunityPivotState = CommunityPivot.SelectedIndex; App.CommunityScrollViewerOffset = BBDDScrollViewer.VerticalOffset; isPersonInfo = true; Frame.Navigate(typeof(CommunityPersonInfo), b.stunum); } else { var msgPopup = new Data.loginControl("登录即可查看他人动态~"); msgPopup.LeftClick += (s, c) => { Frame rootFrame = Window.Current.Content as Frame; rootFrame.Navigate(typeof(LoginPage)); }; msgPopup.RightClick += (s, c) => { new MessageDialog("您可以先四处逛一逛~"); }; msgPopup.ShowWIndow(); } }
/// <summary> /// Navigate to the Page for the selected <paramref name="listViewItem"/>. /// </summary> /// <param name="sender"></param> /// <param name="listViewItem"></param> private async void NavMenuList_ItemInvoked(object sender, ListViewItem listViewItem) { var item = (NavMenuItem)((NavMenuListView)sender).ItemFromContainer(listViewItem); if (item != null) { if (item.DestPage != null && item.DestPage != this.AppFrame.CurrentSourcePageType) { //appSetting.Values["CommunityPerInfo"] = false; //TODO:未登录时 不能传入社区个人信息和个人信息页信息 谨慎处理 //if (!bool.Parse(appSetting.Values["CommunityPerInfo"].ToString()) && (item.DestPage == typeof(MyPage) || item.DestPage == typeof(CommunityPage))) try { var vault = new Windows.Security.Credentials.PasswordVault(); var credentialList = vault.FindAllByResource(resourceName); credentialList[0].RetrievePassword(); if (!bool.Parse(appSetting.Values["CommunityPerInfo"].ToString()) && (item.DestPage == typeof(MyPage))) { if (credentialList.Count > 0) { BackOpacityGrid.Visibility = Visibility.Visible; loadingStackPanel.Visibility = Visibility.Visible; List<KeyValuePair<String, String>> paramList = new List<KeyValuePair<String, String>>(); //paramList.Add(new KeyValuePair<string, string>("stuNum", appSetting.Values["stuNum"].ToString())); //paramList.Add(new KeyValuePair<string, string>("idNum", appSetting.Values["idNum"].ToString())); paramList.Add(new KeyValuePair<string, string>("stuNum", credentialList[0].UserName)); paramList.Add(new KeyValuePair<string, string>("idNum", credentialList[0].Password)); string perInfo = await NetWork.getHttpWebRequest("cyxbsMobile/index.php/Home/Person/search", paramList); if (perInfo != "") { JObject jPerInfo = JObject.Parse(perInfo); if (jPerInfo["data"].ToString() == "") { var dig = new MessageDialog("没有完善资料不能登入友谊的小船哟"); var btnOk = new UICommand("马上完善"); dig.Commands.Add(btnOk); var btnCancel = new UICommand("暂时不了"); dig.Commands.Add(btnCancel); var result = await dig.ShowAsync(); if (null != result && result.Label == "马上完善") { Debug.WriteLine("添加信息"); BackOpacityGrid.Visibility = Visibility.Collapsed; loadingStackPanel.Visibility = Visibility.Collapsed; this.AppFrame.Navigate(typeof(SetPersonInfoPage), item.DestPage); } else if (null != result && result.Label == "暂时不了") { BackOpacityGrid.Visibility = Visibility.Collapsed; loadingStackPanel.Visibility = Visibility.Collapsed; } } else { appSetting.Values["CommunityPerInfo"] = true; appSetting.Values["Community_people_id"] = jPerInfo["data"]["id"].ToString(); appSetting.Values["Community_nickname"] = jPerInfo["data"]["nickname"].ToString(); appSetting.Values["Community_headimg_src"] = jPerInfo["data"]["photo_src"].ToString(); appSetting.Values["Community_introduction"] = jPerInfo["data"]["introduction"].ToString(); appSetting.Values["Community_phone"] = jPerInfo["data"]["phone"].ToString(); appSetting.Values["Community_qq"] = jPerInfo["data"]["qq"].ToString(); Debug.WriteLine(appSetting.Values["Community_headimg_src"].ToString()); Debug.WriteLine(jPerInfo["data"]["id"].ToString()); BackOpacityGrid.Visibility = Visibility.Collapsed; loadingStackPanel.Visibility = Visibility.Collapsed; if ((item.DestPage != typeof(MyPage))) this.AppFrame.Navigate(item.DestPage, item.Arguments); SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed; } } } else { if ((item.DestPage != typeof(MyPage))) { this.AppFrame.Navigate(item.DestPage, item.Arguments); var msgPopup = new Data.loginControl("您还没有登录 不能访问个人中心~"); msgPopup.LeftClick += (s, c) => { Frame rootFrame = Window.Current.Content as Frame; rootFrame.Navigate(typeof(LoginPage)); }; msgPopup.RightClick += (s, c) => { new MessageDialog("您可以先去社区逛一逛~"); }; msgPopup.ShowWIndow(); } else { var msgPopup = new Data.loginControl("您还没有登录 不能访问个人中心~"); msgPopup.LeftClick += (s, c) => { Frame rootFrame = Window.Current.Content as Frame; rootFrame.Navigate(typeof(LoginPage)); }; msgPopup.RightClick += (s, c) => { new MessageDialog("您可以先去社区逛一逛~"); }; msgPopup.ShowWIndow(); } } } else { this.AppFrame.Navigate(item.DestPage, item.Arguments); SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed; } } catch { if (!bool.Parse(appSetting.Values["CommunityPerInfo"].ToString()) && (item.DestPage == typeof(MyPage))) { if ((item.DestPage != typeof(MyPage))) { this.AppFrame.Navigate(item.DestPage, item.Arguments); var msgPopup = new Data.loginControl("您还没有登录 不能访问个人中心~"); msgPopup.LeftClick += (s, c) => { Frame rootFrame = Window.Current.Content as Frame; rootFrame.Navigate(typeof(LoginPage)); }; msgPopup.RightClick += (s, c) => { new MessageDialog("您可以先去社区逛一逛~"); }; msgPopup.ShowWIndow(); } else { var msgPopup = new Data.loginControl("您还没有登录 不能访问个人中心~"); msgPopup.LeftClick += (s, c) => { Frame rootFrame = Window.Current.Content as Frame; rootFrame.Navigate(typeof(LoginPage)); }; msgPopup.RightClick += (s, c) => { new MessageDialog("您可以先去社区逛一逛~"); }; msgPopup.ShowWIndow(); } } else { this.AppFrame.Navigate(item.DestPage, item.Arguments); SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed; } } } } }
private async void MoreListView_ItemClick(object sender, ItemClickEventArgs e) { var item = e.ClickedItem as Morepageclass; if ((MoreListgrid.Width == 300) || item.UniqueID == "Card") { //MoreBackAppBarButton.Visibility = Visibility.Collapsed; SystemNavigationManager.GetForCurrentView().BackRequested -= App_BackRequested; SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed; } else { //MoreBackAppBarButton.Visibility = Visibility.Visible; SystemNavigationManager.GetForCurrentView().BackRequested += App_BackRequested; SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible; HubSectionKBTitle.Text = item.Itemname; } //MoreFrame.Visibility = Visibility.Visible; MoreContentTitleTextBlock.Text = item.Itemname; //TODO:未登陆时 没有 补考/考试/分数信息 可查询空闲 无法自动添加自己的信息 Debug.WriteLine(item.UniqueID); { int count; var vault = new Windows.Security.Credentials.PasswordVault(); try { var credentialList = vault.FindAllByResource(resourceName); count = credentialList.Count; } catch { count = 0; } switch (item.UniqueID) { case "ReExam": //if (appSetting.Values.ContainsKey("idNum")) if (count > 0) { MoreFrame.Navigate(typeof(ExamPage), 3);; MoreFrame.Visibility = Visibility.Visible; isFreeRe = 0; break; } else { var msgPopup = new Data.loginControl("您还没有登录 无法查看补考信息~"); msgPopup.LeftClick += (s, c) => { Frame rootFrame = Window.Current.Content as Frame; rootFrame.Navigate(typeof(LoginPage)); }; msgPopup.RightClick += (s, c) => { new MessageDialog("您可以先去社区逛一逛~"); }; msgPopup.ShowWIndow(); break; } case "Volunteer": MoreFrame.Navigate(typeof(VolunteerPage)); MoreFrame.Visibility = Visibility.Visible; isFreeRe = 0; break; case "Exam": //if (appSetting.Values.ContainsKey("idNum")) if (count > 0) { MoreFrame.Navigate(typeof(ExamPage), 2); MoreFrame.Visibility = Visibility.Visible; isFreeRe = 0; break; } else { var msgPopup = new Data.loginControl("您还没有登录 无法查看考试信息~"); msgPopup.LeftClick += (s, c) => { Frame rootFrame = Window.Current.Content as Frame; rootFrame.Navigate(typeof(LoginPage)); }; msgPopup.RightClick += (s, c) => { new MessageDialog("您可以先去社区逛一逛~"); }; msgPopup.ShowWIndow(); break; } case "Socre": //if (appSetting.Values.ContainsKey("idNum")) if (count > 0) { MoreFrame.Navigate(typeof(ScorePage)); MoreFrame.Visibility = Visibility.Visible; isFreeRe = 0; break; } else { var msgPopup = new Data.loginControl("您还没有登录 无法查看成绩~"); msgPopup.LeftClick += (s, c) => { Frame rootFrame = Window.Current.Content as Frame; rootFrame.Navigate(typeof(LoginPage)); }; msgPopup.RightClick += (s, c) => { new MessageDialog("您可以先去社区逛一逛~"); }; msgPopup.ShowWIndow(); break; } case "ClassRoom": //if (appSetting.Values.ContainsKey("idNum")) if (count > 0) { MoreFrame.Navigate(typeof(EmptyRoomsPage)); MoreFrame.Visibility = Visibility.Visible; isFreeRe = 0; break; } else { var msgPopup = new Data.loginControl("您还没有登录 无法查询空教室~"); msgPopup.LeftClick += (s, c) => { Frame rootFrame = Window.Current.Content as Frame; rootFrame.Navigate(typeof(LoginPage)); }; msgPopup.RightClick += (s, c) => { new MessageDialog("您可以先去社区逛一逛~"); }; msgPopup.ShowWIndow(); break; } case "Calendar": MoreFrame.Navigate(typeof(CalendarPage)); MoreFrame.Visibility = Visibility.Visible; isFreeRe = 0; break; case "FreeTime": if (count > 0) { MoreFrame.Navigate(typeof(SearchFreeTimeNumPage)); MoreFrame.Visibility = Visibility.Visible; isFreeRe = 0; break; } else { var msgPopup = new Data.loginControl("您还没有登录 无法查询空闲~"); msgPopup.LeftClick += (s, c) => { Frame rootFrame = Window.Current.Content as Frame; rootFrame.Navigate(typeof(LoginPage)); }; msgPopup.RightClick += (s, c) => { new MessageDialog("您可以先去社区逛一逛~"); }; msgPopup.ShowWIndow(); break; } case "Card": var a = await Launcher.LaunchUriAsync(new Uri("cquptcard:")); MoreFrame.Visibility = Visibility.Collapsed; break; case "freshMan": Frame.Navigate(typeof(FirstPage)); MoreFrame.Visibility = Visibility.Collapsed; isFreeRe = 0; break; case "Electricity": Frame.Navigate(typeof(ElectricityPage)); MoreFrame.Visibility = Visibility.Collapsed; isFreeRe = 0; break; default: break; } } }
private async void liskButton_Click(object sender, RoutedEventArgs e) { //TODO:未登陆时 不能点赞 //if (appSetting.Values.ContainsKey("idNum")) try { var vault = new Windows.Security.Credentials.PasswordVault(); var credentialList = vault.FindAllByResource(resourceName); credentialList[0].RetrievePassword(); if (credentialList.Count > 0) { var b = sender as Button; string num_id = b.TabIndex.ToString(); Debug.WriteLine(num_id); Debug.WriteLine("id " + num_id.Substring(2)); string like_num = ""; try { if (int.Parse(num_id[0].ToString()) < 5) //hot { HotFeed hotfeed = ViewModel.HotFeeds.First(p => p.article_id.Equals(num_id.Substring(2))); if (hotfeed.is_my_Like == "true" || hotfeed.is_my_Like == "True") { like_num = await CommunityFeedsService.setPraise(hotfeed.type_id, num_id.Substring(2), false); if (like_num != "") { hotfeed.like_num = like_num; hotfeed.is_my_Like = "false"; if (ViewModel.BBDD.Count(p => p.id.Equals(num_id.Substring(2))) != 0) { BBDDFeed s = ViewModel.BBDD.First(p => p.id.Equals(num_id.Substring(2))); if (s != null) { s.like_num = like_num; s.is_my_like = "false"; } } } } else { like_num = await CommunityFeedsService.setPraise(hotfeed.type_id, num_id.Substring(2), true); if (like_num != "") { hotfeed.like_num = like_num; hotfeed.is_my_Like = "true"; if (ViewModel.BBDD.Count(p => p.id.Equals(num_id.Substring(2))) != 0) { BBDDFeed s = ViewModel.BBDD.First(p => p.id.Equals(num_id.Substring(2))); if (s != null) { s.like_num = like_num; s.is_my_like = "true"; } } } } } else if (num_id[0] == '5') //bbdd { BBDDFeed bbddfeed = ViewModel.BBDD.First(p => p.id.Equals(num_id.Substring(2))); if (bbddfeed.is_my_like == "true" || bbddfeed.is_my_like == "True") { like_num = await CommunityFeedsService.setPraise(bbddfeed.type_id, num_id.Substring(2), false); if (like_num != "") { bbddfeed.like_num = like_num; bbddfeed.is_my_like = "false"; if (ViewModel.HotFeeds.Count(p => p.article_id.Equals(num_id.Substring(2))) != 0) { HotFeed h = ViewModel.HotFeeds.First(p => p.article_id.Equals(num_id.Substring(2))); if (h != null) { h.like_num = like_num; h.is_my_Like = "false"; } } } } else { like_num = await CommunityFeedsService.setPraise(bbddfeed.type_id, num_id.Substring(2), true); if (like_num != "") { bbddfeed.like_num = like_num; bbddfeed.is_my_like = "true"; if (ViewModel.HotFeeds.Count(p => p.article_id.Equals(num_id.Substring(2))) != 0) { HotFeed h = ViewModel.HotFeeds.First(p => p.article_id.Equals(num_id.Substring(2))); if (h != null) { h.like_num = like_num; h.is_my_Like = "true"; } } } } } } catch (Exception) { Debug.WriteLine("点赞异常"); } } else { var msgPopup = new Data.loginControl("您还没有登录 无法点赞~"); msgPopup.LeftClick += (s, c) => { Frame rootFrame = Window.Current.Content as Frame; rootFrame.Navigate(typeof(LoginPage)); }; msgPopup.RightClick += (s, c) => { Debug.WriteLine("您可以先去社区逛一逛~"); }; msgPopup.ShowWIndow(); } } catch { var msgPopup = new Data.loginControl("您还没有登录 无法点赞~"); msgPopup.LeftClick += (s, c) => { Frame rootFrame = Window.Current.Content as Frame; rootFrame.Navigate(typeof(LoginPage)); }; msgPopup.RightClick += (s, c) => { Debug.WriteLine("您可以先去社区逛一逛~"); }; msgPopup.ShowWIndow(); } }
private void CommunityAddAppBarButton_Click(object sender, RoutedEventArgs e) { //TODO:未登陆时 无法发表新帖 CommunityFrame.Visibility = Visibility.Visible; SystemNavigationManager.GetForCurrentView().BackRequested += App_BackRequested; SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible; //if (appSetting.Values.ContainsKey("idNum")) try { var vault = new Windows.Security.Credentials.PasswordVault(); var credentialList = vault.FindAllByResource(resourceName); credentialList[0].RetrievePassword(); if (credentialList.Count > 0) CommunityFrame.Navigate(typeof(CommunityAddPage)); else { var msgPopup = new Data.loginControl("您还没有登录 无法发布新帖~"); msgPopup.LeftClick += (s, c) => { Frame rootFrame = Window.Current.Content as Frame; rootFrame.Navigate(typeof(LoginPage)); }; msgPopup.RightClick += (s, c) => { Debug.WriteLine("您可以先去社区逛一逛~"); }; msgPopup.ShowWIndow(); } } catch { var msgPopup = new Data.loginControl("您还没有登录 无法发布新帖~"); msgPopup.LeftClick += (s, c) => { Frame rootFrame = Window.Current.Content as Frame; rootFrame.Navigate(typeof(LoginPage)); }; msgPopup.RightClick += (s, c) => { Debug.WriteLine("您可以先去社区逛一逛~"); }; msgPopup.ShowWIndow(); } }
private async void MoreListView_ItemClick(object sender, ItemClickEventArgs e) { var item = e.ClickedItem as Morepageclass; if ((MoreListgrid.Width == 300) || item.UniqueID == "Card") { //MoreBackAppBarButton.Visibility = Visibility.Collapsed; SystemNavigationManager.GetForCurrentView().BackRequested -= App_BackRequested; SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed; } else { //MoreBackAppBarButton.Visibility = Visibility.Visible; SystemNavigationManager.GetForCurrentView().BackRequested += App_BackRequested; SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible; HubSectionKBTitle.Text = item.Itemname; } //MoreFrame.Visibility = Visibility.Visible; MoreContentTitleTextBlock.Text = item.Itemname; //TODO:未登陆时 没有 补考/考试/分数信息 可查询空闲 无法自动添加自己的信息 Debug.WriteLine(item.UniqueID); { int count; var vault = new Windows.Security.Credentials.PasswordVault(); try { var credentialList = vault.FindAllByResource(resourceName); count = credentialList.Count; } catch { count = 0; } switch (item.UniqueID) { case "ReExam": //if (appSetting.Values.ContainsKey("idNum")) if (count > 0) { MoreFrame.Navigate(typeof(ExamPage), 3); ; MoreFrame.Visibility = Visibility.Visible; isFreeRe = 0; break; } else { var msgPopup = new Data.loginControl("您还没有登录 无法查看补考信息~"); msgPopup.LeftClick += (s, c) => { Frame rootFrame = Window.Current.Content as Frame; rootFrame.Navigate(typeof(LoginPage)); }; msgPopup.RightClick += (s, c) => { new MessageDialog("您可以先去社区逛一逛~"); }; msgPopup.ShowWIndow(); break; } case "Exam": //if (appSetting.Values.ContainsKey("idNum")) if (count > 0) { MoreFrame.Navigate(typeof(ExamPage), 2); MoreFrame.Visibility = Visibility.Visible; isFreeRe = 0; break; } else { var msgPopup = new Data.loginControl("您还没有登录 无法查看考试信息~"); msgPopup.LeftClick += (s, c) => { Frame rootFrame = Window.Current.Content as Frame; rootFrame.Navigate(typeof(LoginPage)); }; msgPopup.RightClick += (s, c) => { new MessageDialog("您可以先去社区逛一逛~"); }; msgPopup.ShowWIndow(); break; } case "Socre": //if (appSetting.Values.ContainsKey("idNum")) if (count > 0) { MoreFrame.Navigate(typeof(ScorePage)); MoreFrame.Visibility = Visibility.Visible; isFreeRe = 0; break; } else { var msgPopup = new Data.loginControl("您还没有登录 无法查看成绩~"); msgPopup.LeftClick += (s, c) => { Frame rootFrame = Window.Current.Content as Frame; rootFrame.Navigate(typeof(LoginPage)); }; msgPopup.RightClick += (s, c) => { new MessageDialog("您可以先去社区逛一逛~"); }; msgPopup.ShowWIndow(); break; } case "ClassRoom": //if (appSetting.Values.ContainsKey("idNum")) if (count > 0) { MoreFrame.Navigate(typeof(EmptyRoomsPage)); MoreFrame.Visibility = Visibility.Visible; isFreeRe = 0; break; } else { var msgPopup = new Data.loginControl("您还没有登录 无法查询空教室~"); msgPopup.LeftClick += (s, c) => { Frame rootFrame = Window.Current.Content as Frame; rootFrame.Navigate(typeof(LoginPage)); }; msgPopup.RightClick += (s, c) => { new MessageDialog("您可以先去社区逛一逛~"); }; msgPopup.ShowWIndow(); break; } case "Calendar": MoreFrame.Navigate(typeof(CalendarPage)); MoreFrame.Visibility = Visibility.Visible; isFreeRe = 0; break; case "FreeTime": if (count > 0) { MoreFrame.Navigate(typeof(SearchFreeTimeNumPage)); MoreFrame.Visibility = Visibility.Visible; isFreeRe = 0; break; } else { var msgPopup = new Data.loginControl("您还没有登录 无法查询空闲~"); msgPopup.LeftClick += (s, c) => { Frame rootFrame = Window.Current.Content as Frame; rootFrame.Navigate(typeof(LoginPage)); }; msgPopup.RightClick += (s, c) => { new MessageDialog("您可以先去社区逛一逛~"); }; msgPopup.ShowWIndow(); break; } case "Card": var a = await Launcher.LaunchUriAsync(new Uri("cquptcard:")); MoreFrame.Visibility = Visibility.Collapsed; break; default: break; } } }
/// <summary> /// Navigate to the Page for the selected <paramref name="listViewItem"/>. /// </summary> /// <param name="sender"></param> /// <param name="listViewItem"></param> private async void NavMenuList_ItemInvoked(object sender, ListViewItem listViewItem) { var item = (NavMenuItem)((NavMenuListView)sender).ItemFromContainer(listViewItem); if (item != null) { if (item.DestPage != null && item.DestPage != this.AppFrame.CurrentSourcePageType) { //appSetting.Values["CommunityPerInfo"] = false; //TODO:未登录时 不能传入社区个人信息和个人信息页信息 谨慎处理 //if (!bool.Parse(appSetting.Values["CommunityPerInfo"].ToString()) && (item.DestPage == typeof(MyPage) || item.DestPage == typeof(CommunityPage))) try { var vault = new Windows.Security.Credentials.PasswordVault(); var credentialList = vault.FindAllByResource(resourceName); credentialList[0].RetrievePassword(); if (!bool.Parse(appSetting.Values["CommunityPerInfo"].ToString()) && (item.DestPage == typeof(MyPage))) { if (credentialList.Count > 0) { BackOpacityGrid.Visibility = Visibility.Visible; loadingStackPanel.Visibility = Visibility.Visible; List <KeyValuePair <String, String> > paramList = new List <KeyValuePair <String, String> >(); //paramList.Add(new KeyValuePair<string, string>("stuNum", appSetting.Values["stuNum"].ToString())); //paramList.Add(new KeyValuePair<string, string>("idNum", appSetting.Values["idNum"].ToString())); paramList.Add(new KeyValuePair <string, string>("stuNum", credentialList[0].UserName)); paramList.Add(new KeyValuePair <string, string>("idNum", credentialList[0].Password)); string perInfo = await NetWork.getHttpWebRequest("cyxbsMobile/index.php/Home/Person/search", paramList); if (perInfo != "") { JObject jPerInfo = JObject.Parse(perInfo); if (jPerInfo["data"].ToString() == "") { var dig = new MessageDialog("没有完善资料不能登入友谊的小船哟"); var btnOk = new UICommand("马上完善"); dig.Commands.Add(btnOk); var btnCancel = new UICommand("暂时不了"); dig.Commands.Add(btnCancel); var result = await dig.ShowAsync(); if (null != result && result.Label == "马上完善") { Debug.WriteLine("添加信息"); BackOpacityGrid.Visibility = Visibility.Collapsed; loadingStackPanel.Visibility = Visibility.Collapsed; this.AppFrame.Navigate(typeof(SetPersonInfoPage), item.DestPage); } else if (null != result && result.Label == "暂时不了") { BackOpacityGrid.Visibility = Visibility.Collapsed; loadingStackPanel.Visibility = Visibility.Collapsed; } } else { appSetting.Values["CommunityPerInfo"] = true; appSetting.Values["Community_people_id"] = jPerInfo["data"]["id"].ToString(); appSetting.Values["Community_nickname"] = jPerInfo["data"]["nickname"].ToString(); appSetting.Values["Community_headimg_src"] = jPerInfo["data"]["photo_src"].ToString(); appSetting.Values["Community_introduction"] = jPerInfo["data"]["introduction"].ToString(); appSetting.Values["Community_phone"] = jPerInfo["data"]["phone"].ToString(); appSetting.Values["Community_qq"] = jPerInfo["data"]["qq"].ToString(); Debug.WriteLine(appSetting.Values["Community_headimg_src"].ToString()); Debug.WriteLine(jPerInfo["data"]["id"].ToString()); BackOpacityGrid.Visibility = Visibility.Collapsed; loadingStackPanel.Visibility = Visibility.Collapsed; if ((item.DestPage != typeof(MyPage))) { this.AppFrame.Navigate(item.DestPage, item.Arguments); } SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed; } } } else { if ((item.DestPage != typeof(MyPage))) { this.AppFrame.Navigate(item.DestPage, item.Arguments); var msgPopup = new Data.loginControl("您还没有登录 不能访问个人中心~"); msgPopup.LeftClick += (s, c) => { Frame rootFrame = Window.Current.Content as Frame; rootFrame.Navigate(typeof(LoginPage)); }; msgPopup.RightClick += (s, c) => { new MessageDialog("您可以先去社区逛一逛~"); }; msgPopup.ShowWIndow(); } else { var msgPopup = new Data.loginControl("您还没有登录 不能访问个人中心~"); msgPopup.LeftClick += (s, c) => { Frame rootFrame = Window.Current.Content as Frame; rootFrame.Navigate(typeof(LoginPage)); }; msgPopup.RightClick += (s, c) => { new MessageDialog("您可以先去社区逛一逛~"); }; msgPopup.ShowWIndow(); } } } else { this.AppFrame.Navigate(item.DestPage, item.Arguments); SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed; } } catch { if (!bool.Parse(appSetting.Values["CommunityPerInfo"].ToString()) && (item.DestPage == typeof(MyPage))) { if ((item.DestPage != typeof(MyPage))) { this.AppFrame.Navigate(item.DestPage, item.Arguments); var msgPopup = new Data.loginControl("您还没有登录 不能访问个人中心~"); msgPopup.LeftClick += (s, c) => { Frame rootFrame = Window.Current.Content as Frame; rootFrame.Navigate(typeof(LoginPage)); }; msgPopup.RightClick += (s, c) => { new MessageDialog("您可以先去社区逛一逛~"); }; msgPopup.ShowWIndow(); } else { var msgPopup = new Data.loginControl("您还没有登录 不能访问个人中心~"); msgPopup.LeftClick += (s, c) => { Frame rootFrame = Window.Current.Content as Frame; rootFrame.Navigate(typeof(LoginPage)); }; msgPopup.RightClick += (s, c) => { new MessageDialog("您可以先去社区逛一逛~"); }; msgPopup.ShowWIndow(); } } else { this.AppFrame.Navigate(item.DestPage, item.Arguments); SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed; } } } } }