Represents an instance of a Taskbar button jump list.
        private void UpdateJumpList()
        {
            Taskbar.JumpList jumplist = Taskbar.JumpList.CreateJumpList();
            jumplist.KnownCategoryToDisplay = Taskbar.JumpListKnownCategoryType.Neither;

            Taskbar.JumpListCustomCategory recentProjectsCategory = new Taskbar.JumpListCustomCategory("Recent Solutions");
            Taskbar.JumpListCustomCategory recentFilesCategory    = new Taskbar.JumpListCustomCategory("Recent Files");

            jumplist.AddCustomCategories(recentProjectsCategory, recentFilesCategory);
            jumplist.KnownCategoryOrdinalPosition = 0;

            foreach (RecentFile recentProject in recentFiles.GetProjects())
            {
                // Windows is picky about files that are added to the jumplist. Only files that MonoDevelop
                // has been registered as supported in the registry can be added.
                bool isSupportedFileExtension = this.supportedExtensions.Contains(Path.GetExtension(recentProject.FileName));
                if (isSupportedFileExtension)
                {
                    recentProjectsCategory.AddJumpListItems(new Taskbar.JumpListItem(recentProject.FileName));
                }
            }

            foreach (RecentFile recentFile in recentFiles.GetFiles())
            {
                if (this.supportedExtensions.Contains(Path.GetExtension(recentFile.FileName)))
                {
                    recentFilesCategory.AddJumpListItems(new Taskbar.JumpListItem(recentFile.FileName));
                }
            }

            jumplist.Refresh();
        }
        private void UpdateJumpList()
        {
            Taskbar.JumpList jumplist = Taskbar.JumpList.CreateJumpListForIndividualWindow(
                MonoDevelop.Core.BrandingService.ApplicationName,
                GdkWin32.HgdiobjGet(MessageService.RootWindow.GdkWindow)
                );
            jumplist.KnownCategoryToDisplay = Taskbar.JumpListKnownCategoryType.Neither;

            Taskbar.JumpListCustomCategory recentProjectsCategory = new Taskbar.JumpListCustomCategory("Recent Solutions");
            Taskbar.JumpListCustomCategory recentFilesCategory    = new Taskbar.JumpListCustomCategory("Recent Files");

            jumplist.AddCustomCategories(recentProjectsCategory, recentFilesCategory);
            jumplist.KnownCategoryOrdinalPosition = 0;

            foreach (RecentFile recentProject in recentFiles.GetProjects())
            {
                // Windows is picky about files that are added to the jumplist. Only files that MonoDevelop
                // has been registered as supported in the registry can be added.
                bool isSupportedFileExtension = this.supportedExtensions.Contains(Path.GetExtension(recentProject.FileName));
                if (isSupportedFileExtension)
                {
                    recentProjectsCategory.AddJumpListItems(new Taskbar.JumpListLink(exePath, recentProject.DisplayName)
                    {
                        Arguments     = MonoDevelop.Core.Execution.ProcessArgumentBuilder.Quote(recentProject.FileName),
                        IconReference = new Microsoft.WindowsAPICodePack.Shell.IconReference(exePath, 0),
                    });
                }
            }

            foreach (RecentFile recentFile in recentFiles.GetFiles())
            {
                if (this.supportedExtensions.Contains(Path.GetExtension(recentFile.FileName)))
                {
                    recentFilesCategory.AddJumpListItems(new Taskbar.JumpListLink(exePath, recentFile.DisplayName)
                    {
                        Arguments     = MonoDevelop.Core.Execution.ProcessArgumentBuilder.Quote(recentFile.FileName),
                        IconReference = new Microsoft.WindowsAPICodePack.Shell.IconReference(exePath, 0),
                    });
                }
            }

            jumplist.Refresh();
        }
Ejemplo n.º 3
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
            { }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Refreshes the taskbar tasks.
        /// </summary>
        private static void RefreshTaskbarTasks(JumpList jumpList)
        {
            try
            {
                jumpList.ClearAllUserTasks();

                jumpList.KnownCategoryToDisplay = JumpListKnownCategoryType.Neither;

                string applicationFolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
                string nativeResourceDll = Path.Combine(applicationFolder, NativeResourceDllName);

                jumpList.AddUserTasks(
                    new JumpListLink(Assembly.GetEntryAssembly().Location, "Create New Task")
                    {
                        Arguments = "/newtask",
                        IconReference = new IconReference(nativeResourceDll, NewTaskResourceId)
                    });

                jumpList.AddUserTasks(new JumpListSeparator());

                foreach (BaseFolder f in App.Root.TaskData.AllFolders)
                {
                    jumpList.AddUserTasks(
                        new JumpListLink(Assembly.GetEntryAssembly().Location, "Goto " + f.Name)
                        {
                            Arguments = "/goto " + "\"" + f.Name + "\"",
                            IconReference = new IconReference(nativeResourceDll, GotoResourceId)
                        });
                }

                jumpList.Refresh();
            }
            catch (COMException)
            {
                // catch rare COM exceptions
            }
        }
