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();
        }
        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();
        }
Exemple #3
0
        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();
        }
Exemple #4
0
 private void button1_Click(object sender, EventArgs e)
 {
     childWindowJumpList              = JumpList.CreateJumpListForIndividualWindow(childWindowAppId, this.Handle);
     ((Button)sender).Enabled         = false;
     groupBoxCustomCategories.Enabled = true;
     buttonRefreshTaskbarList.Enabled = true;
 }
Exemple #5
0
        private void Main_Load(object sender, EventArgs e)
        {
            AllowTaskbarWindowMessagesThroughUIPI();

            _jumpList = JumpList.CreateJumpListForIndividualWindow(this._taskbarManager.ApplicationId, base.Handle);
            _jumpList.JumpListItemsRemoved  += delegate(object o, UserRemovedJumpListItemsEventArgs ev) { };
            _jumpList.KnownCategoryToDisplay = JumpListKnownCategoryType.Neither;

            BuildJumpList();
        }
Exemple #6
0
        public MainForm()
        {
            // use Segoe UI in Vista & 7
            Font = SystemFonts.MessageBoxFont;

            InitializeComponent();

            // Crea un nuevo JumpList para la aplicación
            jlist = JumpList.CreateJumpListForIndividualWindow(TaskbarManager.Instance.ApplicationId, this.Handle);
            ConstruirLista();
        }
Exemple #7
0
        /// <summary>
        /// Creates a JumpList for the given application instance.
        /// It also adds thumbnail toolbars, which are a set of up to seven buttons at the bottom of the taskbar’s icon thumbnail preview.
        /// </summary>
        /// <param name="windowHandle">The application instance's main window handle.</param>
        /// <param name="buttons">The thumbnail toolbar buttons to be added.</param>
        public void CreateJumpList(IntPtr windowHandle, WindowsThumbnailToolbarButtons buttons)
        {
            if (!IsSupported)
            {
                return;
            }

            CreateJumpList();

            CreateTaskbarButtons(windowHandle, buttons);

            return;

            void CreateJumpList()
            {
                try
                {
                    var jumpList = JumpList.CreateJumpListForIndividualWindow(TaskbarManager.Instance.ApplicationId, windowHandle);
                    jumpList.ClearAllUserTasks();
                    jumpList.KnownCategoryToDisplay = JumpListKnownCategoryType.Recent;
                    jumpList.Refresh();
                }
                catch
                {
                    // have seen a COM exception here that caused the UI to stop loading
                }
            }

            void CreateTaskbarButtons(IntPtr handle, WindowsThumbnailToolbarButtons thumbButtons)
            {
                if (!_toolbarButtonsCreated)
                {
                    _commitButton        = new ThumbnailToolBarButton(MakeIcon(thumbButtons.Commit.Image, 48, true), thumbButtons.Commit.Text);
                    _commitButton.Click += thumbButtons.Commit.Click;

                    _pushButton        = new ThumbnailToolBarButton(MakeIcon(thumbButtons.Push.Image, 48, true), thumbButtons.Push.Text);
                    _pushButton.Click += thumbButtons.Push.Click;

                    _pullButton        = new ThumbnailToolBarButton(MakeIcon(thumbButtons.Pull.Image, 48, true), thumbButtons.Pull.Text);
                    _pullButton.Click += thumbButtons.Pull.Click;

                    _toolbarButtonsCreated = true;

                    // Call this method using reflection.  This is a workaround to *not* reference WPF libraries, becuase of how the WindowsAPICodePack was implimented.
                    TaskbarManager.Instance.ThumbnailToolBars.AddButtons(handle, _commitButton, _pullButton, _pushButton);
                    TaskbarManager.Instance.ApplicationId = "GitExtensions";
                }

                _commitButton.Enabled = true;
                _pushButton.Enabled   = true;
                _pullButton.Enabled   = true;
            }
        }
Exemple #8
0
        /// <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();
        }
        static TaskBarJumpList()
        {
            if (WindowsId.ToInt32() == 0)
            {
                list = JumpList.CreateJumpList();
            }
            else
            {
                list = JumpList.CreateJumpListForIndividualWindow(TaskbarManager.Instance.ApplicationId, WindowsId);
            }

            list.ClearAllUserTasks();
            list.Refresh();
            categories = new Dictionary <string, JumpListCustomCategory>();
        }
