Beispiel #1
0
        public void AddToRecentList(List <string> projectPathList)
        {
            if (projectPathList == null || !projectPathList.Any())
            {
                return;
            }
            projectPathList = projectPathList.Distinct().ToList();
            JumpListCustomCategory userActionsCategory = new JumpListCustomCategory("Recent");
            var rt = new List <JumpListLink>();

            foreach (string projectPath in projectPathList)
            {
                if (string.IsNullOrEmpty(projectPath))
                {
                    continue;
                }

                if (File.Exists(projectPath) || Directory.Exists(projectPath))
                {
                    JumpListLink userActionLink = new JumpListLink(Assembly.GetEntryAssembly().Location, new FileInfo(projectPath).Name);
                    userActionLink.Arguments = projectPath;
                    rt.Add(userActionLink);
                }
            }
            if (!rt.Any())
            {
                return;
            }
            userActionsCategory.AddJumpListItems(rt.ToArray());
            list.AddCustomCategories(userActionsCategory);
            list.Refresh();
        }
Beispiel #2
0
        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
        }
Beispiel #3
0
        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();
        }
Beispiel #4
0
        private async void LoadJumplist()
        {
            await System.Threading.Tasks.Task.Delay(5000);

            JumpList jl = JumpList.CreateJumpList();
            JumpListCustomCategory jlc = new JumpListCustomCategory("µVoice Alpha (Private Build)");

            JumpListLink[] jli = new JumpListLink[] { new JumpListLink("report", "Reportar Un Problema"), new JumpListLink("reports", "Decirle a bit que es mierda."), new JumpListLink("update", "Buscar Actualizaciones") };
            jlc.AddJumpListItems(jli);
            jl.AddCustomCategories(jlc);
            jl.Refresh();
            TaskbarManager.Instance.TabbedThumbnail.SetThumbnailClip(new WindowInteropHelper(this).Handle, new System.Drawing.Rectangle(10, 64, Convert.ToInt32(mainpiano.ActualWidth), Convert.ToInt32(mainpiano.ActualHeight)));
            TabbedThumbnail preview = new TabbedThumbnail(this, mainpiano, new System.Windows.Vector(10000, 10000));

            preview.SetWindowIcon(Properties.Resources.icon);
            preview.Title = this.Title;
            try
            {
                TaskbarManager.Instance.TabbedThumbnail.AddThumbnailPreview(preview);
            }
            catch { }
            RenderTargetBitmap rtb = new RenderTargetBitmap((int)play.ActualWidth, (int)play.ActualHeight, 96, 96, PixelFormats.Pbgra32);

            rtb.Render(play);
            MemoryStream  stream  = new MemoryStream();
            BitmapEncoder encoder = new BmpBitmapEncoder();

            encoder.Frames.Add(BitmapFrame.Create(rtb));
            encoder.Save(stream);
            System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(stream);
            TaskbarManager.Instance.ThumbnailToolBars.AddButtons(mainpiano, new ThumbnailToolBarButton[] { new ThumbnailToolBarButton(System.Drawing.Icon.FromHandle(bmp.GetHicon()), "Play") });
        }
Beispiel #5
0
            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();
            }