Ejemplo n.º 5
0
        void TaskbarDemoMainForm_Shown(object sender, EventArgs e)
        {
            // create a new taskbar jump list for the main window
            jumpList = JumpList.CreateJumpList();

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

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

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

            //
            comboBoxProgressBarStates.SelectedItem = "NoProgress";

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

            // Set our default
            TaskbarManager.Instance.SetProgressState(TaskbarProgressBarState.NoProgress);
        }
Ejemplo n.º 6
0
        private void button1_Click(object sender, EventArgs e)
        {
            childWindowJumpList = JumpList.CreateJumpListForIndividualWindow(childWindowAppId, this.Handle);

            ((Button)sender).Enabled = false;
            groupBoxCustomCategories.Enabled = true;
            buttonRefreshTaskbarList.Enabled = true;
        }
Ejemplo n.º 7
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            _jumpList = JumpList.CreateJumpList();
            _jumpList.KnownCategoryToDisplay = JumpListKnownCategoryType.Neither;
            _jumpList.AddCustomCategories(_recentCategory);

            List<HistoryWindow.HistoricalConnection> historicalConnections = _history.Connections.OrderBy((HistoryWindow.HistoricalConnection c) => c.LastConnection).ToList();
            historicalConnections = historicalConnections.GetRange(0, Math.Min(historicalConnections.Count, Convert.ToInt32(_jumpList.MaxSlotsInList)));

            foreach (HistoryWindow.HistoricalConnection historicalConnection in historicalConnections)
            {
                _recentCategory.AddJumpListItems(new JumpListLink(Application.ExecutablePath, (!String.IsNullOrEmpty(historicalConnection.Name) ? historicalConnection.Name : historicalConnection.Host)) { Arguments = "/openHistory:" + historicalConnection.Guid.ToString(), IconReference = new IconReference(Application.ExecutablePath, 0) });
                _recentConnections.Enqueue(historicalConnection);
            }

            _jumpList.Refresh();

            if (OpenToHistory != Guid.Empty)
                Connect(_history.FindInHistory(OpenToHistory));
        }
Ejemplo n.º 8
0
        private void EditorLoad(object sender, EventArgs e)
        {
            SettingsManager.Read();

            if (TaskbarManager.IsPlatformSupported)
            {
                TaskbarManager.Instance.ApplicationId = Elevation.ProgramId;
                _jumpList = JumpList.CreateJumpList();
                _jumpList.KnownCategoryToDisplay = JumpListKnownCategoryType.Recent;
                _jumpList.Refresh();
            }

            UpdateDocumentTabs();
            UpdateRecentFiles();

            MenuManager.Init(mnuMain, tscToolStrip);
            MenuManager.Rebuild();

            ViewportManager.Init(tblQuadView);
            ToolManager.Init();
            BrushManager.Init();
            BrushManager.SetBrushControl(BrushCreatePanel);

            foreach (var tool in ToolManager.Tools)
            {
                var tl = tool;
                var hotkey = Sledge.Settings.Hotkeys.GetHotkeyForMessage(HotkeysMediator.SwitchTool, tool.GetHotkeyToolType());
                tspTools.Items.Add(new ToolStripButton(
                    "",
                    tl.GetIcon(),
                    (s, ea) => SelectTool(tl),
                    tl.GetName())
                        {
                            Checked = (tl == ToolManager.ActiveTool),
                            ToolTipText = tl.GetName() + (hotkey != null ? " (" +hotkey.DefaultHotkey + ")" : ""),
                            DisplayStyle = ToolStripItemDisplayStyle.Image,
                            ImageScaling = ToolStripItemImageScaling.None,
                            AutoSize = false,
                            Width = 36,
                            Height = 36
                        }
                    );
            }

            MapProvider.Register(new RmfProvider());
            MapProvider.Register(new MapFormatProvider());
            MapProvider.Register(new VmfProvider());
            GameDataProvider.Register(new FgdProvider());
            TextureProvider.Register(new WadProvider());
            TextureProvider.Register(new SprProvider());

            WadProvider.ReplaceTransparentPixels = !Sledge.Settings.View.DisableWadTransparency && !Sledge.Settings.View.GloballyDisableTransparency;
            TextureHelper.EnableTransparency = !Sledge.Settings.View.GloballyDisableTransparency;

            // Sprites are loaded on startup and always retained
            var spritesFolder = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Sprites");
            var collection = TextureProvider.CreateCollection(new[] { spritesFolder });
            collection.LoadTextureItems(collection.GetAllItems());

            Subscribe();

            Mediator.MediatorException += (msg, ex) => Logging.Logger.ShowException(ex, "Mediator Error: " + msg);

            if (Sledge.Settings.View.LoadSession)
            {
                foreach (var session in SettingsManager.LoadSession())
                {
                    LoadFileGame(session.Item1, session.Item2);
                }
            }

            var mdl = new MdlProvider();
            //mdl.LoadMDL(new NativeFile(@"D:\Github\sledge\_Resources\MDL\HL1_10\barney.mdl"), ModelLoadItems.All);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Handler method that's called when the form is shown.  Creates and initializes the jump list if necessary and, if they are specified, opens the
        /// bookmarks specified by <see cref="OpenToBookmarks"/> or the history entries pointed to by <see cref="OpenToHistory"/>.
        /// </summary>
        /// <param name="e">Arguments associated with this event.</param>
        protected override void OnShown(EventArgs e)
        {
            base.OnShown(e);

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

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

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

                _jumpList.Refresh();

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

            if (OpenToHistory == Guid.Empty && OpenToBookmarks != null)
                ConnectToBookmarks(OpenToBookmarks);
        }
Ejemplo n.º 10
0
        private void Main_Load(object sender, EventArgs e)
        {
            AllowTaskbarWindowMessagesThroughUIPI();

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

            BuildJumpList();
        }
Ejemplo n.º 11
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);
        }
