public KbArticlesDetailsPage(KbArticles kbArticles) { InitializeComponent(); Xamarin.Forms.PlatformConfiguration.iOSSpecific.Page.SetUseSafeArea(this, true); this.kbArticles = kbArticles; BindingContext = new KbArticlesDetailsViewModel(kbArticles); if (Device.Android == Device.RuntimePlatform) { var cancel = new ToolbarItem { Text = "分享", Command = new Command(() => { DependencyService.Get <IShares>().Shares("http://kb.cnblogs.com/page/" + kbArticles.Id + "/", kbArticles.Title); }), Icon = "toolbar_share.png" }; ToolbarItems.Add(cancel); } formsWebView.OnContentLoaded += delegate(object sender, EventArgs e) { RefreshKbArticles(); }; }
public KbArticlesDetailsPage(KbArticles kbArticles) { this.kbArticles = kbArticles; InitializeComponent(); BindingContext = new KbArticlesDetailsViewModel(kbArticles); var cancel = new ToolbarItem { Text = "分享", Command = new Command(() => { DependencyService.Get <IShares>().Shares("http://kb.cnblogs.com/page/" + kbArticles.Id + "/", kbArticles.Title); }) }; ToolbarItems.Add(cancel); if (Device.Android == Device.RuntimePlatform) { cancel.Icon = "toolbar_share.png"; } formsWebView.OnContentLoaded += delegate(object sender, EventArgs e) { RefreshKbArticles(); }; }
public KbArticlesDetailsPage(KbArticles kbArticles) { InitializeComponent(); Xamarin.Forms.PlatformConfiguration.iOSSpecific.Page.SetUseSafeArea(this, true); this.kbArticles = kbArticles; BindingContext = new KbArticlesDetailsViewModel(kbArticles); var bookmarks = new ToolbarItem { Text = "收藏", Command = new Command(async() => { if (UserTokenSettings.Current.HasExpiresIn()) { MessagingService.Current.SendMessage(MessageKeys.NavigateLogin); } else { var url = "http://kb.cnblogs.com/page/" + kbArticles.Id + "/"; await NavigationService.PushAsync(Navigation, new BookmarksEditPage(new Bookmarks() { Title = kbArticles.Title, LinkUrl = url, FromCNBlogs = true })); } }), Icon = "icon_bookmarks.png" }; ToolbarItems.Add(bookmarks); if (Device.Android == Device.RuntimePlatform) { var cancel = new ToolbarItem { Text = "分享", Command = new Command(() => { DependencyService.Get <IShares>().Shares("http://kb.cnblogs.com/page/" + kbArticles.Id + "/", kbArticles.Title); }), Icon = "toolbar_share.png" }; ToolbarItems.Add(cancel); } formsWebView.OnContentLoaded += delegate(object sender, EventArgs e) { RefreshKbArticles(); }; }