Beispiel #6
0
        void refreshJumlist()
        {
            JumpList jumpList = JumpList.CreateJumpListForIndividualWindow(TaskbarManager.Instance.ApplicationId, this.Handle);

            List <GroupModel> groups = new List <GroupModel>(groupMapping.Values);

            foreach (var group in groups)
            {
                string groupName = group.Name;
                JumpListCustomCategory category = new JumpListCustomCategory(groupName);

                List <ItemModel> items = new List <ItemModel>(group.Items.Values);
                foreach (var item in items)
                {
                    string itemName = item.Name;
                    string itemPath = item.Url;

                    JumpListLink jll = new JumpListLink(itemPath, itemName);
                    jll.IconReference = new IconReference(itemPath.ToString(), 0);
                    category.AddJumpListItems(jll);
                }
                jumpList.AddCustomCategories(category);
            }

            jumpList.Refresh();
        }
        private void CreateJumpList()
        {
            if (CoreHelpers.RunningOnWin7)
            {
                string   cmdPath  = Assembly.GetEntryAssembly().Location;
                JumpList jumpList = JumpList.CreateJumpList();

                JumpListCustomCategory category = new JumpListCustomCategory("Status Change");
                category.AddJumpListItems(
                    new JumpListLink(cmdPath, Status.Online.ToString())
                {
                    Arguments = Status.Online.ToString()
                },
                    new JumpListLink(cmdPath, Status.Away.ToString())
                {
                    Arguments = Status.Away.ToString()
                },
                    new JumpListLink(cmdPath, Status.Busy.ToString())
                {
                    Arguments = Status.Busy.ToString()
                });
                jumpList.AddCustomCategories(category);

                jumpList.Refresh();
            }
        }
Beispiel #8
0
        /// <summary>
        /// Creates the recently used ports jumplist
        /// </summary>
        private void CreateJumpList()
        {
            taskBarManager = TaskbarManager.Instance;
            if (TaskbarManager.IsPlatformSupported)
            {
                string currentDir = new FileInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).DirectoryName;

                JumpList list = JumpList.CreateJumpList();

                // Separate by service hosts the recent ports.
                Port.GetUsedPorts().GroupBy(p => p.ServiceHost).ToList().ForEach(group => {
                    JumpListCustomCategory userActionsCategory = new JumpListCustomCategory(group.Key);

                    group.OrderByDescending(p => p.UsedTimes).ToList().ForEach(port =>
                    {
                        JumpListLink userActionLink = new JumpListLink(Assembly.GetEntryAssembly().Location,
                                                                       string.Format("{0} @ {1}", port.Number.ToString(), port.Host))
                        {
                            Arguments     = port.Id.ToString(),
                            IconReference = new IconReference(currentDir + "\\Resources\\tunnel-jump.ico,0")
                        };
                        userActionsCategory.AddJumpListItems(userActionLink);
                    });

                    list.AddCustomCategories(userActionsCategory);
                });

                list.Refresh();
            }
        }
Beispiel #9
0
        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);
        }
        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();
            }
        }
Beispiel #11
0
        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();
        }
Beispiel #12
0
        private void ConstruirLista()
        {
            // Define una nueva categoría personalizada llamada Utilidades
            JumpListCustomCategory catActions = new JumpListCustomCategory("Utilidades");

            // Genera el path completo hacia la aplicación e icono a utilizar por el JumpListItem
            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 jlCalculadora = new JumpListLink(calcPath, "Calculadora");

            jlCalculadora.IconReference = new IconReference(calcPath, 0);

            string       paintPath = Path.Combine(Environment.SystemDirectory, "mspaint.exe");
            JumpListLink jlPaint   = new JumpListLink(paintPath, "Paint");

            jlPaint.IconReference = new IconReference(paintPath, 0);

            // Añade los JumpListItems a la categoría personalizada
            catActions.AddJumpListItems(jlNotepad, jlCalculadora, jlPaint);

            // Añade la categoría a la lista
            jlist.AddCustomCategories(catActions);
            jlist.Refresh();
        }
        void TaskbarDemoMainForm_Shown(object sender, EventArgs e)
        {
            // create a new taskbar jump list for the main window
            jumpList = JumpList.CreateJumpList();

            // Add custom categories
            jumpList.AddCustomCategories(category1, category2);

            // Default values for jump lists
            comboBoxKnownCategoryType.SelectedItem = "Recent";

            // Progress Bar
            foreach (string state in Enum.GetNames(typeof(TaskbarProgressBarState)))
            {
                comboBoxProgressBarStates.Items.Add(state);
            }

            //
            comboBoxProgressBarStates.SelectedItem = "NoProgress";

            // Update UI
            UpdateStatusBar("Application ready...");

            // Set our default
            TaskbarManager.Instance.SetProgressState(TaskbarProgressBarState.NoProgress);
        }