Ejemplo n.º 12
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);
        }
Ejemplo n.º 13
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?
        }
Ejemplo n.º 14
0
        private void EditorLoad(object sender, EventArgs e)
        {
            FileTypeRegistration.RegisterFileTypes();

            SettingsManager.Read();

            if (TaskbarManager.IsPlatformSupported)
            {
                TaskbarManager.Instance.ApplicationId = FileTypeRegistration.ProgramId;

                _jumpList = JumpList.CreateJumpList();
                _jumpList.KnownCategoryToDisplay = JumpListKnownCategoryType.Recent;
                _jumpList.Refresh();
            }

            UpdateDocumentTabs();
            UpdateRecentFiles();

            DockBottom.Hidden = DockLeft.Hidden = DockRight.Hidden = true;

            MenuManager.Init(mnuMain, tscToolStrip);
            MenuManager.Rebuild();

            SidebarManager.Init(RightSidebar);

            ViewportManager.Init(TableSplitView);
            ToolManager.Init();

            foreach (var tool in ToolManager.Tools)
            {
                var tl = tool;
                var hotkey = Sledge.Settings.Hotkeys.GetHotkeyForMessage(HotkeysMediator.SwitchTool, tool.GetHotkeyToolType());
                tspTools.Items.Add(new ToolStripButton(
                    "",
                    tl.GetIcon(),
                    (s, ea) => Mediator.Publish(HotkeysMediator.SwitchTool, tl.GetHotkeyToolType()),
                    tl.GetName())
                        {
                            Checked = (tl == ToolManager.ActiveTool),
                            ToolTipText = tl.GetName() + (hotkey != null ? " (" +hotkey.Hotkey + ")" : ""),
                            DisplayStyle = ToolStripItemDisplayStyle.Image,
                            ImageScaling = ToolStripItemImageScaling.None,
                            AutoSize = false,
                            Width = 36,
                            Height = 36
                        }
                    );
            }

            TextureProvider.SetCachePath(SettingsManager.GetTextureCachePath());
            MapProvider.Register(new RmfProvider());
            MapProvider.Register(new MapFormatProvider());
            MapProvider.Register(new VmfProvider());
            MapProvider.Register(new ObjProvider());
            GameDataProvider.Register(new FgdProvider());
            TextureProvider.Register(new WadProvider());
            TextureProvider.Register(new SprProvider());
            ModelProvider.Register(new MdlProvider());

            WadProvider.ReplaceTransparentPixels = !Sledge.Settings.View.DisableWadTransparency && !Sledge.Settings.View.GloballyDisableTransparency;
            TextureHelper.EnableTransparency = !Sledge.Settings.View.GloballyDisableTransparency;
            TextureHelper.DisableTextureFiltering = Sledge.Settings.View.DisableTextureFiltering;
            TextureHelper.ForceNonPowerOfTwoResize = Sledge.Settings.View.ForcePowerOfTwoTextureResizing;

            Subscribe();

            Mediator.MediatorException += (mthd, ex) => Logging.Logger.ShowException(ex.Exception, "Mediator Error: " + ex.Message);

            if (Sledge.Settings.View.LoadSession)
            {
                foreach (var session in SettingsManager.LoadSession())
                {
                    LoadFileGame(session.Item1, session.Item2);
                }
            }

            ProcessArguments(System.Environment.GetCommandLineArgs());
        }
Ejemplo 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);
            }
        }