Esempio n. 1
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. 2
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. 3
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. 4
0
        void Application_Idle(object sender, EventArgs e)
        {
            try
            {
                Process currentProcess = Process.GetCurrentProcess();
                if (currentProcess != null && currentProcess.MainWindowHandle != IntPtr.Zero && !bLoaded)
                {
                    bLoaded = true;
                    Application.Idle -= Application_Idle;
                    if (_jumpList == null)
                    {
                        _jumpList = JumpList.CreateJumpList();
                        _jumpList.KnownCategoryToDisplay = JumpListKnownCategoryType.Recent;
                        _jumpList.ClearAllUserTasks();
                        _jumpList.Refresh();
                    }
                    var list = new List<string>();
                    foreach (MyApps app in apps.ToList().OrderByDescending(x => x.Fileinfo.LastAccessTime))
                    {

                        if (app.Fileinfo.Exists)
                        {
                            string name = app.Fileinfo.Name.Replace(app.Fileinfo.Extension, "");
                            if (!list.Contains(name))
                            {
                                JumpListTask task = new JumpListLink(app.Path, name)
                                {
                                    IconReference = new IconReference(app.Path, 0),
                                };

                                _jumpList.AddUserTasks(task);
                                list.Add(name);
                            }
                        }
                    }
                    
                    _jumpList.Refresh();
                }
            }
            catch
            { }
        }
Esempio n. 5
0
        public void InjectJumpListMenu()
        {
            IntPtr? handle = GetWindowHandleOrNull();
            if (!handle.HasValue)
                return;

            string cmdPath = Assembly.GetEntryAssembly().Location;

            var jumpList = JumpList.CreateJumpListForIndividualWindow("headless-slacker", handle.Value);
            var category = new JumpListCustomCategory("Headless Slack");

            var hideCommand = new JumpListLink(cmdPath, "Hide Taskbar Icon")
            {
                Arguments = "/h",
                IconReference = new IconReference(cmdPath, 0)
            };

            category.AddJumpListItems(hideCommand);

            jumpList.AddCustomCategories(category);
            jumpList.Refresh();
        }
Esempio n. 6
0
        public void AddTask()
        {
            string systemFolder = Environment.GetFolderPath(Environment.SpecialFolder.System);
            IJumpListTask notepadTask = new JumpListLink(
                System.IO.Path.Combine(systemFolder, "notepad.exe"), "Open Notepad")
                {
                    IconReference = new IconReference(Path.Combine(systemFolder, "notepad.exe"), 0)
                };
            IJumpListTask calcTask = new JumpListLink(
                Path.Combine(systemFolder, "calc.exe"), "Open Calculator")
                {
                    IconReference = new IconReference(Path.Combine(systemFolder, "calc.exe"), 0)
                };
            IJumpListTask paintTask = new JumpListLink(
                Path.Combine(systemFolder, "mspaint.exe"), "Open Paint")
            {
                IconReference = new IconReference(Path.Combine(systemFolder, "mspaint.exe"), 0)
            };

            JumpList.AddUserTasks(notepadTask, calcTask, new JumpListSeparator(), paintTask);
            JumpList.Refresh();
        }
Esempio n. 7
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. 8
0
        private void AppendTaskList()
        {
            if (userTasks == null || userTasks.Count == 0)
            {
                return;
            }

            IObjectCollection taskContent =
                (IObjectCollection) new CEnumerableObjectCollection();

            // Add each task's shell representation to the object array
            foreach (JumpListTask task in userTasks)
            {
                JumpListSeparator seperator;
                JumpListLink      link = task as JumpListLink;
                if (link != null)
                {
                    taskContent.AddObject(link.NativeShellLink);
                }
                else if ((seperator = task as JumpListSeparator) != null)
                {
                    taskContent.AddObject(seperator.NativeShellLink);
                }
            }

            // Add tasks to the taskbar
            HResult hr = customDestinationList.AddUserTasks((IObjectArray)taskContent);

            if (!CoreErrorHelper.Succeeded(hr))
            {
                if ((uint)hr == 0x80040F03)
                {
                    throw new InvalidOperationException(LocalizedMessages.JumpListFileTypeNotRegistered);
                }
                throw new ShellException(hr);
            }
        }
        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. 10