Beispiel #14
0
        /// <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();
        }
Beispiel #15
0
        /// <summary>
        /// Handler method that's called when the form is shown.  Creates and initializes the jump list if necessary and, if they are specified, opens the
        /// bookmarks specified by <see cref="OpenToBookmarks"/> or the history entries pointed to by <see cref="OpenToHistory"/>.
        /// </summary>
        /// <param name="e">Arguments associated with this event.</param>
        protected override async void OnShown(EventArgs e)
        {
            base.OnShown(e);

            if (_jumpList == null)
            {
                _jumpList = JumpList.CreateJumpList();
                _jumpList.KnownCategoryToDisplay = JumpListKnownCategoryType.Neither;
                _jumpList.AddCustomCategories(_recentCategory);

                // Get all of the historical connections and order them by their last connection times
                List <HistoricalConnection> historicalConnections =
                    History.Instance.Connections.OrderBy((HistoricalConnection c) => c.LastConnection).ToList();
                historicalConnections = historicalConnections.GetRange(0, Math.Min(historicalConnections.Count, Convert.ToInt32(_jumpList.MaxSlotsInList)));

                // Add each history entry to the jump list
                foreach (HistoricalConnection historicalConnection in historicalConnections)
                {
                    try
                    {
                        _recentCategory.AddJumpListItems(
                            new JumpListLink(Application.ExecutablePath, historicalConnection.Connection.DisplayName)
                        {
                            Arguments     = "/openHistory:" + historicalConnection.Connection.Guid.ToString(),
                            IconReference = new IconReference(Application.ExecutablePath, 0)
                        });
                    }

                    // Turning off the "show recent documents in the taskbar and start menu" setting in the start menu properties
                    // can cause adding a jump list item to throw an exception, so just ignore the error and continue
                    catch (Exception)
                    {
                    }

                    _recentConnections.Enqueue(historicalConnection);
                }

                try
                {
                    _jumpList.Refresh();
                }

                // Turning off the "show recent documents in the taskbar and start menu" setting in the start menu properties
                // can cause adding a jump list item to throw an exception, so just ignore the error and continue
                catch (Exception)
                {
                }

                if (OpenToHistory != Guid.Empty)
                {
                    SelectedTab = await Connect(History.Instance.FindInHistory(OpenToHistory));
                }
            }

            if (OpenToHistory == Guid.Empty && OpenToBookmarks != null)
            {
                await ConnectToBookmarks(OpenToBookmarks);
            }
        }
Beispiel #16
0
        /// <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);
            }
        }
Beispiel #17
0
        private void BuildList()
        {
            JumpListCustomCategory tasksCategory = new JumpListCustomCategory("Tasks");

            JumpListLink newWindowTask = new JumpListLink(Assembly.GetEntryAssembly().Location, "New window");

            newWindowTask.Arguments = "-1";

            tasksCategory.AddJumpListItems(newWindowTask);
            list.AddCustomCategories(tasksCategory);

            list.Refresh();
        }
Beispiel #18
0
 private static void InitJumpList()
 {
     try
     {
         if (_jumpListManager == null)
         {
             TaskbarManager.Instance.ApplicationId = PreferencesFactory.get().getProperty("application.name");
             _jumpListManager = JumpList.CreateJumpList();
             _jumpListManager.AddCustomCategories(bookmarkCategory = new JumpListCustomCategory("History"));
         }
     }
     catch (Exception exception)
     {
         Logger.warn("Exception while initializing jump list", exception);
     }
 }
Beispiel #19
0
        private static void AddCategoryLink(string categoryName, string title, string path, string arguments, Microsoft.WindowsAPICodePack.Shell.IconReference?icon)
        {
            var task = CreateJumpListLink(title, path, arguments, icon);
            JumpListCustomCategory category;

            if (!categories.TryGetValue(categoryName, out category))
            {
                category = new JumpListCustomCategory(categoryName);
                categories[categoryName] = category;
                list.AddCustomCategories(category);
            }

            category.AddJumpListItems(task);

            if (AutoRefresh)
            {
                list.Refresh();
            }
        }
