private void 添加到收藏夹ToolStripMenuItem_Click(object sender, EventArgs e) { ShellUIHelper ui = new ShellUIHelper(); object title = WebBrowserProperty.frontProperty.siteTitle; ui.AddFavorite(WebBrowserProperty.frontProperty.webBrowser.LocationURL, ref title); }
/// <summary> /// Execute the command /// </summary> public override void Execute() { // determine the current URL and Title string url = Browser.LocationURL; object title = Browser.LocationName; // add to favorites ShellUIHelper.AddFavorite(url, ref title); }
/// <summary> /// 调用系统的“添加到收藏夹” /// </summary> public static void AddFavorite(string url, string title) { ShellUIHelper helper = new ShellUIHelper(); if (string.IsNullOrEmpty(title)) { title = ABOUT_BLANK; } object o = title; helper.AddFavorite(url, ref o); //调用添加到收藏夹对话框 }