Esempio n. 1
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();
        }
Esempio n. 2
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();
            }
Esempio n. 3
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();
            }
        }
        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();
            }
        }
Esempio n. 5
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") });
        }
Esempio n. 6
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);
        }
Esempio n. 7
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();
        }
Esempio n. 8
0
        public static void UpdateJumpList()
        {
            // Create a Jump List for AML Studio connections
            try
            {
                var          list     = JumpList.CreateJumpList();
                var          currPath = Program.AssemblyPath;
                JumpListLink link;
                var          links = new List <IJumpListItem>();

                foreach (var conn in ConnectionManager.Current.Library.Connections)
                {
                    link               = new JumpListLink(currPath, conn.ConnectionName);
                    link.Arguments     = "\"/amlstudio:" + conn.ConnectionName + "\"";
                    link.IconReference = new IconReference(currPath, 1);
                    links.Add(link);
                }

                var amlStudioCat = new JumpListCustomCategory("AML Studio");
                amlStudioCat.AddJumpListItems(links.ToArray());
                list.AddCustomCategories(amlStudioCat);
                list.Refresh();
            }
            catch (Exception) { }
        }
        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();
            }
        }
Esempio n. 10
0
        public static void UpdateTaskbarServers()
        {
            if (!TaskbarManager.IsPlatformSupported)
            {
                return;
            }

            var jl             = JumpList.CreateJumpList();
            var serverCategory = new JumpListCustomCategory("Servers");

            string exe = Process.GetCurrentProcess().MainModule.FileName;

            IList <ServerEntry> servers = Servers.GetEntries().ToList();

            JumpListLink[] links = new JumpListLink[servers.Count];
            for (int i = 0; i < servers.Count; ++i)
            {
                var s = servers[i];
                links[i] = new JumpListLink(exe, s.Name)
                {
                    Arguments     = s.Id.ToString(),
                    IconReference = new IconReference(exe, 1)
                };
            }

            serverCategory.AddJumpListItems(links);

            jl.AddCustomCategories(serverCategory);

            try {
                jl.Refresh();
            } catch (UnauthorizedAccessException) {             // Jumplists disabled
            }
        }
Esempio n. 11
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();
        }
Esempio n. 12
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();
        }
Esempio n. 13
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();
        }
Esempio n. 14
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();
        }
Esempio n. 15
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);
            }
        }
Esempio n. 16
0
        /// <summary>
        /// Builds the Jumplist
        /// </summary>
        private void BuildList()
        {
            JumpListCustomCategory userActionsCategory = new JumpListCustomCategory("Actions");
            JumpListLink           userActionLink      = new JumpListLink(Assembly.GetEntryAssembly().Location, "Help & Github");

            userActionLink.Arguments = "help";
            userActionsCategory.AddJumpListItems(userActionLink);
            list.AddCustomCategories(userActionsCategory);
            list.Refresh();
        }
Esempio n. 17
0
        //The following method is part of the lab. Create a new JumpListCustomCategory, store
        //it as the current category and refresh it. Don't forget to enable the sub-controls.
        private void createCategory_Click(object sender, RoutedEventArgs e)
        {
            //TODO: Task 6--Using Taskbar Jump Lists, steps 20-25
            _currentCategory = new JumpListCustomCategory(this.txtCategory.Text);
            JumpList.AddCustomCategories(_currentCategory);
            JumpList.Refresh();

            this.createCategoryItem.IsEnabled = true;
            this.createCategoryLink.IsEnabled = true;
            this.txtCategoryItem.IsEnabled    = true;
            this.txtCategoryLink.IsEnabled    = true;
        }
Esempio n. 18
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();
        }
Esempio n. 19
0
        private JumpListCustomCategory CreateCategory(string fileName, string categoryName, string searchPattern)
        {
            var fi = new FileInfo(fileName);

            var category = new JumpListCustomCategory(fi.DirectoryName);

            var vsmPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "VSM");
            var items   = from f in Directory.GetFiles(vsmPath, searchPattern)
                          select new JumpListItem(Path.Combine(vsmPath, f));

            category.AddJumpListItems(items.ToArray());

            return(category);
        }
Esempio n. 20
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
        }
Esempio n. 21
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);
     }
 }
Esempio n. 22
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();
        }
Esempio n. 23
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();
            }
        }
        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();
        }