Beispiel #20
0
        /// <summary>
        /// Legt einen neuen Eintrag in der Jumpliste der Taskleiste an
        /// Umgeht die Recentliste mit eigener Kategorie
        /// Aufruf direkt an DameWare
        /// </summary>
        void addToJumpListRecent(string strSourceFile)
        {
            // eigene Kategorie anlegen
            JumpListCustomCategory CustomCategory = new JumpListCustomCategory("Suchdateien");


            // in diese Link zu einer Datei anlegen
            string       strDwTemp   = "-sourcefile=" + strSourceFile;
            JumpListLink myJumpLinkA = new JumpListLink(Application.ExecutablePath, strSourceFile);

            myJumpLinkA.Arguments     = strDwTemp;
            myJumpLinkA.IconReference = new IconReference(Application.ExecutablePath, 0);

            CustomCategory.AddJumpListItems(myJumpLinkA);

            CustomJumpList.AddCustomCategories(CustomCategory);

            CustomJumpList.Refresh();
        }
Beispiel #21
0
        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();
        }
Beispiel #22
0
        /// <summary>
        /// Handler method that's called when the form is shown.  Creates and initializes the jump list if necessary and, if they are specified, opens the
        /// bookmarks specified by <see cref="OpenToBookmarks"/> or the history entries pointed to by <see cref="OpenToHistory"/>.
        /// </summary>
        /// <param name="e">Arguments associated with this event.</param>
        protected override void OnShown(EventArgs e)
        {
            base.OnShown(e);

            if (_jumpList == null)
            {
                _jumpList = JumpList.CreateJumpList();
                _jumpList.KnownCategoryToDisplay = JumpListKnownCategoryType.Neither;
                _jumpList.AddCustomCategories(_recentCategory);

                // Get all of the historical connections and order them by their last connection times
                List <HistoryWindow.HistoricalConnection> historicalConnections =
                    _history.Connections.OrderBy((HistoryWindow.HistoricalConnection c) => c.LastConnection).ToList();
                historicalConnections = historicalConnections.GetRange(0, Math.Min(historicalConnections.Count, Convert.ToInt32(_jumpList.MaxSlotsInList)));

                // Add each history entry to the jump list
                foreach (HistoryWindow.HistoricalConnection historicalConnection in historicalConnections)
                {
                    _recentCategory.AddJumpListItems(
                        new JumpListLink(Application.ExecutablePath, historicalConnection.Connection.DisplayName)
                    {
                        Arguments     = "/openHistory:" + historicalConnection.Connection.Guid.ToString(),
                        IconReference = new IconReference(Application.ExecutablePath, 0)
                    });
                    _recentConnections.Enqueue(historicalConnection);
                }

                _jumpList.Refresh();

                if (OpenToHistory != Guid.Empty)
                {
                    SelectedTab = Connect(_history.FindInHistory(OpenToHistory));
                }
            }

            if (OpenToHistory == Guid.Empty && OpenToBookmarks != null)
            {
                ConnectToBookmarks(OpenToBookmarks);
            }
        }
Beispiel #23
0
        public void buildJumplist(bool allowOpenAll, string Name)
        {
            string categoryPath = Path.Combine(Paths.ConfigPath, Name);

            JumpListCustomCategory userTaskbarCategory = new JumpListCustomCategory("Taskbar Groups");

            JumpListLink openEdit = new JumpListLink(Paths.exeString, "Edit Group");

            openEdit.Arguments     = "editingGroupMode " + Name;
            openEdit.IconReference = new IconReference(Path.Combine(categoryPath, "GroupIcon.ico"), 0);
            userTaskbarCategory.AddJumpListItems(openEdit);

            if (allowOpenAll)
            {
                JumpListLink openAllShortcuts = new JumpListLink(Paths.exeString, "Open all shortcuts");
                openAllShortcuts.Arguments     = Name + " tskBaropen_allGroup";
                openAllShortcuts.IconReference = new IconReference(Path.Combine(categoryPath, "GroupIcon.ico"), 0);
                userTaskbarCategory.AddJumpListItems(openAllShortcuts);
            }

            list.AddCustomCategories(userTaskbarCategory);

            list.Refresh();
        }