0
        private void SetUpJumpList( )
        {
            if ( NativeApi.IsWindow7OrLater && NativeApi.IsRecentDocumentTrackingEnabled ( ) ) {
                var cat = new JumpListCustomCategory ( "Plugins" );

                var jumper = Microsoft.WindowsAPICodePack.Taskbar.JumpList.CreateJumpList ( );
                string appPath = System.IO.Path.Combine ( Program.LocalPath, "DroidExplorer.Runner.exe" );
                foreach ( var item in Settings.Instance.PluginSettings.Plugins ) {
                    IPlugin iplug = Settings.Instance.PluginSettings.GetPlugin ( item.ID.Replace ( " ", string.Empty ) );
                    if ( item.Enabled && iplug != null && iplug.Runnable ) {
                        JumpListLink jll = new JumpListLink ( appPath, iplug.Text );
                        jll.Arguments = string.Format ( CultureInfo.InvariantCulture, "/type={0}", item.ID.Replace ( " ", string.Empty ) );
                        jll.IconReference = new Microsoft.WindowsAPICodePack.Shell.IconReference ( string.Format ( CultureInfo.InvariantCulture, "{0},0", appPath ) );

                        cat.AddJumpListItems ( jll );
                    }
                }
                jumper.AddCustomCategories ( cat );
                jumper.Refresh ( );
            }
        }
Esempio n. 11
0
        private void AppendCustomCategories()
        {
            // Initialize our current index in the custom categories list
            int currentIndex = 0;

            // Keep track whether we add the Known Categories to our list
            bool knownCategoriesAdded = false;

            if (customCategoriesCollection != null)
            {
                // Append each category to list
                foreach (JumpListCustomCategory category in customCategoriesCollection)
                {
                    // If our current index is same as the KnownCategory OrdinalPosition,
                    // append the Known Categories
                    if (!knownCategoriesAdded && currentIndex == KnownCategoryOrdinalPosition)
                    {
                        AppendKnownCategories();
                        knownCategoriesAdded = true;
                    }

                    // Don't process empty categories
                    if (category.JumpListItems.Count == 0)
                    {
                        continue;
                    }

                    IObjectCollection categoryContent =
                        (IObjectCollection) new CEnumerableObjectCollection();

                    // Add each link's shell representation to the object array
                    foreach (IJumpListItem link in category.JumpListItems)
                    {
                        JumpListItem listItem = link as JumpListItem;
                        JumpListLink listLink = link as JumpListLink;
                        if (listItem != null)
                        {
                            categoryContent.AddObject(listItem.NativeShellItem);
                        }
                        else if (listLink != null)
                        {
                            categoryContent.AddObject(listLink.NativeShellLink);
                        }
                    }

                    // Add current category to destination list
                    HResult hr = customDestinationList.AppendCategory(
                        category.Name,
                        (IObjectArray)categoryContent);

                    if (!CoreErrorHelper.Succeeded(hr))
                    {
                        if ((uint)hr == 0x80040F03)
                        {
                            throw new InvalidOperationException(LocalizedMessages.JumpListFileTypeNotRegistered);
                        }
                        else if ((uint)hr == 0x80070005 /*E_ACCESSDENIED*/)
                        {
                            // If the recent documents tracking is turned off by the user,
                            // custom categories or items to an existing category cannot be added.
                            // The recent documents tracking can be changed via:
                            //      1. Group Policy “Do not keep history of recently opened documents”.
                            //      2. Via the user setting “Store and display recently opened items in
                            //         the Start menu and the taskbar” in the Start menu property dialog.
                            //
                            throw new UnauthorizedAccessException(LocalizedMessages.JumpListCustomCategoriesDisabled);
                        }

                        throw new ShellException(hr);
                    }

                    // Increase our current index
                    currentIndex++;
                }
            }

            // If the ordinal position was out of range, append the Known Categories
            // at the end
            if (!knownCategoriesAdded)
            {
                AppendKnownCategories();
            }
        }