Exemple #10
0
        /// <summary>
        /// Creates a JumpList for the given application instance.
        /// It also adds thumbnail toolbars, which are a set of up to seven buttons at the bottom of the taskbar’s icon thumbnail preview.
        /// </summary>
        /// <param name="windowHandle">The application instance's main window handle.</param>
        /// <param name="buttons">The thumbnail toolbar buttons to be added.</param>
        public void CreateJumpList(IntPtr windowHandle, WindowsThumbnailToolbarButtons buttons)
        {
            if (!IsSupported)
            {
                return;
            }

            var jumpList = JumpList.CreateJumpListForIndividualWindow(TaskbarManager.Instance.ApplicationId, windowHandle);

            jumpList.ClearAllUserTasks();
            jumpList.KnownCategoryToDisplay = JumpListKnownCategoryType.Recent;
            jumpList.Refresh();

            CreateTaskbarButtons(windowHandle, buttons);
        }
        public static void BuildJumplist(string appId, IntPtr windowHandle)
        {
            // Set the application specific id.
            TaskbarManager.Instance.ApplicationId = appId;

            var jumpList = JumpList.CreateJumpListForIndividualWindow(appId, windowHandle);

            // defining the JumpListLink "Close"
            JumpListLink userActionLink = new JumpListLink(Assembly.GetEntryAssembly().Location, ACTION_EXIT)
            {
                Arguments = ACTION_EXIT
            };

            jumpList.AddUserTasks(userActionLink);
            jumpList.Refresh();
        }
Exemple #12
0
        internal static void ClearWindowsJumpList(Form1 form)
        {
            #if Debug
            return;
            #endif

            switch (GetOSInfo())
            {
            case OS.Seven:
            {
                JumpList list = JumpList.CreateJumpListForIndividualWindow(ConstantUtil.jumpListApplicationId, form.Handle);         //TaskbarManager.Instance.ApplicationId
                list.ClearAllUserTasks();

                list.Refresh();
            }
            break;
            }
        }
        public static void SetTaskbarJumpListLink(IntPtr windowPointer, Dictionary <string, List <TaskbarSiteItem> > jumpListItems)
        {
            var jumpList = JumpList.CreateJumpListForIndividualWindow(Process.GetCurrentProcess().Id.ToString(), windowPointer);
            List <JumpListCustomCategory> categoriesList = new List <JumpListCustomCategory>();
            JumpListCustomCategory        jumpListCustomCategory;

            if (jumpListItems.ContainsKey(Inscriptions.TASKBAR_GROUP_WEBSITES))
            {
            }


            foreach (var item in jumpListItems)
            {
                jumpListCustomCategory = new JumpListCustomCategory(item.Key);

                foreach (var subItem in item.Value)
                {
                    if (subItem.TaskbarTitle == Inscriptions.TASKBAR_OFFICIAL_PAGE && subItem.SiteLink != Constants.URL_OFFICIAL_PAGE)
                    {
                        continue;
                    }

                    if (!string.IsNullOrWhiteSpace(subItem.SiteLink))
                    {
                        JumpListLink jumpListLink = new JumpListLink(subItem.SiteLink, subItem.TaskbarTitle);

                        if (File.Exists(subItem.IconPath))
                        {
                            jumpListLink.IconReference = new Microsoft.WindowsAPICodePack.Shell.IconReference(Path.Combine(subItem.IconPath), subItem.IconResourceId);
                        }

                        jumpListCustomCategory.AddJumpListItems(jumpListLink);
                    }
                }

                categoriesList.Add(jumpListCustomCategory);
            }

            jumpList.AddCustomCategories(categoriesList.ToArray());
            jumpList.Refresh();
        }
Exemple #14
0
 /// <summary>
 /// Creating a JumpList for the application
 /// </summary>
 /// <param name="windowHandle"></param>
 public SystemMenu(IntPtr windowHandle)
 {
     list = JumpList.CreateJumpListForIndividualWindow(windowHandle.ToString(), windowHandle);
     list.KnownCategoryToDisplay = JumpListKnownCategoryType.Recent;
     BuildList();
 }
Exemple #15
0
 private TaskBar(Window mainWindow, string appId)
 {
     TaskbarManager.Instance.ApplicationId = appId;
     JumpList = JumpList.CreateJumpListForIndividualWindow(TaskbarManager.Instance.ApplicationId, mainWindow);
     JumpList.KnownCategoryToDisplay = JumpListKnownCategoryType.Recent;
 }
Exemple #16
0
 public CustomJumplist(IntPtr windowHandle)
 {
     list = JumpList.CreateJumpListForIndividualWindow(TaskbarManager.Instance.ApplicationId, windowHandle);
     list.KnownCategoryToDisplay = JumpListKnownCategoryType.Recent;
     BuildList();
 }
