private void buttonUserTasksAddTasks_Click(object sender, EventArgs e) { // Path to Windows system folder string systemFolder = Environment.GetFolderPath(Environment.SpecialFolder.System); // Add our user tasks jumpList.AddUserTasks(new JumpListLink(Path.Combine(systemFolder, "notepad.exe"), "Open Notepad") { IconReference = new IconReference(Path.Combine(systemFolder, "notepad.exe"), 0) }); jumpList.AddUserTasks(new JumpListLink(Path.Combine(systemFolder, "mspaint.exe"), "Open Paint") { IconReference = new IconReference(Path.Combine(systemFolder, "mspaint.exe"), 0) }); jumpList.AddUserTasks(new JumpListSeparator()); jumpList.AddUserTasks(new JumpListLink(Path.Combine(systemFolder, "calc.exe"), "Open Calculator") { IconReference = new IconReference(Path.Combine(systemFolder, "calc.exe"), 0) }); // Update status UpdateStatusBar("Three user tasks added to jump list"); }
private void AddJumpListItem(JumpListItem jli) { if (jli == JumpListItem.SeperatorItem) { _jumplist.AddUserTasks(new JumpListSeparator()); } else { string fullpath = new Uri(Assembly.GetExecutingAssembly().GetName().CodeBase).LocalPath; var task = new JumpListLink(fullpath, jli.Title); task.Arguments = "--jump-" + jli.Argument; if (jli.IconIndex != JumpListItem.InvalidIconIndex) { try { task.IconReference = new Microsoft.WindowsAPICodePack.Shell.IconReference(Path.Combine(System.Windows.Forms.Application.StartupPath, "IconPack.dll"), jli.IconIndex); } catch (Exception ex) { Trace.WriteLine("Error associating icon with jumplist item: " + ex); } } _jumplist.AddUserTasks(task); } }
private void OnlineJumpList(ref JumpList jumpList) { var f = new JumpListCustomCategory("Favorite Contacts"); foreach (var c in FavJumpListContacts) { var x = new JumpListLink(System.Windows.Forms.Application.ExecutablePath, c.Name); x.Arguments = "\"/jump:" + c.ID.GetHashCode() + "\""; //this.Try(() =>x.IconReference = new Microsoft.WindowsAPICodePack.Shell.IconReference(System.Windows.Forms.Application.ExecutablePath, 0)); f.AddJumpListItems(x); } jumpList.AddCustomCategories(f); //var task = new JumpListLink(System.Windows.Forms.Application.ExecutablePath, "Show Contact List"); //task.Arguments = "/show"; //jumpList.AddUserTasks(task); var task = new JumpListLink(System.Windows.Forms.Application.ExecutablePath, "Check for new Messages"); task.Arguments = "/check"; //this.Try(() => task.IconReference = new Microsoft.WindowsAPICodePack.Shell.IconReference(System.Windows.Forms.Application.ExecutablePath, 5)); jumpList.AddUserTasks(task); task = new JumpListLink(System.Windows.Forms.Application.ExecutablePath, "Sync Google Contacts Now"); task.Arguments = "/update_contacts"; //this.Try(() => task.IconReference = new Microsoft.WindowsAPICodePack.Shell.IconReference(System.Windows.Forms.Application.ExecutablePath, 5)); jumpList.AddUserTasks(task); }
internal static void RefreshJumpList(IntPtr handle, string shortcutsFolder, bool refreshOnTop) { JumpList jumpList = JumpList.CreateJumpListForIndividualWindow(TaskbarManager.Instance.ApplicationId, handle); if (refreshOnTop) { jumpList.AddUserTasks(new JumpListLink(Application.ExecutablePath, "Refresh jump list") { Arguments = BuildCommand("--dir", shortcutsFolder, "--refresh", "--pinned"), WorkingDirectory = Directory.GetCurrentDirectory(), }); jumpList.AddUserTasks(new JumpListSeparator()); } jumpList.AddUserTasks(ShortcutsToLinks(shortcutsFolder).ToArray()); if (!refreshOnTop) { jumpList.AddUserTasks(new JumpListSeparator()); jumpList.AddUserTasks(new JumpListLink(Application.ExecutablePath, "Refresh jump list") { Arguments = BuildCommand("--dir", shortcutsFolder, "--refresh", "--pinned", "--bottom"), WorkingDirectory = Directory.GetCurrentDirectory(), }); } jumpList.Refresh(); }
/// <summary> /// Builds the Jumplist /// </summary> private void BuildList() { JumpListCustomCategory userActionsCategory = new JumpListCustomCategory("Actions"); JumpListLink userActionLink = new JumpListLink(Assembly.GetEntryAssembly().Location, "Clear History"); userActionLink.Arguments = "-1"; userActionsCategory.AddJumpListItems(userActionLink); list.AddCustomCategories(userActionsCategory); string notepadPath = Path.Combine(Environment.SystemDirectory, "notepad.exe"); JumpListLink jlNotepad = new JumpListLink(notepadPath, "Notepad"); jlNotepad.IconReference = new IconReference(notepadPath, 0); string calcPath = Path.Combine(Environment.SystemDirectory, "calc.exe"); JumpListLink jlCalculator = new JumpListLink(calcPath, "Calculator"); jlCalculator.IconReference = new IconReference(calcPath, 0); string mspaintPath = Path.Combine(Environment.SystemDirectory, "mspaint.exe"); JumpListLink jlPaint = new JumpListLink(mspaintPath, "Paint"); jlPaint.IconReference = new IconReference(mspaintPath, 0); list.AddUserTasks(jlNotepad); list.AddUserTasks(jlPaint); list.AddUserTasks(new JumpListSeparator()); list.AddUserTasks(jlCalculator); list.Refresh(); }
/// <summary> /// Einträge in der JumpList (Aufgaben) des Tasks erzeugen /// 1. Notizen - StikyNot.exe /// 2. Snipping - Snipping.exe /// 3. Notepad - Notepad.exe /// </summary> void createTaksJumpList() { CustomJumpList = JumpList.CreateJumpList(); CustomJumpList.ClearAllUserTasks(); JumpListLink EntryNote = new JumpListLink(@"%windir%\system32\StikyNot.exe", "Notizen"); EntryNote.IconReference = new IconReference(@"%windir%\system32\StikyNot.exe", 0); CustomJumpList.AddUserTasks(EntryNote); JumpListLink EntrySnipp = new JumpListLink(@"%windir%\system32\SnippingTool.exe", "Snipping"); EntrySnipp.IconReference = new IconReference(@"%windir%\system32\SnippingTool.exe", 0); CustomJumpList.AddUserTasks(EntrySnipp); JumpListLink EntryNotepad = new JumpListLink(@"%windir%\system32\Notepad.exe", "Notepad"); EntryNotepad.IconReference = new IconReference(@"%windir%\system32\Notepad.exe", 0); CustomJumpList.AddUserTasks(EntryNotepad); JumpListLink EntryCmd = new JumpListLink(@"%windir%\system32\cmd.exe", "Eingabeaufforderung"); EntryCmd.IconReference = new IconReference(@"%windir%\system32\cmd.exe", 0); CustomJumpList.AddUserTasks(EntryCmd); if (!string.IsNullOrWhiteSpace(strTCmdPath)) { JumpListLink EntryTCM = new JumpListLink(strTCmdPath, "Total Commander - " + strTCmdVersion); EntryTCM.IconReference = new IconReference(strTCmdPath, 0); CustomJumpList.AddUserTasks(EntryTCM); } CustomJumpList.Refresh(); }
private void Form1_Shown(object sender, EventArgs e) { TaskbarManager.Instance.SetProgressValue(0, hscrTaskbarProgress.Maximum); TaskbarManager.Instance.SetOverlayIcon(this.Icon, "Taskbar Demo Application"); JumpList list = JumpList.CreateJumpList();//JumpList.CreateJumpListForIndividualWindow("TaskbarDemo.Form1", this.Handle); JumpListCustomCategory jcategory = new JumpListCustomCategory("My New Category"); list.ClearAllUserTasks(); string desktop = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); //jcategory.AddJumpListItems(new JumpListItem(Path.Combine(desktop, "a.abc"))); list.AddCustomCategories(jcategory); string systemFolder = Environment.GetFolderPath(Environment.SpecialFolder.System); //Add links to Tasks list.AddUserTasks(new JumpListLink(Path.Combine(systemFolder, "notepad.exe"), "Open Notepad") { IconReference = new IconReference(Path.Combine(systemFolder, "notepad.exe"), 0) }); list.AddUserTasks(new JumpListLink(Path.Combine(systemFolder, "calc.exe"), "Open Calculator") { IconReference = new IconReference(Path.Combine(systemFolder, "calc.exe"), 0) }); list.AddUserTasks(new JumpListSeparator()); list.AddUserTasks(new JumpListLink(Path.Combine(systemFolder, "mspaint.exe"), "Open Paint") { IconReference = new IconReference(Path.Combine(systemFolder, "mspaint.exe"), 0) }); //Adding links to RecentItems //list.AddToRecent(Path.Combine(systemFolder, "mspaint.exe")); list.Refresh(); }
protected override void OnContentRendered(EventArgs e) { base.OnContentRendered(e); // Disable the minimize button var hWnd = new WindowInteropHelper(this).Handle; var windowLong = GetWindowLong(hWnd, GWL_STYLE); windowLong = windowLong & ~WS_MAXIMIZEBOX; SetWindowLong(hWnd, GWL_STYLE, windowLong); _jumpList = JumpList.CreateJumpList(); _jumpList.Refresh(); var systemFolder = Environment.GetFolderPath(Environment.SpecialFolder.System); _jumpList.AddUserTasks(new JumpListLink(Path.Combine(systemFolder, "taskmgr.exe"), "启动任务管理器") { IconReference = new IconReference(Path.Combine(systemFolder, "taskmgr.exe"), 0) }); _jumpList.AddUserTasks(new JumpListLink(Path.Combine(systemFolder, "perfmon.exe"), "启动资源监视器") { IconReference = new IconReference(Path.Combine(systemFolder, "perfmon.exe"), 0), Arguments = "/res" }); _jumpList.Refresh(); }
/// <summary> /// Refreshes the jump list from data. /// </summary> private static void RefreshJumpListFromData() { try { if (TaskbarManager.IsPlatformSupported) { JumpListCustomCategory customCategory = new JumpListCustomCategory("Recent"); _jumpList = JumpList.CreateJumpList(); for (int count = _recentJumpList.Count - 1; count >= 0; count--) { JumpListLink jumpListLink = new JumpListLink(ExePath, _recentJumpList.ElementAt(count).Value); jumpListLink.Title = _recentJumpList.ElementAt(count).Value; if (_isAdmin) { jumpListLink.Arguments = AdminArgument + " " + _recentJumpList.ElementAt(count).Key; jumpListLink.IconReference = new IconReference(AdminIconPath, 0); } else { jumpListLink.Arguments = GameArgument + " " + _recentJumpList.ElementAt(count).Key; jumpListLink.IconReference = new IconReference(GameIconPath, 0); } customCategory.AddJumpListItems(jumpListLink); } _jumpList.AddCustomCategories(customCategory); if (_isAdmin) { // create new deck CMD _jumpList.AddUserTasks(new JumpListLink(ExePath, (string)Application.Current.FindResource("Resource_JumpList_Task_CreateNewCardDeck")) { Title = (string)Application.Current.FindResource("Resource_JumpList_Task_CreateNewCardDeck"), Arguments = CreateNewCardDeckArgument, IconReference = new IconReference(AdminIconPath, 0) }); } else //user, add task to launch the Admin { // Start Admin instance _jumpList.AddUserTasks(new JumpListLink(ExePath, (string)Application.Current.FindResource("Resource_JumpList_Task_StartAdmin")) { Title = (string)Application.Current.FindResource("Resource_JumpList_Task_StartAdmin"), Arguments = AdminArgument, IconReference = new IconReference(AdminIconPath, 0) }); } _jumpList.Refresh(); } } catch (Exception e) { Utils.LogException(MethodBase.GetCurrentMethod(), e); } }
private static void AddTaskLink(string title, string path, string arguments, Microsoft.WindowsAPICodePack.Shell.IconReference?icon) { var task = CreateJumpListLink(title, path, arguments, icon); list.AddUserTasks(task); if (AutoRefresh) { list.Refresh(); } }
private void JumpListeAkt() { JumpList list = JumpList.CreateJumpList(); list.ClearAllUserTasks(); for (int i = 0; i < _dict.Namen.Length; i++) { JumpListLink j = new JumpListLink(Application.ExecutablePath, _dict.Namen[i]); j.Arguments = i.ToString(); j.IconReference = new Microsoft.WindowsAPICodePack.Shell.IconReference(System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), "explorer.exe"), 0); list.AddUserTasks(j); } list.AddUserTasks(new JumpListLink(Application.StartupPath, "open directory")); list.Refresh(); }
private void MainFrm_Shown(object sender, EventArgs e) { string[] a = Environment.GetCommandLineArgs(); //Przyciski Aero Size s = new Size(16, 16); buttonFirst = new ThumbnailToolbarButton(new Icon(Friends_from_MegaVideo_player.Properties.Resources.back_arrowICO, s), "Odtwórz poprzedni"); buttonFirst.Click += new EventHandler <ThumbnailButtonClickedEventArgs>(odtwórzPoprzedniToolStripMenuItem_Click); buttonSecond = new ThumbnailToolbarButton(new Icon(Friends_from_MegaVideo_player.Properties.Resources.Forward_ArrowICO, s), "Odtwórz następny"); buttonSecond.Click += new EventHandler <ThumbnailButtonClickedEventArgs>(odtwórzNastęnyToolStripMenuItem_Click); windowsTaskbar.ThumbnailToolbars.AddButtons(this.Handle, buttonFirst, buttonSecond); //JumpLista JumpList Lista = JumpList.CreateJumpList(); IJumpListTask zadanie1 = new JumpListLink(@"E:\Gry\Moje dokumenty\Visual Studio 2010\Projects\Friends from MegaVideo player\Friends from MegaVideo player\bin\Debug\Friends from MegaVideo player.exe", "Uruchom notatnik") { IconReference = new Microsoft.WindowsAPICodePack.Shell.IconReference(@"E:\Gry\Moje dokumenty\Visual Studio 2010\Projects\Friends from MegaVideo player\Friends from MegaVideo player\bin\Debug\Friends from MegaVideo player.exe", 0), Title = @"c:\widnows\notepad.exe" }; Lista.AddUserTasks(zadanie1); Lista.Refresh(); }
public void CreateJumplists() { JumpList list = JumpList.CreateJumpListForIndividualWindow(TaskbarManager.Instance.ApplicationId, _hwnd); JumpListCustomCategory userActionsCategory = new JumpListCustomCategory("Actions"); JumpListLink userActionLink = new JumpListLink(Assembly.GetEntryAssembly().Location, "Clear History"); userActionLink.Arguments = "-jumplist:gogo"; //add this link to the Actions Category userActionsCategory.AddJumpListItems(userActionLink); //finally add the category to the JumpList list.AddCustomCategories(userActionsCategory); //get the notepad.exe path string notepadPath = Path.Combine(Environment.SystemDirectory, "notepad.exe"); //attach it to the JumpListLink JumpListLink jlNotepad = new JumpListLink(notepadPath, "Notepad"); //set its icon path jlNotepad.IconReference = new IconReference(notepadPath, 0); //add it to the list list.AddUserTasks(jlNotepad); list.Refresh(); }
public static void Update() { if (IsSupported()) { JumpList jumpList = JumpList.CreateJumpList(); List <Prog> progs = new ProgList().GetJumpList(); progs.Reverse(); foreach (Prog prog in progs) { var task = new JumpListLink(System.Reflection.Assembly.GetEntryAssembly().Location, prog.Name) { Arguments = "start " + prog.ID }; if (File.Exists(prog.Icon)) { task.IconReference = new IconReference(@prog.Icon, 0); } task.WorkingDirectory = Environment.CurrentDirectory; jumpList.AddUserTasks(task); } jumpList.Refresh(); } }
public void RebindProfiles(IEnumerable <ClientProfile> profiles) { JumpListCustomCategory category = new JumpListCustomCategory("Profiles"); int currentIndex = 0; foreach (var profile in profiles) { JumpListLink link = new JumpListLink(Application.ExecutablePath, "--load-profile-" + currentIndex); link.Title = profile.ProfileName; link.Arguments = "--load-profile-" + currentIndex.ToString(); link.IconReference = JumpListIconManager.CreateIconForClient(profile.Client); currentIndex++; category.AddJumpListItems(link); } JumpList list = JumpList.CreateJumpList(); list.ClearAllUserTasks(); list.AddCustomCategories(category); JumpListLink newProfileLink = new JumpListLink(Application.ExecutablePath, "New Profile..."); newProfileLink.Arguments = "--new-profile"; newProfileLink.IconReference = new IconReference(Application.ExecutablePath, 0); list.AddUserTasks(newProfileLink); list.Refresh(); }
public void AddLink([Required] string title, [Required] string path, string arguments = null, string iconPath = null, int iconNumber = 0, string categoryName = null) { var task = CreateJumpListLink(title, path, arguments, CreateIconReference(iconPath, iconNumber)); if (!string.IsNullOrWhiteSpace(categoryName)) { if (!_categories.TryGetValue(categoryName, out var category)) { category = new JumpListCustomCategory(categoryName); _categories.Add(categoryName, category); _jumpList.AddCustomCategories(category); } category.AddJumpListItems(task); } else { _jumpList.AddUserTasks(task); } if (AutoRefresh) { _jumpList.Refresh(); } }
void RebuildRecentJumpList() { if (!File.Exists(_recentFiles)) { return; } var files = File.ReadAllLines(_recentFiles); _jumpList = JumpList.CreateJumpList(); List <JumpListTask> tasks = new List <JumpListTask>(); List <JumpListCustomCategory> cats = new List <JumpListCustomCategory>(); foreach (var item in files) { var fi = new FileInfo(item); var task = new JumpListLink(Assembly.GetEntryAssembly().Location, fi.Name + " (" + fi.DirectoryName + ")"); task.WorkingDirectory = fi.DirectoryName; task.Arguments = item; tasks.Add(task); } _jumpList.AddUserTasks(tasks.ToArray()); _jumpList.Refresh(); }
void onWindowShown(object sender, EventArgs e) { // create a new jump list JumpList jumpList = JumpList.CreateJumpList(); // create a user task jumpList.AddUserTasks(new JumpListLink("cmd.exe", "Open Command Prompt")); // create a user task with an icon jumpList.AddUserTasks(new JumpListLink("notepad.exe", "Open Notepad") { IconReference = new IconReference("notepad.exe", 0) }); // create a user task with a document jumpList.AddUserTasks(new JumpListLink(@"C:\Users\Adam\Desktop\test.txt", "Open Text File")); }
/// <summary> /// Creates a new taskbar jump list. /// </summary> /// <param name="mainWindow">The main window.</param> /// <param name="tasks">List of tasks that should be added to the jump list.</param> public virtual void AddTasks(params JumpListTask[] tasks) { if (tasks == null || tasks.Length == 0) { return; } JumpList.AddUserTasks(tasks); JumpList.Refresh(); }
private void initializeJumplist() { string strAppDir = System.IO.Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); string app = Assembly.GetEntryAssembly().GetName().Name + ".exe"; WindowJumpList.AddUserTasks(new JumpListLink( System.IO.Path.Combine(executableFolder, app), "Home") { Arguments = "HomeActive" }); WindowJumpList.AddUserTasks(new JumpListLink( System.IO.Path.Combine(executableFolder, app), "Shopping") { Arguments = "ShoppingActive" }); WindowJumpList.Refresh(); }
public static void Jumplist() { if (!Win7.IsWin7) { return; } try { jumplist = JumpList.CreateJumpList(); jumplist.ClearAllUserTasks(); jumplist.AddUserTasks(new JumpListLink(Data.EXE, Data.L["Shutdown"]) { IconReference = new IconReference(Data.EXE, 1), Arguments = "-s" }); jumplist.AddUserTasks(new JumpListLink(Data.EXE, Data.L["Restart"]) { IconReference = new IconReference(Data.EXE, 2), Arguments = "-r" }); jumplist.AddUserTasks(new JumpListLink(Data.EXE, Data.L["Logoff"]) { IconReference = new IconReference(Data.EXE, 3), Arguments = "-l" }); jumplist.AddUserTasks(new JumpListLink(Data.EXE, Data.L["Lock"]) { IconReference = new IconReference(Data.EXE, 3), Arguments = "-lo" }); jumplist.AddUserTasks(new JumpListLink(Data.EXE, Data.L["Standby"]) { IconReference = new IconReference(Data.EXE, 4), Arguments = "-sb" }); jumplist.AddUserTasks(new JumpListLink(Data.EXE, Data.L["Hibernate"]) { IconReference = new IconReference(Data.EXE, 4), Arguments = "-h" }); if (Data.S["WOSB"]) { jumplist.AddUserTasks(new JumpListSeparator()); jumplist.AddUserTasks(new JumpListLink(Data.EXE, Data.L["HibernateWOSBIni"]) { IconReference = new IconReference(Data.EXE, 5), Arguments = "-hi" }); //jumplist.AddUserTasks(new JumpListLink(Data.EXE, Data.L["HibernateWOSBTime"]) { IconReference = new IconReference(Data.EXE, 5), Arguments = "-ht" }); } //jumplist.AddUserTasks(new JumpListSeparator()); //jumplist.AddUserTasks(new JumpListLink(Data.EXE, Data.L["Abort"]) { IconReference = new IconReference(EXE, 6), Arguments = "-a", WorkingDirectory = Path.GetDirectoryName(EXE) }); jumplist.Refresh(); } catch { } }
/// <summary> /// Builds the jump list. /// </summary> /// <param name="handle">The handle.</param> public static void BuildJumpList(IntPtr handle) { JumpList list = JumpList.CreateJumpListForIndividualWindow(TaskbarManager.Instance.ApplicationId, handle); list.KnownCategoryToDisplay = JumpListKnownCategoryType.Neither; JumpListLink newEntryLink = new JumpListLink(Assembly.GetExecutingAssembly().Location, "New Entry"); newEntryLink.Arguments = "NewEntry"; newEntryLink.IconReference = new IconReference(Assembly.GetExecutingAssembly().Location, 1); list.AddUserTasks(newEntryLink); list.Refresh(); }
internal static void InitJumpList() { jumpList = JumpList.CreateJumpList(); jumpList.KnownCategoryToDisplay = JumpListKnownCategoryType.Neither; jumpList.ClearAllUserTasks(); string ourFileName = Assembly.GetEntryAssembly().Location; JumpListLink quitLink = new JumpListLink(ourFileName, "Quit PeaRoxy") { Arguments = "--quit", }; jumpList.AddUserTasks(new JumpListTask[] { quitLink }); jumpList.Refresh(); }
/// <summary> /// Refreshes the taskbar tasks. /// </summary> private static void RefreshTaskbarTasks(JumpList jumpList) { try { jumpList.ClearAllUserTasks(); jumpList.KnownCategoryToDisplay = JumpListKnownCategoryType.Neither; string applicationFolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); string nativeResourceDll = Path.Combine(applicationFolder, NativeResourceDllName); jumpList.AddUserTasks( new JumpListLink(Assembly.GetEntryAssembly().Location, "Create New Task") { Arguments = "/newtask", IconReference = new IconReference(nativeResourceDll, NewTaskResourceId) }); jumpList.AddUserTasks(new JumpListSeparator()); foreach (BaseFolder f in App.Root.TaskData.AllFolders) { jumpList.AddUserTasks( new JumpListLink(Assembly.GetEntryAssembly().Location, "Goto " + f.Name) { Arguments = "/goto " + "\"" + f.Name + "\"", IconReference = new IconReference(nativeResourceDll, GotoResourceId) }); } jumpList.Refresh(); } catch (COMException) { // catch rare COM exceptions } }
void Form1_Shown(object sender, System.EventArgs e) { //thumbnail toolbar button setup buttonAdd = new ThumbnailToolbarButton(Properties.Resources.feed, "Add New Subscription"); buttonAdd.Enabled = true; buttonAdd.Click += new EventHandler <ThumbnailButtonClickedEventArgs>(buttonAdd_Click); buttonRefresh = new ThumbnailToolbarButton(Properties.Resources.feedRefresh, "Refresh Feeds"); buttonRefresh.Enabled = true; buttonRefresh.Click += new EventHandler <ThumbnailButtonClickedEventArgs>(buttonRefresh_Click); TaskbarManager.Instance.ThumbnailToolbars.AddButtons(this.Handle, buttonAdd, buttonRefresh); TaskbarManager.Instance.TabbedThumbnail.SetThumbnailClip(this.Handle, new Rectangle(pictureBox1.Location, pictureBox1.Size)); string systemFolder = Environment.GetFolderPath(Environment.SpecialFolder.System); //setup jumplist jumpList = JumpList.CreateJumpList(); category1.AddJumpListItems(new JumpListLink(Path.Combine(systemFolder, "notepad.exe"), "SteveSi's Office Hours")); category2.AddJumpListItems(new JumpListLink(Path.Combine(systemFolder, "mspaint2.exe"), "Add Google Reader Feeds") { IconReference = new IconReference(Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "Resources\\google.bmp"), 0) }); category2.AddJumpListItems(new JumpListLink(Path.Combine(systemFolder, "mspaint3.exe"), "Add Facebook News Feed") { IconReference = new IconReference(Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "Resources\\facebook.ico"), 0) }); category2.AddJumpListItems(new JumpListLink(Path.Combine(systemFolder, "mspaint4.exe"), "Refresh Feeds") { IconReference = new IconReference(Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "Resources\\feedRefresh.ico"), 0) }); jumpList.AddCustomCategories(category1, category2); jumpList.AddUserTasks(new JumpListSeparator()); JumpListCustomCategory empty = new JumpListCustomCategory(String.Empty); empty.AddJumpListItems(new JumpListLink("http://www.rssbandit.org", "Go to rssbandit.org") { IconReference = new IconReference(Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "Resources\\app.ico"), 0) }); jumpList.AddCustomCategories(empty); TaskbarManager.Instance.SetProgressState(TaskbarProgressBarState.NoProgress); jumpList.Refresh(); windowsTaskbar.SetOverlayIcon(this.Handle, Properties.Resources.envelope, "New Items"); // windowsTaskbar.SetOverlayIcon(this.Handle, null, null); <-- to clear }
private void BuildJumpList() { _jumpList.ClearAllUserTasks(); int defaultAccountIndex = _config.Accounts.IndexOf(_config.Accounts.Default); String exePath = Application.ExecutablePath; String path = Path.Combine(Path.GetDirectoryName(exePath), "Resources\\Icons"); JumpListTask compose = new JumpListLink(UrlHelper.BuildComposeUrl(defaultAccountIndex), Locale.Current.Labels.Compose) { IconReference = new IconReference(Path.Combine(path, "Compose.ico"), 0) }; // we need a different icon name here, there's a really whacky conflict between an embedded resource, and a content resource file name. JumpListTask inbox = new JumpListLink(UrlHelper.BuildInboxUrl(defaultAccountIndex), Locale.Current.Labels.Inbox) { IconReference = new IconReference(Path.Combine(path, "GoInbox.ico"), 0) }; JumpListTask refresh = new JumpListLink(exePath, Locale.Current.Labels.CheckMail) { IconReference = new IconReference(Path.Combine(path, "Refresh.ico"), 0), Arguments = "-check" }; JumpListTask settings = new JumpListLink(exePath, Locale.Current.Labels.ConfigurationShort) { IconReference = new IconReference(Path.Combine(path, "Settings.ico"), 0), Arguments = "-settings" }; JumpListTask about = new JumpListLink(exePath, Locale.Current.Labels.About) { IconReference = new IconReference(Path.Combine(path, "about.ico"), 0), Arguments = "-about" }; JumpListTask help = new JumpListLink(exePath, Locale.Current.Labels.Help) { IconReference = new IconReference(Path.Combine(path, "help.ico"), 0), Arguments = "-help" }; _jumpList.AddUserTasks(compose); _jumpList.AddUserTasks(inbox); _jumpList.AddUserTasks(refresh); _jumpList.AddUserTasks(settings); _jumpList.AddUserTasks(help); _jumpList.AddUserTasks(about); }
internal static void RegisterTaskBarActions(List <Link> definition) { JumpList = JumpList.CreateJumpList(); JumpList.ClearAllUserTasks(); JumpList.Refresh(); var categories = from item in definition where !string.IsNullOrEmpty(item.Category) group item by item.Category into g select new JumpListCustomCategory(g.Key); foreach (var item in categories) { var items = from link in definition where !string.IsNullOrEmpty(link.Category) && link.Category == item.Name select new JumpListLink(link.Path, link.Title) { Arguments = link.Arguments, WorkingDirectory = link.WorkingDirectory, IconReference = !string.IsNullOrEmpty(link.IconLocation) ? new IconReference(link.IconLocation, link.IconIndex) : new IconReference(), ShowCommand = link.ShowCommand }; item.AddJumpListItems(items.ToArray()); JumpList.AddCustomCategories(item); } var tasks = from link in definition where string.IsNullOrEmpty(link.Category) select new JumpListLink(link.Path, link.Title) { Arguments = link.Arguments, WorkingDirectory = link.WorkingDirectory, IconReference = !string.IsNullOrEmpty(link.IconLocation) ? new IconReference(link.IconLocation, link.IconIndex) : new IconReference(), ShowCommand = link.ShowCommand }; if (tasks != null && tasks.Any()) { JumpList.AddUserTasks(tasks.ToArray()); } JumpList.Refresh(); }
void Application_Idle(object sender, EventArgs e) { try { Process currentProcess = Process.GetCurrentProcess(); if (currentProcess != null && currentProcess.MainWindowHandle != IntPtr.Zero && !bLoaded) { bLoaded = true; Application.Idle -= Application_Idle; if (_jumpList == null) { _jumpList = JumpList.CreateJumpList(); _jumpList.KnownCategoryToDisplay = JumpListKnownCategoryType.Recent; _jumpList.ClearAllUserTasks(); _jumpList.Refresh(); } var list = new List <string>(); foreach (MyApps app in apps.ToList().OrderByDescending(x => x.Fileinfo.LastAccessTime)) { if (app.Fileinfo.Exists) { string name = app.Fileinfo.Name.Replace(app.Fileinfo.Extension, ""); if (!list.Contains(name)) { JumpListTask task = new JumpListLink(app.Path, name) { IconReference = new IconReference(app.Path, 0), }; _jumpList.AddUserTasks(task); list.Add(name); } } } _jumpList.Refresh(); } } catch { } }
internal void AddJumpList() { _jumpList = JumpList.CreateJumpList(); //do i need this? _jumpList.ClearAllUserTasks(); _jumpList.Refresh(); JumpListLink openTask = new JumpListLink(_baseUrl, "Open inbox") { IconReference = new IconReference(Application.ExecutablePath, 2), }; JumpListLink composeTask = new JumpListLink(_baseUrl + "#compose", "Compose mail") { IconReference = new IconReference(Application.ExecutablePath, 1), }; JumpListLink refreshTask = new JumpListLink(Application.ExecutablePath, "Check for new mail") { Arguments = "refresh", IconReference = new IconReference(Application.ExecutablePath, 4), }; JumpListLink settingsTask = new JumpListLink(Application.ExecutablePath, "Settings") { Arguments = "settings", IconReference = new IconReference(Application.ExecutablePath, 5), }; JumpListLink logoutTask = new JumpListLink(Application.ExecutablePath, "Logout") { Arguments = "logout", IconReference = new IconReference(Application.ExecutablePath, 3), }; _jumpList.AddUserTasks(new JumpListTask[] { openTask, composeTask, refreshTask, settingsTask, logoutTask }); //new JumpListSeparator(), _jumpList.Refresh(); // do i need this? }
//The following method is part of the lab. Add a few user tasks, using several //instances of the JumpListLink class and the JumpList.AddUserTasks method. Some ideas are //notepad.exe, calc.exe, mspaint.exe and other Windows utilities. private void OnAddTask(object unused1, RoutedEventArgs unused2) { //TODO: Task 6--Using Taskbar Jump Lists, steps 1-7 string systemFolder = Environment.GetFolderPath(Environment.SpecialFolder.System); IJumpListTask notepadTask = new JumpListLink( System.IO.Path.Combine(systemFolder, "notepad.exe"), "Open Notepad") { IconReference = new IconReference(Path.Combine(systemFolder, "notepad.exe"), 0) }; IJumpListTask calcTask = new JumpListLink( Path.Combine(systemFolder, "calc.exe"), "Open Calculator") { IconReference = new IconReference(Path.Combine(systemFolder, "calc.exe"), 0) }; IJumpListTask paintTask = new JumpListLink( Path.Combine(systemFolder, "mspaint.exe"), "Open Paint") { IconReference = new IconReference(Path.Combine(systemFolder, "mspaint.exe"), 0) }; JumpList.AddUserTasks(notepadTask, calcTask, new JumpListSeparator(), paintTask); JumpList.Refresh(); }