Esempio n. 12
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());
            }
        }
        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. 14
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. 15
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"
            };

            _JumpList.AddUserTasks(compose);
            _JumpList.AddUserTasks(inbox);
            _JumpList.AddUserTasks(refresh);
            _JumpList.AddUserTasks(settings);
            _JumpList.AddUserTasks(about);
        }
Esempio n. 16
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. 17
0
        private void CmdJump_Click(object sender, EventArgs e)
        {
            FileStream fsOutput;
            Icon Current = null;
            Helper H = new Helper();
            Directory.CreateDirectory(Application.StartupPath + "\\Ico\\");
            fsOutput = new FileStream(Application.StartupPath + "\\Ico\\Lock.ico", FileMode.OpenOrCreate, FileAccess.Write);
            Current = H.GetIcon(Chiave.Properties.Resources.Pic_Lock, 128, true);
            //Chiave.Properties.Resources.Lock.Save(fsOutput);
            Current.Save(fsOutput);
            fsOutput.Close();

            fsOutput = new FileStream(Application.StartupPath + "\\Ico\\UnLock.ico", FileMode.OpenOrCreate, FileAccess.Write);
            //Chiave.Properties.Resources.UnLock.Save(fsOutput);
            Current = H.GetIcon(Chiave.Properties.Resources.Pic_UnLock, 128, true);
            Current.Save(fsOutput);
            fsOutput.Close();

            fsOutput = new FileStream(Application.StartupPath + "\\Ico\\Options.ico", FileMode.OpenOrCreate, FileAccess.Write);
            //Chiave.Properties.Resources.Options.Save(fsOutput);
            Current = H.GetIcon(Chiave.Properties.Resources.Pic_Options, 128, true);
            Current.Save(fsOutput);
            fsOutput.Close();

            JumpList JumpList = JumpList.CreateJumpList();
            string EncryPath = System.IO.Path.Combine(Application.StartupPath, "chiave.exe");
            JumpListLink Encryption = new JumpListLink(EncryPath, "Encryption");
            Encryption.Arguments = "1";
            Encryption.IconReference = new IconReference(Application.StartupPath + "\\Ico\\Lock.ico", 0);

            string DecPath = System.IO.Path.Combine(Application.StartupPath, "chiave.exe");
            JumpListLink Decryption = new JumpListLink(DecPath, "Decryption");
            Decryption.Arguments = "2";
            Decryption.IconReference = new IconReference(Application.StartupPath + "\\Ico\\UnLock.ico", 0);

            JumpListSeparator Separator = new JumpListSeparator();

            string OptsPath = System.IO.Path.Combine(Application.StartupPath, "chiave.exe");
            JumpListLink Options = new JumpListLink(OptsPath, "Options");
            Options.Arguments = "4";
            Options.IconReference = new IconReference(Application.StartupPath + "\\Ico\\Options.ico", 0);

            JumpList.AddUserTasks(Encryption, Decryption, Separator, Options);
            JumpList.Refresh();
            if (sender != null)
            {
                MainWindow.Instance.ShowMessage("JumpList Updated Succesfully!", MainWindow.MessageBoxIcon.Successful, MainWindow.MessageIcon.Options, true, false, true);

            }
            CmdFileAssociations_Click(null, null);
            //Directory.Delete(Application.StartupPath + "\\Ico", true);
        }
