Esempio n. 1
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) { }
        }
Esempio n. 2
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. 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();
        }
Esempio n. 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") });
        }
Esempio n. 5
0
        void RebuildRecentJumpList()
        {
            if (!File.Exists(_recentFiles))
            {
                return;
            }

            var files = File.ReadAllLines(_recentFiles);


            _jumpList = JumpList.CreateJumpList();
            List <JumpListTask> tasks = new List <JumpListTask>();

            List <JumpListCustomCategory> cats = new List <JumpListCustomCategory>();

            foreach (var item in files)
            {
                var fi = new FileInfo(item);

                var task = new JumpListLink(Assembly.GetEntryAssembly().Location, fi.Name + "    (" + fi.DirectoryName + ")");
                task.WorkingDirectory = fi.DirectoryName;
                task.Arguments        = item;


                tasks.Add(task);
            }

            _jumpList.AddUserTasks(tasks.ToArray());
            _jumpList.Refresh();
        }
Esempio n. 6
0
        private void MainFrm_Shown(object sender, EventArgs e)
        {
            string[] a = Environment.GetCommandLineArgs();
            //Przyciski Aero
            Size s = new Size(16, 16);

            buttonFirst        = new ThumbnailToolbarButton(new Icon(Friends_from_MegaVideo_player.Properties.Resources.back_arrowICO, s), "Odtwórz poprzedni");
            buttonFirst.Click += new EventHandler <ThumbnailButtonClickedEventArgs>(odtwórzPoprzedniToolStripMenuItem_Click);

            buttonSecond        = new ThumbnailToolbarButton(new Icon(Friends_from_MegaVideo_player.Properties.Resources.Forward_ArrowICO, s), "Odtwórz następny");
            buttonSecond.Click += new EventHandler <ThumbnailButtonClickedEventArgs>(odtwórzNastęnyToolStripMenuItem_Click);

            windowsTaskbar.ThumbnailToolbars.AddButtons(this.Handle, buttonFirst, buttonSecond);

            //JumpLista
            JumpList Lista = JumpList.CreateJumpList();

            IJumpListTask zadanie1 = new JumpListLink(@"E:\Gry\Moje dokumenty\Visual Studio 2010\Projects\Friends from MegaVideo player\Friends from MegaVideo player\bin\Debug\Friends from MegaVideo player.exe", "Uruchom notatnik")
            {
                IconReference = new Microsoft.WindowsAPICodePack.Shell.IconReference(@"E:\Gry\Moje dokumenty\Visual Studio 2010\Projects\Friends from MegaVideo player\Friends from MegaVideo player\bin\Debug\Friends from MegaVideo player.exe", 0),
                Title         = @"c:\widnows\notepad.exe"
            };

            Lista.AddUserTasks(zadanie1);
            Lista.Refresh();
        }
Esempio n. 7
0
        public static void AddToRecent(JumpListLink link)
        {
            if (nativeShellLinkGetMethod == null)
            {
                //find the NativeShellLink property on the JumpListLink
                Type         jumpListLinkType        = typeof(JumpListLink);
                PropertyInfo nativeShellLinkProperty = jumpListLinkType.GetProperty("NativeShellLink",
                                                                                    System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);

                if (nativeShellLinkProperty == null)
                {
                    throw new InvalidOperationException();
                }

                //Save the Method info for later use, so we have to do the reflection only once.
                nativeShellLinkGetMethod = nativeShellLinkProperty.GetGetMethod(true);
            }

            //Get the value of the NativeShellLink property.
            //Cast this to our own implementation of IShellLinkW because it is using COM interop.
            IShellLinkW nativeShellLink = (IShellLinkW)nativeShellLinkGetMethod.Invoke(link, null);

            // Now make the call to Win32 to add the link to the recent items
            SHAddToRecentDocs(ShellAddToRecentDocs.Link, nativeShellLink);
        }
Esempio n. 8
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. 9
0
        public static void Update()
        {
            if (IsSupported())
            {
                JumpList    jumpList = JumpList.CreateJumpList();
                List <Prog> progs    = new ProgList().GetJumpList();
                progs.Reverse();

                foreach (Prog prog in progs)
                {
                    var task = new JumpListLink(System.Reflection.Assembly.GetEntryAssembly().Location, prog.Name)
                    {
                        Arguments = "start " + prog.ID
                    };
                    if (File.Exists(prog.Icon))
                    {
                        task.IconReference = new IconReference(@prog.Icon, 0);
                    }
                    task.WorkingDirectory = Environment.CurrentDirectory;
                    jumpList.AddUserTasks(task);
                }

                jumpList.Refresh();
            }
        }