Beispiel #24
0
        static public bool ApplyJumplistToTaskbar(Primary parent)
        {
            bool result = false;

            try
            {
                JumpList newList = JumpList.CreateJumpListForAppId(parent.CurrentAppId);
                //newList.KnownCategoryToDisplay = JumpListKnownCategoryType.Recent;
                //newList.KnownCategoryOrdinalPosition = 0;

                ListBox.ObjectCollection jumplistItems = parent.JumplistListBox.Items;
                for (int i = 0; i < jumplistItems.Count; i++)
                {
                    // Look for a category
                    T7EJumplistItem.ItemTypeVar jumplistItemType = ((T7EJumplistItem)jumplistItems[i]).ItemType;
                    if (jumplistItemType == T7EJumplistItem.ItemTypeVar.Category ||
                        jumplistItemType == T7EJumplistItem.ItemTypeVar.CategoryTasks)
                    {
                        JumpListCustomCategory category = new JumpListCustomCategory(((T7EJumplistItem)jumplistItems[i]).ItemName);

                        // Look for a task
                        for (int j = i + 1; j < jumplistItems.Count; j++)
                        {
                            i = j - 1; // When J loop is exited, i has to be less.
                            T7EJumplistItem jumplistItem = (T7EJumplistItem)jumplistItems[j];
                            switch (jumplistItem.ItemType)
                            {
                            case T7EJumplistItem.ItemTypeVar.Category:
                            case T7EJumplistItem.ItemTypeVar.CategoryTasks:
                                j = jumplistItems.Count;     // Exit the for loop
                                break;

                            case T7EJumplistItem.ItemTypeVar.Task:
                                if (jumplistItemType == T7EJumplistItem.ItemTypeVar.Category)
                                {
                                    category.AddJumpListItems(
                                        ParseApplyJumpListTask(parent, jumplistItem, j));
                                }
                                else
                                {
                                    newList.AddUserTasks(
                                        ParseApplyJumpListTask(parent, jumplistItem, j));
                                }
                                break;

                            case T7EJumplistItem.ItemTypeVar.FileFolder:
                                // If file is an EXE, just pass the path over.
                                // TODO: Merge "Command line" and "File/Folder shortcut" into one dialog, based on "Command Line"

                                JumpListLink link = new JumpListLink
                                {
                                    Title     = jumplistItem.ItemName,
                                    Path      = "C:\\Windows\\explorer.exe",
                                    Arguments = jumplistItem.FilePath
                                                // working directory here? We don't know what the program is.
                                                // AHK doesn't detect the default program's working dir, either.
                                };
                                if (jumplistItem.FileRunWithApp)
                                {
                                    link.Path = parent.CurrentAppPath;
                                    // we use working dir here because we KNOW the program to use
                                    link.WorkingDirectory = Path.GetDirectoryName(parent.CurrentAppPath);
                                }


                                if (Path.GetExtension(jumplistItem.FilePath).ToLower() == ".exe")
                                {
                                    link.Path      = jumplistItem.FilePath;
                                    link.Arguments = "";
                                    // we use working dir here because we KNOW the program to use
                                    link.WorkingDirectory = Path.GetDirectoryName(jumplistItem.FilePath);
                                }


                                // Format icon
                                if (jumplistItem.ItemIconToString().Equals("Don't use an icon") != true)
                                {
                                    // Icon processing
                                    string localIconPath = IconPathToLocal(jumplistItem.ItemIconPath, jumplistItem.ItemIconIndex, j, parent.CurrentAppId, false);
                                    if (File.Exists(localIconPath))
                                    {
                                        link.IconReference = new IconReference(localIconPath, 0);
                                    }
                                }

                                if (jumplistItemType == T7EJumplistItem.ItemTypeVar.Category)
                                {
                                    category.AddJumpListItems(link);
                                }
                                else
                                {
                                    newList.AddUserTasks(link);
                                }
                                break;

                            case T7EJumplistItem.ItemTypeVar.Separator:
                                if (jumplistItemType == T7EJumplistItem.ItemTypeVar.CategoryTasks)
                                {
                                    newList.AddUserTasks(new JumpListSeparator());
                                }
                                break;
                            }
                        }

                        if (jumplistItemType == T7EJumplistItem.ItemTypeVar.Category)
                        {
                            newList.AddCustomCategories(category);
                        }
                    }
                }

                // ////////
                JumpList dummyList = JumpList.CreateJumpListForAppId(parent.CurrentAppId);

                /*dummyList.AddUserTasks(new JumpListLink
                 * {
                 *  Title = "Dummy",
                 *  Path = "%windir%\\explorer.exe"
                 * });*/
                dummyList.ClearAllUserTasks();
                dummyList.Refresh();
                newList.Refresh();
                // Remove appid from own window!
                SetAppIdBackAfterJumplist();
                result = true;
            }
            catch (Exception e)
            {
                MessageBox.Show("JumpList applying not successful." + "\r\n"
                                + e.ToString());
            }

            return(result);
        }