Esempio n. 18
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. 19
0
        //The following method is part of the lab. Add a few user tasks, using several
        //instances of the JumpListLink class and the JumpList.AddUserTasks method. Some ideas are
        //notepad.exe, calc.exe, mspaint.exe and other Windows utilities.
        private void OnAddTask(object unused1, RoutedEventArgs unused2)
        {
            //TODO: Task 6--Using Taskbar Jump Lists, steps 1-7
            string systemFolder = Environment.GetFolderPath(Environment.SpecialFolder.System);
            IJumpListTask notepadTask = new JumpListLink(
                System.IO.Path.Combine(systemFolder, "notepad.exe"), "Open Notepad")
                {
                    IconReference = new IconReference(Path.Combine(systemFolder, "notepad.exe"), 0)
                };
            IJumpListTask calcTask = new JumpListLink(
                Path.Combine(systemFolder, "calc.exe"), "Open Calculator")
                {
                    IconReference = new IconReference(Path.Combine(systemFolder, "calc.exe"), 0)
                };
            IJumpListTask paintTask = new JumpListLink(
                Path.Combine(systemFolder, "mspaint.exe"), "Open Paint")
            {
                IconReference = new IconReference(Path.Combine(systemFolder, "mspaint.exe"), 0)
            };

            JumpList.AddUserTasks(notepadTask, calcTask, new JumpListSeparator(), paintTask);
            JumpList.Refresh();

        }
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
        private void OfflineJumpList(ref JumpList jumpList)
        {
            var task = new JumpListLink(System.Windows.Forms.Application.ExecutablePath, "About GVNotifier...");
            task.Arguments = "/about";
            //this.Try(() => task.IconReference = new Microsoft.WindowsAPICodePack.Shell.IconReference(System.Windows.Forms.Application.ExecutablePath, 0));
            jumpList.AddUserTasks(task);

            task = new JumpListLink(System.Windows.Forms.Application.ExecutablePath, "Preferences...");
            task.Arguments = "/prefs";
            //this.Try(() =>task.IconReference = new Microsoft.WindowsAPICodePack.Shell.IconReference( System.Windows.Forms.Application.ExecutablePath, 1));
            jumpList.AddUserTasks(task);

            task = new JumpListLink(System.Windows.Forms.Application.ExecutablePath, "Open Google Voice Website");
            task.Arguments = "/gv";
            //this.Try(() =>task.IconReference = new Microsoft.WindowsAPICodePack.Shell.IconReference(System.Windows.Forms.Application.ExecutablePath, 2));
            jumpList.AddUserTasks(task);

            if (SessionModel.Inst != null)
            {
                jumpList.AddUserTasks(new JumpListSeparator());

                task = new JumpListLink(System.Windows.Forms.Application.ExecutablePath, "Sign Out");
                task.Arguments = "/signout";
                //this.Try(() =>task.IconReference = new Microsoft.WindowsAPICodePack.Shell.IconReference(System.Windows.Forms.Application.ExecutablePath, 4));
                jumpList.AddUserTasks(task);
            }

            jumpList.AddUserTasks(new JumpListSeparator());

            task = new JumpListLink(System.Windows.Forms.Application.ExecutablePath, "Quit");
            task.Arguments = "/quit";
            //this.Try(() => task.IconReference = new Microsoft.WindowsAPICodePack.Shell.IconReference(System.Windows.Forms.Application.ExecutablePath, 3));
            jumpList.AddUserTasks(task);
        }
Esempio n. 22
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. 23
0
        internal void AddJumpList()
        {
            _jumpList = JumpList.CreateJumpList();

            //do i need this?
            _jumpList.ClearAllUserTasks();
            _jumpList.Refresh();

            JumpListLink openTask = new JumpListLink(_baseUrl, "Open Inbox")
            {
                Arguments = "inbox",
                IconReference = new IconReference(Application.ExecutablePath, 2),
            };

            JumpListLink composeTask = new JumpListLink(_baseUrl + "#compose", "Compose mail")
            {
                Arguments = "compose",
                IconReference = new IconReference(Application.ExecutablePath, 1),
            };

            JumpListLink refreshTask = new JumpListLink(Application.ExecutablePath, "Check for new mail")
            {
                Arguments = "refresh",
                IconReference = new IconReference(Application.ExecutablePath, 4),
            };

            JumpListLink settingsTask = new JumpListLink(Application.ExecutablePath, "Settings")
            {
                Arguments = "settings",
                IconReference = new IconReference(Application.ExecutablePath, 5),
            };

            JumpListLink logoutTask = new JumpListLink(Application.ExecutablePath, "Logout")
            {
                Arguments = "logout",
                IconReference = new IconReference(Application.ExecutablePath, 3),
            };

            _jumpList.AddUserTasks(new JumpListTask[] { openTask, composeTask, refreshTask, settingsTask, logoutTask }); //new JumpListSeparator(),

            _jumpList.Refresh(); // do i need this?
        }
Esempio n. 24
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
            }
        }