Esempio n. 10
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. 11
0
        private JumpListLink ParseApplyJumpListTask(JumpListItemObject jumplistItem, int itemIndex)
        {
            JumpListLink task = new JumpListLink
            {
                Title = jumplistItem.ItemName
            };

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

            switch (jumplistItem.TaskAction)
            {
            case JumpListItemObject.ActionType.Keyboard:
                string kbdScriptName = GetKeyboardScriptFilename(jumplistItem, itemIndex);
                if (File.Exists(kbdScriptName))
                {    // It should already have been made
                    task.Path      = Common.Path_ProgramFiles + "\\AutoHotKey.exe";
                    task.Arguments = "\"" + kbdScriptName + "\"";
                }
                else
                {
                    return(null);
                }
                break;

            case JumpListItemObject.ActionType.CommandLine:
                if (jumplistItem.TaskCMDShowWindow)
                {
                    task.Path      = "cmd.exe";
                    task.Arguments = "/k \"" + jumplistItem.ItemCmdToString().Replace("\"", "\"\"") + "\"";
                }
                else
                {
                    task.Path      = jumplistItem.TaskCMDPath;
                    task.Arguments = jumplistItem.TaskCMDArgs;
                }
                break;

            case JumpListItemObject.ActionType.AutoHotKey:
                string ahkFilename = GetAhkScriptFilename(false, jumplistItem, itemIndex);
                if (File.Exists(ahkFilename))     // It should have already been made.
                {
                    task.Path      = Common.Path_ProgramFiles + "\\AutoHotKey.exe";
                    task.Arguments = "\"" + ahkFilename + "\"";
                }
                else
                {
                    return(null);
                }
                break;
            }
            return(task);
        }
Esempio n. 12
0
        /// <summary>
        /// Einträge in der JumpList (Aufgaben) des Tasks erzeugen
        /// 1. Notizen - StikyNot.exe
        /// 2. Snipping - Snipping.exe
        /// 3. Notepad - Notepad.exe
        /// </summary>
        void createTaksJumpList()
        {
            CustomJumpList = JumpList.CreateJumpList();

            CustomJumpList.ClearAllUserTasks();

            JumpListLink EntryNote = new JumpListLink(@"%windir%\system32\StikyNot.exe", "Notizen");

            EntryNote.IconReference = new IconReference(@"%windir%\system32\StikyNot.exe", 0);
            CustomJumpList.AddUserTasks(EntryNote);

            JumpListLink EntrySnipp = new JumpListLink(@"%windir%\system32\SnippingTool.exe", "Snipping");

            EntrySnipp.IconReference = new IconReference(@"%windir%\system32\SnippingTool.exe", 0);
            CustomJumpList.AddUserTasks(EntrySnipp);

            JumpListLink EntryNotepad = new JumpListLink(@"%windir%\system32\Notepad.exe", "Notepad");

            EntryNotepad.IconReference = new IconReference(@"%windir%\system32\Notepad.exe", 0);
            CustomJumpList.AddUserTasks(EntryNotepad);

            JumpListLink EntryCmd = new JumpListLink(@"%windir%\system32\cmd.exe", "Eingabeaufforderung");

            EntryCmd.IconReference = new IconReference(@"%windir%\system32\cmd.exe", 0);
            CustomJumpList.AddUserTasks(EntryCmd);

            if (!string.IsNullOrWhiteSpace(strTCmdPath))
            {
                JumpListLink EntryTCM = new JumpListLink(strTCmdPath, "Total Commander - " + strTCmdVersion);
                EntryTCM.IconReference = new IconReference(strTCmdPath, 0);
                CustomJumpList.AddUserTasks(EntryTCM);
            }

            CustomJumpList.Refresh();
        }