Beispiel #25
0
        public bool ApplyJumplistToTaskbar()
        {
            bool result = false;

            try
            {
                JumpList newList = JumpList.CreateJumpListForAppId(CurrentAppId);

                ListBox.ObjectCollection jumplistItems = JumplistListBox.Items;
                for (int i = 0; i < jumplistItems.Count; i++)
                {
                    // Look for a category
                    JumpListItemObject.ItemTypeVar jumplistItemType = ((JumpListItemObject)jumplistItems[i]).ItemType;
                    if (jumplistItemType == JumpListItemObject.ItemTypeVar.Category ||
                        jumplistItemType == JumpListItemObject.ItemTypeVar.CategoryTasks)
                    {
                        JumpListCustomCategory category = new JumpListCustomCategory(((JumpListItemObject)jumplistItems[i]).ItemName);

                        // Look for a task
                        for (int j = i + 1; j < jumplistItems.Count; j++)
                        {
                            i = j - 1; // When J loop is exited, i has to be less.
                            JumpListItemObject jumplistItem = (JumpListItemObject)jumplistItems[j];
                            switch (jumplistItem.ItemType)
                            {
                            case JumpListItemObject.ItemTypeVar.Category:
                            case JumpListItemObject.ItemTypeVar.CategoryTasks:
                                j = jumplistItems.Count;     // Exit the for loop
                                break;

                            case JumpListItemObject.ItemTypeVar.Task:
                                if (jumplistItemType == JumpListItemObject.ItemTypeVar.Category)
                                {
                                    category.AddJumpListItems(
                                        ParseApplyJumpListTask(jumplistItem, j));
                                }
                                else
                                {
                                    newList.AddUserTasks(
                                        ParseApplyJumpListTask(jumplistItem, j));
                                }
                                break;

                            case JumpListItemObject.ItemTypeVar.FileFolder:
                                JumpListLink link = new JumpListLink
                                {
                                    Title     = jumplistItem.ItemName,
                                    Path      = "C:\\Windows\\explorer.exe",
                                    Arguments = jumplistItem.FilePath
                                };
                                if (jumplistItem.FileRunWithApp)
                                {
                                    link.Path = CurrentAppPath;
                                }
                                // Format icon
                                if (jumplistItem.ItemIconToString().Equals("Don't use an icon") != true)
                                {
                                    // Icon processing
                                    string localIconPath = IconPathToLocal(jumplistItem.ItemIconPath, jumplistItem.ItemIconIndex, j, CurrentAppId, false);
                                    if (File.Exists(localIconPath))
                                    {
                                        link.IconReference = new IconReference(localIconPath, 0);
                                    }
                                }

                                if (jumplistItemType == JumpListItemObject.ItemTypeVar.Category)
                                {
                                    category.AddJumpListItems(link);
                                }
                                else
                                {
                                    newList.AddUserTasks(link);
                                }
                                break;

                            case JumpListItemObject.ItemTypeVar.Separator:
                                if (jumplistItemType == JumpListItemObject.ItemTypeVar.CategoryTasks)
                                {
                                    newList.AddUserTasks(new JumpListSeparator());
                                }
                                break;
                            }
                        }

                        if (jumplistItemType == JumpListItemObject.ItemTypeVar.Category)
                        {
                            newList.AddCustomCategories(category);
                        }
                    }
                }

                // ////////
                JumpList dummyList = JumpList.CreateJumpListForAppId(CurrentAppId);
                dummyList.AddUserTasks(new JumpListLink
                {
                    Title = "Dummy",
                    Path  = "%windir%\\explorer.exe"
                });
                dummyList.Refresh();
                newList.Refresh();
                // Remove appid from own window!
                SetAppIdBackAfterJumplist();
                result = true;
            }
            catch (Exception e)
            {
                MessageBox.Show("JumpList applying not successful." + "\r\n"
                                + e.ToString());
            }

            return(result);
        }
