private async void PostToCirclePage_Loaded(object sender, RoutedEventArgs arg) { LoadingIcon.Display(); OwnCircles = await DataRequester.GetOwnCircles(); if (OwnCircles.Circles != null && OwnCircles.Circles.Count > 0) { CurrentCircle = OwnCircles.Circles[0]; CurrentCircleBtn.Content = CurrentCircle.Name; OwnCircles.Circles.ForEach(circle => { var menuItem = new MenuFlyoutItem() { Text = circle.Name, Tag = circle }; menuItem.Click += (s, e) => { CurrentCircle = ((OwnCircleInfo)((MenuFlyoutItem)s).Tag); CurrentCircleBtn.Content = CurrentCircle.Name; }; CircleMenu.Items.Add(menuItem); }); } else if (_needCreateCircle) { LLQNotifier.Default.Notify(new StoryEvent() { Type = StoryEventType.CreateCircle }); PopupMessage.DisplayMessageInRes("NoCircle"); } LoadingIcon.Hide(); }
private async void ShareWeiBo(object sender, RoutedEventArgs e) { if (VM == null || VM.MainHtmlContent == null) { return; } Animator.Use(AnimationType.ZoomOutUp).SetDuration(TimeSpan.FromMilliseconds(800)).PlayOn(WeiboSharePopup, () => { WeiboSharePopup.IsOpen = false; var transform = (CompositeTransform)AnimUtil.PrepareTransform(WeiboSharePopup, typeof(CompositeTransform)); transform.CenterX = transform.CenterY = 0; transform.ScaleX = transform.ScaleY = 1; transform.TranslateX = transform.TranslateY = 0; WeiboSharePopup.Opacity = 1; }); WeiboSDKForWinRT.SdkNetEngine engine = new WeiboSDKForWinRT.SdkNetEngine(); var response = await engine.RequestCmd(WeiboSDKForWinRT.SdkRequestType.POST_MESSAGE, new WeiboSDKForWinRT.CmdPostMessage() { Status = PostMsg.Text }); if (response.errCode == WeiboSDKForWinRT.SdkErrCode.SUCCESS) { PopupMessage.DisplayMessageInRes("ShareSuccess"); } else { PopupMessage.DisplayMessageInRes("ShareFailed"); } }
public async void JoinCircle() { if (!AuthorizationHelper.IsLogin) { PopupMessage.DisplayMessageInRes("NeedLogin"); return; } if (Misc.ZhiHuCircleId.ToString() == CircleId && JoinCircleButtonIcon == _checkIcon) { PopupMessage.DisplayMessageInRes("CannotQuitZhiHuCircle"); return; } if (JoinCircleButtonIcon == _addIcon) { JoinCircleButtonIcon = _checkIcon; await DataRequester.JoinCircle(CircleId); PopupMessage.DisplayMessageInRes("JoinCircleSuccess"); } else { JoinCircleButtonIcon = _addIcon; await DataRequester.QuitCircle(CircleId); PopupMessage.DisplayMessageInRes("QuitCircleSuccess"); } }
private void OnWeiBoLogin(object sender, RoutedEventArgs e) { Hide(); LoadingIcon.Display(); AuthorizationHelper.Login(LoginType.Sina, null, loginSuccess => { if (loginSuccess) { PopupMessage.DisplayMessageInRes("LoginSuccess"); var info = StorageInfo.Instance.ZhiHuAuthoInfo; if (info == null) { return; } LLQNotifier.Default.Notify(new LoginEvent() { IsLogin = true, UserPhotoUrl = info.avatar }); } else { PopupMessage.DisplayMessageInRes("LoginFailed"); } LoadingIcon.Hide(); }); }
private void CreateCircle_Click(object sender, RoutedEventArgs e) { if (!AuthorizationHelper.IsLogin) { PopupMessage.DisplayMessageInRes("NeedLogin"); return; } LLQNotifier.Default.Notify(new StoryEvent() { Type = StoryEventType.CreateCircle }); }
private void MyFav_Click(object sender, RoutedEventArgs e) { if (!AuthorizationHelper.IsLogin) { PopupMessage.DisplayMessageInRes("NeedLogin"); return; } VM.CurrentCategoryId = Misc.Favorite_Category_Id; VM.CategoryName = string.Format(StringUtil.GetString("FavCategoryName"), 0); MainListView.SetRefresh(true); ResetCategoryPanel(); }
private void ShareToWeiBo(object sender, RoutedEventArgs e) { if (!AuthorizationHelper.IsLogin) { PopupMessage.DisplayMessageInRes("NeedLogin"); Animator.Use(AnimationType.Shake).PlayOn(ShareButton); return; } LLQNotifier.Default.Notify(new StoryEvent() { Type = StoryEventType.ShareToWeiBo }); }
private void DelComment(object sender, RoutedEventArgs e) { if (!AuthorizationHelper.IsLogin) { PopupMessage.DisplayMessageInRes("NeedLogin"); Animator.Use(AnimationType.Shake).PlayOn(CommentDel); return; } Animator.Use(AnimationType.TakingOff).PlayOn(CommentReply); LLQNotifier.Default.Notify(new CommentEvent() { Type = CommentEventType.Delete, Comment = (Comment)DataContext }); }
private void FavStatusChanged(object sender, ToggleEventArgs e) { if (!AuthorizationHelper.IsLogin) { PopupMessage.DisplayMessageInRes("NeedLogin"); Animator.Use(AnimationType.Shake).PlayOn(FavButton); e.IsCancel = true; return; } Animator.Use(AnimationType.Bounce).PlayOn(FavButton); LLQNotifier.Default.Notify(new StoryEvent() { Type = StoryEventType.Fav, IsChecked = e.IsChecked }); }
private void LikeStatusChanged(object sender, ToggleEventArgs e) { if (!AuthorizationHelper.IsLogin) { PopupMessage.DisplayMessageInRes("NeedLogin"); Animator.Use(AnimationType.Shake).PlayOn(LikeButton); e.IsCancel = true; return; } LikeCount = (int.Parse(LikeCount) + (e.IsChecked ? 1 : -1)).ToString(); Animator.Use(AnimationType.StandUp).PlayOn(LikeButton); LLQNotifier.Default.Notify(new StoryEvent() { Type = StoryEventType.Like, IsChecked = e.IsChecked }); }
private async void SendComment() { if (!AuthorizationHelper.IsLogin) { PopupMessage.DisplayMessageInRes("NeedLogin"); return; } if (string.IsNullOrEmpty(VM.CommentContent)) { return; } await VM.SendComment(); VM.CommentContent = ""; CommentListView.SetRefresh(true); }
private void Login(object sender, RoutedEventArgs e) { VM.UserName = StringUtil.GetString("Logining"); AuthorizationHelper.Login(LoginType.Sina, (isSuccess, msg) => { if (isSuccess) { VM.LoginSuccess(); PopupMessage.DisplayMessageInRes("LoginSuccess"); } else { PopupMessage.DisplayMessageInRes("LoginFailed"); VM.UserName = StringUtil.GetString("PleaseLogin"); } }); ResetCategoryPanel(); }
private async Task <bool> CheckCaptcha(string captcha) { var captchaChecked = await DataRequester.CheckCaptcha(captcha); if (captchaChecked != null && captchaChecked.Success) { return(true); } if (captchaChecked != null && captchaChecked.Error != null && !string.IsNullOrEmpty(captchaChecked.Error.Message)) { PopupMessage.DisplayMessage(captchaChecked.Error.Message); } else { PopupMessage.DisplayMessageInRes("CaptchaCheckFailed"); } return(false); }
private async void CreateCircle(object sender, RoutedEventArgs arg) { var title = CircleTitle.Text; var desc = CircleDesc.Text; if (string.IsNullOrEmpty(title)) { PopupMessage.DisplayMessageInRes("CreateCircleError"); return; } var rst = await DataRequester.CreateCircle(title, desc); if (rst.Id < 1) { PopupMessage.DisplayMessage(rst.Error_Msg); return; } PopupMessage.DisplayMessageInRes("CreateCircleSuccess"); NavigationManager.Instance.GoBack(); }
private bool CheckError(ErrorBase error) { if (error == null) { PopupMessage.DisplayMessageInRes("LoginFailed"); return(false); } if (error.Error != null) { if (string.IsNullOrEmpty(error.Error.Message)) { PopupMessage.DisplayMessageInRes("LoginFailed"); } else { PopupMessage.DisplayMessage(error.Error.Message); } return(false); } return(true); }
private void LikeComment(object sender, ToggleEventArgs e) { if (IsOwner) { e.IsCancel = true; return; } if (!AuthorizationHelper.IsLogin) { PopupMessage.DisplayMessageInRes("NeedLogin"); Animator.Use(AnimationType.Shake).PlayOn(CommentLike); e.IsCancel = true; return; } CommentLikeCount = CommentLikeCount + (e.IsChecked ? 1 : -1); Animator.Use(AnimationType.StandUp).PlayOn(CommentLike); LLQNotifier.Default.Notify(new CommentEvent() { Type = CommentEventType.Like, Comment = (Comment)DataContext, IsLike = e.IsChecked }); }
private async void PostStory(object sender, RoutedEventArgs arg) { var title = StoryTitle.Text; var url = StoryUrl.Text; var reason = StoryReason.Text; if (CurrentCircle == null) { PopupMessage.DisplayMessageInRes("PostToCircleNeedCircle"); return; } if (string.IsNullOrEmpty(url) || string.IsNullOrEmpty(title)) { PopupMessage.DisplayMessageInRes("PostToCircleError"); return; } await DataRequester.PostToCircle(url, title, reason, new List <int>() { CurrentCircle.Id }); PopupMessage.DisplayMessageInRes("PostToCircleSuccess"); NavigationManager.Instance.GoBack(); }
private void OnLogin(object sender, RoutedEventArgs e) { var userName = UserNameTxt.Text.Trim(); userName = StringUtil.CheckPhoneNum(userName) ? "+86" + userName : userName; var password = PasswordTxt.Password.Trim(); var captcha = CaptchaTxt.Text.Trim(); LoadingIcon.Display(); AuthorizationHelper.Login(LoginType.ZhiHu, new ZhiHuLoginInfo() { Captcha = NeedCaptcha ? captcha : null, UserName = userName, Password = password }, loginSuccess => { if (loginSuccess) { PopupMessage.DisplayMessageInRes("LoginSuccess"); var info = StorageInfo.Instance.ZhiHuAuthoInfo; if (info == null) { return; } LLQNotifier.Default.Notify(new LoginEvent() { IsLogin = true, UserPhotoUrl = info.avatar }); Hide(); } else { GetCaptchaImage(); } LoadingIcon.Hide(); }); }
private void DownloadButton_Click(object sender, RoutedEventArgs e) { PopupMessage.DisplayMessageInRes("Inprogress"); }