private void button_Click(object sender, RoutedEventArgs e) { this.button.IsEnabled = false; this.button.Content = "正在发送.."; action = new Action <bool, Exception>((b, ex) => { Dispatcher.BeginInvoke(() => { if (b) { AppUtils.ToastPromptShow("阅FM", "文章分享成功~"); } else { AppUtils.ToastPromptShow("阅FM", "文章分享失败,如重复出现,请尝试重新登录"); } }); }); switch (type) { case "weibo": SocialAPI.Client = SocialUtils.GetClient(SocialType.Weibo); SocialAPI.UpdateStatus(SocialType.Weibo, share, action); break; case "douban": SocialAPI.Client = SocialUtils.GetClient(SocialType.Douban); SocialAPI.UpdateStatus(SocialType.Douban, share, action); break; case "tencent": SocialAPI.Client = SocialUtils.GetClient(SocialType.Tencent); SocialAPI.UpdateStatus(SocialType.Tencent, share, action); break; default: break; } if (NavigationService.CanGoBack) { NavigationService.GoBack(); } }
private void LoadLoginControl() { AuthControl control = new AuthControl(); var type = SocialUtils.CurrentSocialType; control.SetData(type, SocialUtils.GetClient(type)); control.action += (p) => { Deployment.Current.Dispatcher.BeginInvoke(delegate { if (NavigationService.CanGoBack) { NavigationService.GoBack(); } }); }; this.LayoutRoot.Children.Add(control); }