Beispiel #26
0
        private void UpdateMailsJumpList()
        {
            if (!_config.RecentDocsTracked)
            {
                return;
            }

            _jumpList.RemoveCustomCategories();

            Dictionary <string, List <JumpListLink> > dictionary = new Dictionary <string, List <JumpListLink> >();

            int i           = 0;
            int unreadCount = Math.Min(_UnreadTotal, (int)_jumpList.MaxSlotsInList);
            int index       = 0;
            int mailCount   = 0;

            while (i < unreadCount)
            {
                String linkText;

                Notifier notifier = _instances[_config.Accounts[index].FullAddress];
                Account  account  = _config.Accounts[notifier.AccountIndex];

                if (Locale.Current.IsRightToLeftLanguage)
                {
                    linkText = String.Concat("(", notifier.Unread, ") ", account.FullAddress, " ");
                }
                else
                {
                    linkText = String.Concat(account.FullAddress, " (", notifier.Unread, ")");
                }

                if (!dictionary.ContainsKey(linkText))
                {
                    dictionary.Add(linkText, new List <JumpListLink>());
                }

                if (mailCount < notifier.XmlMail.Count)
                {
                    XmlNode node      = notifier.XmlMail[mailCount];
                    String  innerText = node.ChildNodes.Item(0).InnerText;
                    String  linkTitle = String.IsNullOrEmpty(innerText) ? Locale.Current.Labels.NoSubject : innerText;
                    String  linkUrl   = UrlHelper.BuildMailUrl(node.ChildNodes.Item(2).Attributes["href"].Value, notifier.AccountIndex);
                    String  path      = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "Resources\\Icons");

                    JumpListLink item = new JumpListLink(linkUrl, linkTitle)
                    {
                        IconReference = new IconReference(Path.Combine(path, "Mail.ico"), 0)
                    };

                    dictionary[linkText].Add(item);
                    i++;
                }

                if (index < (_instances.Count - 1))
                {
                    index++;
                }
                else
                {
                    index = 0;
                    mailCount++;
                }
            }

            foreach (KeyValuePair <string, List <JumpListLink> > pair in dictionary)
            {
                JumpListCustomCategory category = new JumpListCustomCategory(pair.Key);
                category.AddJumpListItems(pair.Value.ToArray());

                _jumpList.AddCustomCategories(new JumpListCustomCategory[] { category });
            }

            try {
                _jumpList.Refresh();
            }
            catch (Exception e) {
                // https://github.com/shellscape/Gmail-Notifier-Plus/issues/#issue/3
                // Unable to remove files to be replaced. (Exception from HRESULT: 0x80070497)
                Utilities.ErrorHelper.Log(e, Guid.NewGuid());
            }
        }