Esempio n. 13
0
        public void BuildJumpList()
        {
            MyJumplist.ClearRecent();
            // Create a JumpListLink with the path of the application and the name of the file
            // the name is displayed in the recent items list

            int      number        = 1;
            int      i             = StartIndex;
            Assembly entryAssembly = Assembly.GetEntryAssembly();

            if (entryAssembly == null)
            {
                //null during the unit test.
                return;
            }

            string exeFile = entryAssembly.Location;

            for (; i < EndIndex; i++, number++)
            {
                string       filePath = ((MruMenuItem)MenuItems[i]).Filename;
                string       fileName = Path.GetFileName(filePath);
                JumpListLink link     = new JumpListLink(exeFile, fileName);
                link.Arguments     = filePath;                      //any argument for the stating application
                link.IconReference = new IconReference(exeFile, 0); //set an icon for the link

                MyJumplist.AddToRecent(link);
            }
        }
Esempio n. 14
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. 15
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();
            }
        }
Esempio n. 16
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. 17
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. 18
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. 19
0
        private void AddJumpListItem(JumpListItem jli)
        {
            if (jli == JumpListItem.SeperatorItem)
            {
                _jumplist.AddUserTasks(new JumpListSeparator());
            }
            else
            {
                string fullpath = new Uri(Assembly.GetExecutingAssembly().GetName().CodeBase).LocalPath;

                var task = new JumpListLink(fullpath, jli.Title);
                task.Arguments = "--jump-" + jli.Argument;
                if (jli.IconIndex != JumpListItem.InvalidIconIndex)
                {
                    try
                    {
                        task.IconReference = new Microsoft.WindowsAPICodePack.Shell.IconReference(Path.Combine(System.Windows.Forms.Application.StartupPath, "IconPack.dll"), jli.IconIndex);
                    }
                    catch (Exception ex)
                    {
                        Trace.WriteLine("Error associating icon with jumplist item: " + ex);
                    }
                }
                _jumplist.AddUserTasks(task);
            }
        }
Esempio n. 20
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. 21
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. 22
0
        private static IEnumerable <JumpListLink> ShortcutsToLinks(string folderName)
        {
            Shell32.Shell  shell  = new Shell32.ShellClass();
            Shell32.Folder folder = shell.NameSpace(folderName);

            foreach (string filename in Directory.GetFiles(folderName, "*.lnk", SearchOption.TopDirectoryOnly).OrderBy(x => x, new StringLogicalComparer()))
            {
                string filenameOnly = System.IO.Path.GetFileName(filename);

                if (filenameOnly.StartsWith("-"))
                {
                    continue;
                }

                bool runAs = Program.IsMarkedRunAs(filename);

                Shell32.FolderItem folderItem = folder.ParseName(filenameOnly);
                if (folderItem != null)
                {
                    Shell32.ShellLinkObject link = (Shell32.ShellLinkObject)folderItem.GetLink;

                    string iconPath;
                    int    iconId = link.GetIconLocation(out iconPath);

                    if (String.IsNullOrEmpty(iconPath))
                    {
                        iconPath = link.Path;
                        iconId   = 0;
                    }

                    JumpListLink jumpLink;
                    if (runAs)
                    {
                        jumpLink = new JumpListLink(Application.ExecutablePath, GetDisplayName(filenameOnly))
                        {
                            Arguments        = BuildCommand("--launch", filename),
                            WorkingDirectory = Directory.GetCurrentDirectory(),
                        };
                    }
                    else
                    {
                        jumpLink = new JumpListLink(link.Path, GetDisplayName(filenameOnly))
                        {
                            Arguments        = link.Arguments,
                            WorkingDirectory = link.WorkingDirectory,
                            ShowCommand      = Enum.IsDefined(typeof(WindowShowCommand), link.ShowCommand) ?
                                               (WindowShowCommand)link.ShowCommand : WindowShowCommand.Default,
                        };
                    }

                    jumpLink.IconReference = new IconReference(iconPath, iconId);
                    yield return(jumpLink);
                }
            }
        }
Esempio n. 23
0
        public void AddRecent(string path)
        {
            OnEnsureRegistration();

            //JumpList.AddToRecent(path);
            JumpListLink jli = new JumpListLink(System.Environment.CurrentDirectory.ToString(), path);

            _currentCategory.AddJumpListItems(jli);

            JumpList.Refresh();
        }
