/// <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 } }
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 void AddJumpList() { _jumpList = JumpList.CreateJumpList(); //do i need this? _jumpList.ClearAllUserTasks(); _jumpList.Refresh(); JumpListLink openTask = new JumpListLink(_baseUrl, "Open Inbox") { Arguments = "inbox", IconReference = new IconReference(Application.ExecutablePath, 2), }; JumpListLink composeTask = new JumpListLink(_baseUrl + "#compose", "Compose mail") { Arguments = "compose", 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? }
private void OfflineJumpList(ref JumpList jumpList) { var task = new JumpListLink(System.Windows.Forms.Application.ExecutablePath, "About GVNotifier..."); task.Arguments = "/about"; //this.Try(() => task.IconReference = new Microsoft.WindowsAPICodePack.Shell.IconReference(System.Windows.Forms.Application.ExecutablePath, 0)); jumpList.AddUserTasks(task); task = new JumpListLink(System.Windows.Forms.Application.ExecutablePath, "Preferences..."); task.Arguments = "/prefs"; //this.Try(() =>task.IconReference = new Microsoft.WindowsAPICodePack.Shell.IconReference( System.Windows.Forms.Application.ExecutablePath, 1)); jumpList.AddUserTasks(task); task = new JumpListLink(System.Windows.Forms.Application.ExecutablePath, "Open Google Voice Website"); task.Arguments = "/gv"; //this.Try(() =>task.IconReference = new Microsoft.WindowsAPICodePack.Shell.IconReference(System.Windows.Forms.Application.ExecutablePath, 2)); jumpList.AddUserTasks(task); if (SessionModel.Inst != null) { jumpList.AddUserTasks(new JumpListSeparator()); task = new JumpListLink(System.Windows.Forms.Application.ExecutablePath, "Sign Out"); task.Arguments = "/signout"; //this.Try(() =>task.IconReference = new Microsoft.WindowsAPICodePack.Shell.IconReference(System.Windows.Forms.Application.ExecutablePath, 4)); jumpList.AddUserTasks(task); } jumpList.AddUserTasks(new JumpListSeparator()); task = new JumpListLink(System.Windows.Forms.Application.ExecutablePath, "Quit"); task.Arguments = "/quit"; //this.Try(() => task.IconReference = new Microsoft.WindowsAPICodePack.Shell.IconReference(System.Windows.Forms.Application.ExecutablePath, 3)); jumpList.AddUserTasks(task); }
/// <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); } }