Exemple #17
0
        internal static void SetWindowsJumpList(Form1 form)
        {
            #if Debug
            return;
            #endif

            try
            {
                switch (GetOSInfo())
                {
                case OS.Seven:
                {
                    if (!ConfigUtil.GetBoolParameter("RecreateJumpList") || !ConfigUtil.GetBoolParameter("ActiveJumpList"))
                    {
                        return;
                    }

                    JumpList          list      = JumpList.CreateJumpListForIndividualWindow(ConstantUtil.jumpListApplicationId, form.Handle);
                    JumpListSeparator separator = null;
                    JumpListLink      listLink  = null;

                    try
                    {
                        separator = new JumpListSeparator();

                        listLink                  = new JumpListLink(Assembly.GetEntryAssembly().Location, LanguageUtil.GetCurrentLanguageString("New", className));
                        listLink.Arguments        = ConstantUtil.cmdLineJLNew;
                        listLink.IconReference    = new IconReference(String.Format(@"{0}\Icons\JL\NewTab.ico", ConstantUtil.ApplicationExecutionPath()), 0);
                        listLink.WorkingDirectory = ConstantUtil.ApplicationExecutionPath();
                        list.AddUserTasks(listLink);

                        listLink                  = new JumpListLink(Assembly.GetEntryAssembly().Location, LanguageUtil.GetCurrentLanguageString("NewAndPaste", className));
                        listLink.Arguments        = ConstantUtil.cmdLineJLNewAndPaste;
                        listLink.WorkingDirectory = ConstantUtil.ApplicationExecutionPath();
                        list.AddUserTasks(listLink);

                        listLink                  = new JumpListLink(Assembly.GetEntryAssembly().Location, LanguageUtil.GetCurrentLanguageString("OpenFile", className));
                        listLink.Arguments        = ConstantUtil.cmdLineJLOpenFile;
                        listLink.IconReference    = new IconReference(String.Format(@"{0}\Icons\JL\OpenFile.ico", ConstantUtil.ApplicationExecutionPath()), 0);
                        listLink.WorkingDirectory = ConstantUtil.ApplicationExecutionPath();
                        list.AddUserTasks(listLink);

                        listLink                  = new JumpListLink(Assembly.GetEntryAssembly().Location, LanguageUtil.GetCurrentLanguageString("OpenSession", className));
                        listLink.Arguments        = ConstantUtil.cmdLineJLOpenSession;
                        listLink.IconReference    = new IconReference(String.Format(@"{0}\Icons\JL\OpenSession.ico", ConstantUtil.ApplicationExecutionPath()), 0);
                        listLink.WorkingDirectory = ConstantUtil.ApplicationExecutionPath();
                        list.AddUserTasks(listLink);

                        listLink                  = new JumpListLink(Assembly.GetEntryAssembly().Location, LanguageUtil.GetCurrentLanguageString("SearchInFiles", className));
                        listLink.Arguments        = ConstantUtil.cmdLineJLSearchInFiles;
                        listLink.IconReference    = new IconReference(String.Format(@"{0}\Icons\JL\SearchInFiles.ico", ConstantUtil.ApplicationExecutionPath()), 0);
                        listLink.WorkingDirectory = ConstantUtil.ApplicationExecutionPath();
                        list.AddUserTasks(listLink);

                        list.AddUserTasks(separator);

                        listLink                  = new JumpListLink(Assembly.GetEntryAssembly().Location, LanguageUtil.GetCurrentLanguageString("CheckNewVersion", className));
                        listLink.Arguments        = ConstantUtil.cmdLineJLCheckNewVersion;
                        listLink.IconReference    = new IconReference(String.Format(@"{0}\Icons\JL\CheckNewVersion.ico", ConstantUtil.ApplicationExecutionPath()), 0);
                        listLink.WorkingDirectory = ConstantUtil.ApplicationExecutionPath();
                        list.AddUserTasks(listLink);

                                #if Release
                        listLink = new JumpListLink(ConstantUtil.dtPadURL, LanguageUtil.GetCurrentLanguageString("WebSite", className));
                        listLink.IconReference = new IconReference(String.Format(@"{0}\Icons\JL\WebSite.ico", ConstantUtil.ApplicationExecutionPath()), 0);
                        list.AddUserTasks(listLink);
                                #endif

                        list.Refresh();
                    }
                    finally
                    {
                        if (separator != null)
                        {
                            separator.Dispose();
                        }
                        if (listLink != null)
                        {
                            listLink.Dispose();
                        }
                    }

                    ConfigUtil.UpdateParameter("RecreateJumpList", false.ToString());
                }
                break;
                }
            }
            catch (Exception exception)
            {
                WindowManager.ShowErrorBox(form, exception.Message, exception);
            }
        }
Exemple #18
0
 public ApplicationJumpList(IntPtr windowHandle)
 {
     // Crea un nuevo JumpList para la aplicación
     myJumpList = JumpList.CreateJumpListForIndividualWindow(TaskbarManager.Instance.ApplicationId, windowHandle);
     ConstruirLista();
 }