Esempio n. 24
0
        private static JumpListLink CreateJumpListLink(string title, string path, string arguments, Microsoft.WindowsAPICodePack.Shell.IconReference?icon)
        {
            var task = new JumpListLink(path, title);

            if (icon.HasValue)
            {
                task.IconReference = icon.Value;
            }
            task.Arguments = arguments;

            return(task);
        }
Esempio n. 25
0
        //The following method is part of the lab. Ensure that the filename is valid,
        //and if it is -- create a new link and add it to the current category, and refresh
        //the jump list.
        private void createCategoryLink_Click(object sender, RoutedEventArgs e)
        {
            //TODO: Task 6--Using Taskbar Jump Lists, steps 32-34
            if (!CheckFileName(txtCategoryItem.Text))
            {
                return;
            }
            JumpListLink jli = new JumpListLink(GetTempFileName(txtCategoryLink.Text), txtCategoryLink.Text);

            _currentCategory.AddJumpListItems(jli);
            JumpList.Refresh();
        }
Esempio n. 26
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. 27
0
        private void BuildJumpList()
        {
            _jumpList.ClearAllUserTasks();

            int    defaultAccountIndex = _config.Accounts.IndexOf(_config.Accounts.Default);
            String exePath             = Application.ExecutablePath;
            String path = Path.Combine(Path.GetDirectoryName(exePath), "Resources\\Icons");

            JumpListTask compose = new JumpListLink(UrlHelper.BuildComposeUrl(defaultAccountIndex), Locale.Current.Labels.Compose)
            {
                IconReference = new IconReference(Path.Combine(path, "Compose.ico"), 0)
            };

            // we need a different icon name here, there's a really whacky conflict between an embedded resource, and a content resource file name.

            JumpListTask inbox = new JumpListLink(UrlHelper.BuildInboxUrl(defaultAccountIndex), Locale.Current.Labels.Inbox)
            {
                IconReference = new IconReference(Path.Combine(path, "GoInbox.ico"), 0)
            };

            JumpListTask refresh = new JumpListLink(exePath, Locale.Current.Labels.CheckMail)
            {
                IconReference = new IconReference(Path.Combine(path, "Refresh.ico"), 0),
                Arguments     = "-check"
            };

            JumpListTask settings = new JumpListLink(exePath, Locale.Current.Labels.ConfigurationShort)
            {
                IconReference = new IconReference(Path.Combine(path, "Settings.ico"), 0),
                Arguments     = "-settings"
            };

            JumpListTask about = new JumpListLink(exePath, Locale.Current.Labels.About)
            {
                IconReference = new IconReference(Path.Combine(path, "about.ico"), 0),
                Arguments     = "-about"
            };

            JumpListTask help = new JumpListLink(exePath, Locale.Current.Labels.Help)
            {
                IconReference = new IconReference(Path.Combine(path, "help.ico"), 0),
                Arguments     = "-help"
            };

            _jumpList.AddUserTasks(compose);
            _jumpList.AddUserTasks(inbox);
            _jumpList.AddUserTasks(refresh);
            _jumpList.AddUserTasks(settings);
            _jumpList.AddUserTasks(help);
            _jumpList.AddUserTasks(about);
        }
Esempio n. 28
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();
        }
Esempio n. 29
0
        internal static void InitJumpList()
        {
            jumpList = JumpList.CreateJumpList();
            jumpList.KnownCategoryToDisplay = JumpListKnownCategoryType.Neither;
            jumpList.ClearAllUserTasks();
            string       ourFileName = Assembly.GetEntryAssembly().Location;
            JumpListLink quitLink    = new JumpListLink(ourFileName, "Quit PeaRoxy")
            {
                Arguments = "--quit",
            };

            jumpList.AddUserTasks(new JumpListTask[] { quitLink });
            jumpList.Refresh();
        }
Esempio n. 30
0
        private void JumpListeAkt()
        {
            JumpList list = JumpList.CreateJumpList();

            list.ClearAllUserTasks();
            for (int i = 0; i < _dict.Namen.Length; i++)
            {
                JumpListLink j = new JumpListLink(Application.ExecutablePath, _dict.Namen[i]);
                j.Arguments     = i.ToString();
                j.IconReference = new Microsoft.WindowsAPICodePack.Shell.IconReference(System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), "explorer.exe"), 0);
                list.AddUserTasks(j);
            }
            list.AddUserTasks(new JumpListLink(Application.StartupPath, "open directory"));
            list.Refresh();
        }