Esempio n. 25
0
        private void RefreshJumpList()
        {
            if (m_FavoriteRdsAppList != null)
            {
                this.m_JumpList = JumpList.CreateJumpList();

                RdsServerIdList hosts = this.m_FavoriteRdsAppList.RdsServerIds;
                foreach (RdsServerId id in hosts)
                {
                    JumpListCustomCategory      category = new JumpListCustomCategory(id.Hostname);
                    Dictionary <string, string> apps     = this.m_FavoriteRdsAppList.GetAppLinksAndDisplayNamesForHost(id.Hostname);
                    foreach (KeyValuePair <string, string> app in apps)
                    {
                        JumpListLink link = new JumpListLink(app.Key, app.Value);
                        category.AddJumpListItems(link);
                    }
                    this.m_JumpList.AddCustomCategories(category);
                }
                this.m_JumpList.Refresh();
            }
        }
        // Create a custom category
        private void btnCreateCategory_Click(object sender, EventArgs e)
        {
            try
            {
                // Create a new custom category based on the category name in tbCategory
                _currentCategory = new JumpListCustomCategory(tbCategory.Text);

                // Add the custom category instance into the Jump List
                JumpList.AddCustomCategories(_currentCategory);

                // Refresh the Jump List instance and update the UI
                JumpList.Refresh();
                btnAddItem.Enabled = true;
                btnAddLink.Enabled = true;
                tbItem.Enabled     = true;
                tbLink.Enabled     = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 27
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();
        }
        internal void ZScreen_Windows7onlyTasks()
        {
            if (!Engine.ConfigApp.Windows7TaskbarIntegration)
            {
                if (Engine.zJumpList != null)
                {
                    Engine.zJumpList.ClearAllUserTasks();
                    Engine.zJumpList.Refresh();
                }
            }
            else if (!IsDisposed && !_Windows7TaskbarIntegrated && Engine.ConfigApp.Windows7TaskbarIntegration && this.Handle != IntPtr.Zero && TaskbarManager.IsPlatformSupported && this.ShowInTaskbar)
            {
                try
                {
                    Engine.CheckFileRegistration();

                    Engine.zWindowsTaskbar = TaskbarManager.Instance;
                    Engine.zWindowsTaskbar.ApplicationId = Engine.appId;

                    Engine.zJumpList = JumpList.CreateJumpList();

                    // User Tasks
                    JumpListLink jlCropShot = new JumpListLink(Adapter.ZScreenCliPath(), "Crop Shot");
                    jlCropShot.Arguments     = "-cc";
                    jlCropShot.IconReference = new IconReference(Adapter.ResourcePath, 1);
                    Engine.zJumpList.AddUserTasks(jlCropShot);

                    JumpListLink jlSelectedWindow = new JumpListLink(Adapter.ZScreenCliPath(), "Selected Window");
                    jlSelectedWindow.Arguments     = "-sw";
                    jlSelectedWindow.IconReference = new IconReference(Adapter.ResourcePath, 2);
                    Engine.zJumpList.AddUserTasks(jlSelectedWindow);

                    JumpListLink jlClipboardUpload = new JumpListLink(Adapter.ZScreenCliPath(), "Clipboard Upload");
                    jlClipboardUpload.Arguments     = "-cu";
                    jlClipboardUpload.IconReference = new IconReference(Adapter.ResourcePath, 3);
                    Engine.zJumpList.AddUserTasks(jlClipboardUpload);

                    JumpListLink jlHistory = new JumpListLink(Application.ExecutablePath, "Open History");
                    jlHistory.Arguments     = "-hi";
                    jlHistory.IconReference = new IconReference(Adapter.ResourcePath, 4);
                    Engine.zJumpList.AddUserTasks(jlHistory);

                    // Recent Items
                    Engine.zJumpList.KnownCategoryToDisplay = JumpListKnownCategoryType.Recent;

                    // Custom Categories
                    JumpListCustomCategory paths = new JumpListCustomCategory("Paths");

                    JumpListLink imagesJumpListLink = new JumpListLink(FileSystem.GetImagesDir(), "Images");
                    imagesJumpListLink.IconReference = new IconReference(Path.Combine("%windir%", "explorer.exe"), 0);

                    JumpListLink settingsJumpListLink = new JumpListLink(Engine.SettingsDir, "Settings");
                    settingsJumpListLink.IconReference = new IconReference(Path.Combine("%windir%", "explorer.exe"), 0);

                    JumpListLink logsJumpListLink = new JumpListLink(Engine.LogsDir, "Logs");
                    logsJumpListLink.IconReference = new IconReference(Path.Combine("%windir%", "explorer.exe"), 0);

                    paths.AddJumpListItems(imagesJumpListLink, settingsJumpListLink, logsJumpListLink);
                    Engine.zJumpList.AddCustomCategories(paths);

                    // Taskbar Buttons
                    ThumbnailToolBarButton cropShot = new ThumbnailToolBarButton(Resources.shape_square_ico, "Crop Shot");
                    cropShot.Click += new EventHandler <ThumbnailButtonClickedEventArgs>(cropShot_Click);

                    ThumbnailToolBarButton selWindow = new ThumbnailToolBarButton(Resources.application_double_ico, "Selected Window");
                    selWindow.Click += new EventHandler <ThumbnailButtonClickedEventArgs>(selWindow_Click);

                    ThumbnailToolBarButton clipboardUpload = new ThumbnailToolBarButton(Resources.clipboard_upload_ico, "Clipboard Upload");
                    clipboardUpload.Click += new EventHandler <ThumbnailButtonClickedEventArgs>(clipboardUpload_Click);

                    ThumbnailToolBarButton openHistory = new ThumbnailToolBarButton(Resources.pictures_ico, "History");
                    openHistory.Click += new EventHandler <ThumbnailButtonClickedEventArgs>(OpenHistory);

                    if (!IsDisposed)
                    {
                        Engine.zWindowsTaskbar.ThumbnailToolBars.AddButtons(this.Handle, cropShot, selWindow, clipboardUpload, openHistory);
                        Engine.zJumpList.Refresh();
                    }
                    _Windows7TaskbarIntegrated = true;
                    DebugHelper.WriteLine("Integrated into Windows 7 Taskbar");
                }
                catch (Exception ex)
                {
                    DebugHelper.WriteException(ex, "Error while configuring Windows 7 Taskbar");
                }
            }

            DebugHelper.WriteLine(new StackFrame().GetMethod().Name);
        }
Esempio n. 29
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);
        }
Esempio n. 30
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());
            }
        }