Example #1
0
        private void CreateJumpList()
        {
            this._jumpList = new JumpList();

            JumpList.SetJumpList(Current, this._jumpList);
            JumpTask helloTask = new JumpTask
                                 {
                                     Title = "Say Hello",
                                     Description = "Shows a Hello World message.",
                                     ApplicationPath = Assembly.GetEntryAssembly().Location,
                                     Arguments = "/hello",
                                 };
            this._jumpList.JumpItems.Add(helloTask);

            JumpTask goodbyeTask = new JumpTask
                                   {
                                       Title = "Say Goodbye",
                                       Description = "Shows a goodbye message.",
                                       ApplicationPath = Assembly.GetEntryAssembly().Location,
                                       Arguments = "/goodbye"
                                   };

            this._jumpList.JumpItems.Add(goodbyeTask);

            this._jumpList.Apply();
        }
Example #2
0
        private void CreateJumpList()
        {
            if (!TaskbarManager.IsPlatformSupported)
            {
                return;
            }

            var applicationPath = Assembly.GetEntryAssembly().Location;

            var jumpList = new JumpList();

            JumpList.SetJumpList(Application.Current, jumpList);

            var openDatabaseTask = new JumpTask
            {
                Title           = "Open database",
                Description     = "Open LiteDB v4 database file",
                ApplicationPath = applicationPath,
                Arguments       = "open"
            };

            jumpList.JumpItems.Add(openDatabaseTask);

            var newDatabaseTask = new JumpTask
            {
                Title           = "New database",
                Description     = "Create and open new LiteDB v4 database",
                ApplicationPath = applicationPath,
                Arguments       = "new"
            };

            jumpList.JumpItems.Add(newDatabaseTask);

            jumpList.Apply();
        }
Example #3
0
        public static void CreateJumpList()
        {
            JumpTask update = new JumpTask()
            {
                Title = "Check for Updates",
                Arguments = "/update",
                Description = "Cheks for Software Updates",
                CustomCategory = "Actions",
                IconResourcePath = Assembly.GetEntryAssembly().CodeBase,
                ApplicationPath = Assembly.GetEntryAssembly().CodeBase
            };
            JumpTask restart = new JumpTask()
            {
                Title = "Restart on default monitor",
                Arguments = "/firstmonitor",
                Description = "Restarts the application on the first monitor",
                CustomCategory = "Actions",
                IconResourcePath = Assembly.GetEntryAssembly().CodeBase,
                ApplicationPath = Assembly.GetEntryAssembly().CodeBase
            };

            var appmenu = new JumpList();
            appmenu.JumpItems.Add(update);
            appmenu.JumpItems.Add(restart);
            appmenu.ShowFrequentCategory = false;
            appmenu.ShowRecentCategory = false;

            JumpList.SetJumpList(Application.Current, appmenu);
        }
        public Main()
        {
            InitializeComponent();

            _iconWindow = ResourceHelper.GetIcon("gmail-classic.ico");

            // since we're using the native jumplist stuff, we really shouldn't need this. we'll see.
            //_taskbarManager.ApplicationId = String.Concat("Gmail-Notifier-Plus-", Shellscape.Utilities.AssemblyMeta.Guid, "-", Shellscape.Utilities.AssemblyMeta.Version);

            _jumpList = new JumpList(); //JumpList.GetJumpList(System.Windows.Application.Current);
            _jumpList.ShowFrequentCategory = false;
            _jumpList.ShowRecentCategory = false;

            var app = new System.Windows.Application();

            JumpList.SetJumpList(app, _jumpList);
            TaskbarItemInfo info = new TaskbarItemInfo();

            info.ProgressState = TaskbarItemProgressState.Indeterminate;
            info.ProgressValue = 20;

            this.Icon = _iconWindow;
            this.Location = new Point(-10000, -10000);
            this.Text = this._TrayIcon.Text = GmailNotifierPlus.Resources.WindowTitle;

            this.CreateInstances();

            _config.Saved += _Config_Saved;
            _config.Accounts.AccountChanged += _Account_Changed;

            _Timer.Tick += _Timer_Tick;
            _Timer.Interval = Math.Max(1, _config.Interval) * 1000;
            _Timer.Enabled = true;
        }
        private static List <JumpList._ShellObjectPair> GenerateJumpItems(IObjectArray shellObjects)
        {
            List <JumpList._ShellObjectPair> list = new List <JumpList._ShellObjectPair>();
            Guid guid  = new Guid("00000000-0000-0000-C000-000000000046");
            uint count = shellObjects.GetCount();

            for (uint num = 0U; num < count; num += 1U)
            {
                object   at       = shellObjects.GetAt(num, ref guid);
                JumpItem jumpItem = null;
                try
                {
                    jumpItem = JumpList.GetJumpItemForShellObject(at);
                }
                catch (Exception ex)
                {
                    if (ex is NullReferenceException || ex is SEHException)
                    {
                        throw;
                    }
                }
                list.Add(new JumpList._ShellObjectPair
                {
                    ShellObject = at,
                    JumpItem    = jumpItem
                });
            }
            return(list);
        }
 private void MainWindow_OnLoaded(object sender, RoutedEventArgs e)
 {
     if (JumpList.GetJumpList(Application.Current) != null)
     {
         CurrentJumpList = JumpList.GetJumpList(Application.Current);
     }
 }
Example #7
0
        private void CreateJumpList()
        {
            JumpList jumpList = new JumpList();
            //jumpList.ShowRecentCategory = true;
            JumpList.SetJumpList(Application.Current, jumpList);

            string[] projects = Gibbo.Editor.WPF.Properties.Settings.Default.LastLoadedProjects.Split('|');

            int c = 0;

            foreach (string path in projects)
            {
                if (path.Trim() != string.Empty && File.Exists(path))
                {
                    JumpTask task = new JumpTask();
                    task.CustomCategory = "Recent";

                    task.Title = System.IO.Path.GetFileNameWithoutExtension(path);
                    task.Description = task.Title + " (" + path.Split('.')[0] + ")";
                    task.ApplicationPath = path;

                    jumpList.JumpItems.Add(task);
                    //JumpList.AddToRecentCategory(task);
                    c++;
                    if (c == 8)
                        break;
                }
            }

            jumpList.Apply();
        }
        public override void Init()
        {
            Type type = typeof(JumpListSetting);

            if (this.Dictionary.ContainsKey(type.Name))
            {
                try
                {
                    string val = this.Dictionary[type.Name];

                    var Jumplist = XmlUtil.Deserialize(type, val) as JumpListSetting;

                    this.SetData(this, Jumplist);
                }
                catch
                {
                    this.Dictionary.Remove(type.Name);
                }
            }
            this.Jumplist = JumpList.GetJumpList(Application.Current);

            if (this.Jumplist == null) this.Jumplist = new JumpList();

            this.Jumplist.ShowFrequentCategory = false;
            this.Jumplist.ShowRecentCategory = false;
            this.Jumplist.JumpItems.Clear();
            this.Jumplist.JumpItems.AddRange(this.JumpItemList);

            JumpList.SetJumpList(Application.Current, this.Jumplist);
        }
Example #9
0
        public void Start()
        {
            if (TaskbarManager.IsPlatformSupported)
            {
                _eventAggregator.GetEvent <ApplicationArgumentsEvent>().Subscribe(OnArgumentsReceived, ThreadOption.UIThread, true);
                _jumpList = new JumpList();
                _tileService.Tiles.ForEach(AddJumpTask);
                _tileService.TileAdded += (sender, args) => AddJumpTask(args.Tile);
                JumpList.SetJumpList(Application.Current, _jumpList);

                _radio.CurrentTrackChanged += RadioOnCurrentTrackChanged;
                _player.IsPlayingChanged   += PlayerOnIsPlayingChanged;

                if (Application.Current.MainWindow.IsLoaded)
                {
                    InitializeTaskBarButtons();
                }
                else
                {
                    Application.Current.MainWindow.Loaded += delegate
                    {
                        InitializeTaskBarButtons();
                    };
                }
            }
        }
Example #10
0
		static JumpLists()
		{
			_app = new Application();
			var jmp = new JumpList();
			jmp.ShowRecentCategory = true;
			JumpList.SetJumpList(_app, jmp);
		}
Example #11
0
        public vJumpList()
        {
            mList = new JumpList();
            JumpList.SetJumpList(Application.Current, mList);

            CategoryName = "Category";
            AppPath = "";
        }
Example #12
0
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
 {
     switch (connectionId)
     {
     case 1:
         this.jump_list = ((System.Windows.Shell.JumpList)(target));
         return;
     }
     this._contentLoaded = true;
 }
Example #13
0
		public static void UpdateJumplists()
		{
			var iconLibraryPath = ExtractIconLibrary();

			var jump = new JumpList();
			JumpList.SetJumpList(Application.Current, jump);

			if (App.AssemblyStorage.AssemblySettings.ApplicationRecents != null)
			{
				for (int i = 0; i < 10; i++)
				{
					if (i > App.AssemblyStorage.AssemblySettings.ApplicationRecents.Count - 1)
						break;

					var task = new JumpTask();
					int iconIndex = -200;
					switch (App.AssemblyStorage.AssemblySettings.ApplicationRecents[i].FileType)
					{
						case Settings.RecentFileType.Blf:
							iconIndex = -200;
							break;
						case Settings.RecentFileType.Cache:
							iconIndex = -201;
							break;
						case Settings.RecentFileType.MapInfo:
							iconIndex = -202;
							break;
					}

					task.ApplicationPath = VariousFunctions.GetApplicationAssemblyLocation();
					task.Arguments = string.Format("assembly://open \"{0}\"",
						App.AssemblyStorage.AssemblySettings.ApplicationRecents[i].FilePath);
					task.WorkingDirectory = VariousFunctions.GetApplicationLocation();

					task.IconResourcePath = iconLibraryPath;
					task.IconResourceIndex = iconIndex;

					task.CustomCategory = "Recent";
					task.Title = App.AssemblyStorage.AssemblySettings.ApplicationRecents[i].FileName + " - " +
					             App.AssemblyStorage.AssemblySettings.ApplicationRecents[i].FileGame;
					task.Description = string.Format("Open {0} in Assembly. ({1})",
						App.AssemblyStorage.AssemblySettings.ApplicationRecents[i].FileName,
						App.AssemblyStorage.AssemblySettings.ApplicationRecents[i].FilePath);

					jump.JumpItems.Add(task);
				}
			}

			// Show Recent and Frequent categories :D
			jump.ShowFrequentCategory = false;
			jump.ShowRecentCategory = false;

			// Send to the Windows Shell
			jump.Apply();
		}
Example #14
0
        public static void CreateJumpList()
        {
            var jumpList = new JumpList();

            JumpList.SetJumpList(Application.Current, jumpList);

            var restartTask = new JumpTask
            {
                Title             = Resources.MainWindow_CreateJumpList_Start_New_Session,
                Description       = Resources.MainWindow_CreateJumpList_Starts_a_new_Pomodoro_session_,
                ApplicationPath   = Assembly.GetEntryAssembly().Location,
                Arguments         = "/restart",
                IconResourcePath  = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location) + "/Pomodoro.Icons.dll",
                IconResourceIndex = 0
            };

            jumpList.JumpItems.Add(restartTask);

            /*
             * var startTask = new JumpTask
             *                  {
             *                      Title = Resources.MainWindow_CreateJumpList_Start_Timer,
             *                      Description = Resources.MainWindow_CreateJumpList_Starts_the_timer_if_it_is_stopped_,
             *                      ApplicationPath = Assembly.GetEntryAssembly().Location,
             *                      Arguments = "/start",
             *                      IconResourcePath = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location) + "/Pomodoro.Icons.dll",
             *                      IconResourceIndex = 0
             *                  };
             * jumpList.JumpItems.Add(startTask);
             * var stopTask = new JumpTask
             *                 {
             *                     Title = Resources.MainWindow_CreateJumpList_Stop_Timer,
             *                     Description = Resources.MainWindow_CreateJumpList_Stops_the_timer_if_it_is_started_,
             *                     ApplicationPath = Assembly.GetEntryAssembly().Location,
             *                     Arguments = "/stop",
             *                     IconResourcePath = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location) + "/Pomodoro.Icons.dll",
             *                     IconResourceIndex = 0
             *                 };
             * jumpList.JumpItems.Add(stopTask);
             * var stopRingingTask = new JumpTask
             *                        {
             *                            Title = Resources.MainWindow_CreateJumpList_Stop_Ringing,
             *                            Description = Resources.MainWindow_CreateJumpList_Mutes_a_ringing_timer_and_prepares_for_a_new_session,
             *                            ApplicationPath = Assembly.GetEntryAssembly().Location,
             *                            Arguments = "/stopringing",
             *                            IconResourcePath = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location) + "/Pomodoro.Icons.dll",
             *                            IconResourceIndex = 0
             *                        };
             * jumpList.JumpItems.Add(stopRingingTask);
             */

            jumpList.Apply();
        }
        private static object GetShellObjectForJumpItem(JumpItem jumpItem)
        {
            JumpPath jumpPath = jumpItem as JumpPath;
            JumpTask jumpTask = jumpItem as JumpTask;

            if (jumpPath != null)
            {
                return(JumpList.CreateItemFromJumpPath(jumpPath));
            }
            if (jumpTask != null)
            {
                return(JumpList.CreateLinkFromJumpTask(jumpTask, true));
            }
            return(null);
        }
Example #16
0
        private static void InitialiseJumpList()
        {
            var entryAssembly = Assembly.GetEntryAssembly();
            var applicationPath = entryAssembly.Location;
            var jumpList = new JumpList();

            // "I am... Working"
            var workModeSwitchTask = new JumpTask();
            workModeSwitchTask.Title = "Working";
            workModeSwitchTask.Description = "Switch to 'Work' mode";
            workModeSwitchTask.IconResourceIndex = -1;
            workModeSwitchTask.CustomCategory = "I am...";
            workModeSwitchTask.ApplicationPath = applicationPath;
            workModeSwitchTask.Arguments = CommandLineCodes.IAmWorking;
            jumpList.JumpItems.Add(workModeSwitchTask);

            // "I am... Resting"
            var restModeSwitchTask = new JumpTask();
            restModeSwitchTask.Title = "Resting";
            restModeSwitchTask.Description = "Switch to 'Rest' mode";
            restModeSwitchTask.IconResourceIndex = -1;
            restModeSwitchTask.CustomCategory = "I am...";
            restModeSwitchTask.ApplicationPath = applicationPath;
            restModeSwitchTask.Arguments = CommandLineCodes.IAmResting;
            jumpList.JumpItems.Add(restModeSwitchTask);

            // "I am... Playing"
            var playModeSwitchTask = new JumpTask();
            playModeSwitchTask.Title = "Playing";
            playModeSwitchTask.Description = "Switch to 'Play' mode";
            playModeSwitchTask.IconResourceIndex = -1;
            playModeSwitchTask.CustomCategory = "I am...";
            playModeSwitchTask.ApplicationPath = applicationPath;
            playModeSwitchTask.Arguments = CommandLineCodes.IAmPlaying;
            jumpList.JumpItems.Add(playModeSwitchTask);

            // "Exit"
            var exitTask = new JumpTask();
            exitTask.Title = "Exit";
            exitTask.Description = "Exit Lazybones";
            exitTask.IconResourceIndex = -1;
            exitTask.ApplicationPath = applicationPath;
            exitTask.Arguments = "/q";
            jumpList.JumpItems.Add(exitTask);

            jumpList.Apply();
            JumpList.SetJumpList(Application.Current, jumpList);
        }
Example #17
0
        public MainViewModel()
        {
            // Инициализируем список и коллекцию 
            _jumpList = new JumpList();
            JumpList.SetJumpList(Application.Current, _jumpList);

            _tasks = new ObservableCollection<TaskViewModel>();

            // Загружаем из файла задачи
            Load();

            // Обновляем список переходов
            Apply();

            // Команда обновления списка переходов
            ApplyCommand = new RelayCommand(Apply);
        }
Example #18
0
        /// <summary>
        /// Overrides the onStartup event handler
        /// </summary>
        /// <param name="e"></param>
        protected override void OnStartup(StartupEventArgs e)
        {
            JumpTask task = new JumpTask /// create a jumptask in windows 7 taskbar
            {
                Title = "Ma Bibliothéque",
                Description = "Voir les xassida enregistrés sur ma machine",
                CustomCategory = "Actions",
                IconResourcePath = Assembly.GetEntryAssembly().CodeBase,
                ApplicationPath = Assembly.GetEntryAssembly().CodeBase
            };

            JumpList jumpList = new JumpList();
            jumpList.JumpItems.Add(task);
            jumpList.ShowFrequentCategory = false;
            jumpList.ShowRecentCategory = false;

            JumpList.SetJumpList(Application.Current, jumpList);
            base.OnStartup(e);
        }
 public static void AddToRecentCategory(JumpTask jumpTask)
 {
     Verify.IsNotNull <JumpTask>(jumpTask, "jumpTask");
     if (Utilities.IsOSWindows7OrNewer)
     {
         IShellLinkW shellLinkW = JumpList.CreateLinkFromJumpTask(jumpTask, false);
         try
         {
             if (shellLinkW != null)
             {
                 NativeMethods2.SHAddToRecentDocs(shellLinkW);
             }
         }
         finally
         {
             Utilities.SafeRelease <IShellLinkW>(ref shellLinkW);
         }
     }
 }
Example #20
0
        protected override void OnStartup(StartupEventArgs e)
        {
            var task = new JumpTask
            {
                Title = "Configure",
                Arguments = "-configure",
                Description = "Open program settings",
                CustomCategory = "Actions",
                IconResourcePath = Assembly.GetEntryAssembly().CodeBase,
                ApplicationPath = Assembly.GetEntryAssembly().CodeBase
            };

            var jumpList = new JumpList();
            jumpList.JumpItems.Add(task);
            jumpList.ShowFrequentCategory = false;
            jumpList.ShowRecentCategory = false;

            JumpList.SetJumpList(Application.Current, jumpList);
        }
Example #21
0
		public Main() {

			InitializeComponent();

			_jumpList = new JumpList();
			_jumpList.ShowFrequentCategory = false;
			_jumpList.ShowRecentCategory = false;

			var app = new System.Windows.Application();

			JumpList.SetJumpList(app, _jumpList);

			this.Icon = Resources.Icons.Window;
			this.StartPosition = FormStartPosition.Manual;
			this.Location = new Point(-10000, -10000);
			this.Text = this._TrayIcon.Text = GmailNotifierPlus.Resources.Strings.WindowTitle;

			this.CreateInstances();

			_config.Saved += _Config_Saved;

			_config.LanguageChanged += delegate(Config sender) {
				InitJumpList();
			};

			_config.Accounts.AccountChanged += _Account_Changed;

			_Timer.Tick += _Timer_Tick;
			_Timer.Interval = Math.Max(1, _config.Interval) * 1000;
			_Timer.Enabled = true;

			_TrayIcon.ContextMenuStrip = new ContextMenuStrip();
			_TrayIcon.MouseClick += delegate(object sender, MouseEventArgs e) {
				if(e.Button == MouseButtons.Left) {
					MethodInfo mi = typeof(NotifyIcon).GetMethod("ShowContextMenu", BindingFlags.Instance | BindingFlags.NonPublic);
					mi.Invoke(_TrayIcon, null);
				}
			};

			Shellscape.UpdateManager.Current.UpdateAvailable += _Updates_UpdatesAvailable;
			Shellscape.UpdateManager.Current.Start();

		}
        private static bool ListContainsShellObject(List <JumpList._ShellObjectPair> removedList, object shellObject)
        {
            if (removedList.Count == 0)
            {
                return(false);
            }
            IShellItem shellItem = shellObject as IShellItem;

            if (shellItem != null)
            {
                foreach (JumpList._ShellObjectPair shellObjectPair in removedList)
                {
                    IShellItem shellItem2 = shellObjectPair.ShellObject as IShellItem;
                    if (shellItem2 != null && shellItem.Compare(shellItem2, SICHINT.CANONICAL | SICHINT.TEST_FILESYSPATH_IF_NOT_EQUAL) == 0)
                    {
                        return(true);
                    }
                }
                return(false);
            }
            IShellLinkW shellLinkW = shellObject as IShellLinkW;

            if (shellLinkW != null)
            {
                foreach (JumpList._ShellObjectPair shellObjectPair2 in removedList)
                {
                    IShellLinkW shellLinkW2 = shellObjectPair2.ShellObject as IShellLinkW;
                    if (shellLinkW2 != null)
                    {
                        string a = JumpList.ShellLinkToString(shellLinkW2);
                        string b = JumpList.ShellLinkToString(shellLinkW);
                        if (a == b)
                        {
                            return(true);
                        }
                    }
                }
                return(false);
            }
            return(false);
        }
Example #23
0
    public Startup()
    {
      var jumpList = new JumpList();
      JumpList.SetJumpList(Current, jumpList);
      
      // todo: configure jump list

      //JumpTask t;

      //jumpList.JumpItems.Add(new JumpTask()
      //  {
      //    Title = "netCDS Wing",
      //    CustomCategory = "Recent Rooms"
      //  });
      //jumpList.JumpItems.Add(new JumpTask()
      //{
      //  Title = "netCDS Wing",
      //  CustomCategory = "Recent Rooms"
      //});

      jumpList.Apply();
    }
Example #24
0
        private static void setupJumpList()
        {
            #region Jumplist stuff
            // Jumplist setup
            JumpList masgau_jump_list = JumpList.GetJumpList(Application.Current);
            if (masgau_jump_list == null) {
                masgau_jump_list = new JumpList();
                JumpList.SetJumpList(Application.Current, masgau_jump_list);
            } else {
                masgau_jump_list.JumpItems.Clear();
                masgau_jump_list.ShowFrequentCategory = false;
                masgau_jump_list.ShowRecentCategory = false;

            }

            JumpTask masgau_jump = new JumpTask();
            masgau_jump.ApplicationPath = Core.ExecutableName;
            masgau_jump.IconResourcePath = Core.ExecutableName;
            masgau_jump.IconResourceIndex = 0;
            masgau_jump.WorkingDirectory = Core.ExecutablePath;
            masgau_jump.Title = Strings.GetLabelString("JumpMainProgram");
            masgau_jump.Description = Strings.GetToolTipString("JumpMainProgram");
            masgau_jump.CustomCategory = "MASGAU";
            masgau_jump_list.JumpItems.Add(masgau_jump);

            masgau_jump = new JumpTask();
            masgau_jump.ApplicationPath = Core.ExecutableName;
            masgau_jump.IconResourcePath = Core.ExecutableName;
            masgau_jump.IconResourceIndex = 0;
            masgau_jump.WorkingDirectory = Core.ExecutablePath;
            masgau_jump.Title = Strings.GetLabelString("JumpMainProgramAllUsers");
            masgau_jump.Description = Strings.GetToolTipString("JumpMainProgramAllUsers");
            masgau_jump.Arguments = "-allusers";
            masgau_jump.CustomCategory = "MASGAU";
            masgau_jump_list.JumpItems.Add(masgau_jump);

            masgau_jump_list.Apply();
            #endregion
        }
Example #25
0
        public void AddJumpTask(NetworkConfiguration nc)
        {
            JumpTask jumpTask1 = new JumpTask();

            string appPath = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;

            jumpTask1.ApplicationPath = appPath;
            jumpTask1.IconResourcePath = appPath;
            jumpTask1.Arguments = "/activate " + nc.Id.ToString();
            jumpTask1.Title = nc.Name;
            jumpTask1.Description = string.Empty;
            jumpTask1.CustomCategory = LanguageResources.Networks_Label;

            JumpList jumpList = JumpList.GetJumpList(this.currentApp);
            if (jumpList == null)
            {
                jumpList = new JumpList();
                JumpList.SetJumpList(this.currentApp, jumpList);
            }

            jumpList.JumpItems.Add(jumpTask1);
        }
Example #26
0
        public Main()
        {
            InitializeComponent();

            _jumpList = new JumpList();
            _jumpList.ShowFrequentCategory = false;
            _jumpList.ShowRecentCategory = false;

            var app = new System.Windows.Application();

            JumpList.SetJumpList(app, _jumpList);
            TaskbarItemInfo info = new TaskbarItemInfo();

            info.ProgressState = TaskbarItemProgressState.Indeterminate;
            info.ProgressValue = 20;

            this.Icon = Resources.Icons.Window;
            this.StartPosition = FormStartPosition.Manual;
            this.Location = new Point(-10000, -10000);
            this.Text = this._TrayIcon.Text = GmailNotifierPlus.Resources.Strings.WindowTitle;

            this.CreateInstances();

            _config.Saved += _Config_Saved;

            _config.LanguageChanged += delegate(Config sender) {
                InitJumpList();
            };

            _config.Accounts.AccountChanged += _Account_Changed;

            _Timer.Tick += _Timer_Tick;
            _Timer.Interval = Math.Max(1, _config.Interval) * 1000;
            _Timer.Enabled = true;

            Shellscape.UpdateManager.Current.UpdateAvailable += _Updates_UpdatesAvailable;
            Shellscape.UpdateManager.Current.Start();
        }
        public static void SetJumpList(Application application, JumpList value)
        {
            Verify.IsNotNull <Application>(application, "application");
            object obj = JumpList.s_lock;

            lock (obj)
            {
                JumpList jumpList;
                if (JumpList.s_applicationMap.TryGetValue(application, out jumpList) && jumpList != null)
                {
                    jumpList._application = null;
                }
                JumpList.s_applicationMap[application] = value;
                if (value != null)
                {
                    value._application = application;
                }
            }
            if (value != null)
            {
                value.ApplyFromApplication();
            }
        }
Example #28
0
 private void Application_Startup(object sender, StartupEventArgs e)
 {
     // Retrieve the current jump list.
     JumpList jumpList = new JumpList();
     JumpList.SetJumpList(Application.Current, jumpList);
                 
     // Add a new JumpPath for a file in the application folder.
     string path = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
     path = Path.Combine(path, "readme.txt");
     if (File.Exists(path))
     {
         JumpTask jumpTask = new JumpTask();
         jumpTask.CustomCategory = "Documentation";
         jumpTask.Title = "Read the readme.txt";
         jumpTask.ApplicationPath = @"c:\windows\notepad.exe";
         jumpTask.IconResourcePath = @"c:\windows\notepad.exe";
         jumpTask.Arguments = path;
         jumpList.JumpItems.Add(jumpTask);
     }
     
     // Update the jump list.
     jumpList.Apply();
 }
Example #29
0
		public RadioApp(Dictionary<string, Station> stations) {
			Stations=stations;
			foreach (var station in Stations.Values) {
				var dyn=station as DynamicStation;
				if (dyn != null) dyn.ChannelsChanged=station_ChannelsChanged;
			}

			RadioIcon=IconLoader.LoadAssemblyIcon(this.GetType().Assembly.Location, 0);
			icons=new Dictionary<string, BitmapSource>(stations.Count);
			ignoredChannels=Settings.Default.IgnoredChannels.Split(new[] { ChannelSeparator }, StringSplitOptions.RemoveEmptyEntries);

			// Aizpilda raidstaciju pārslēgšanas sarakstu.
			jumpList=new JumpList();
			jumpList.JumpItemsRemovedByUser+=jumpList_JumpItemsRemovedByUser;
			FillJumpList();

			// Palaiž raidstaciju pārslēgšanas pakalpojumu.
			switchService=new ServiceHost(typeof(RadioSwitch), new Uri(RadioSwitch.ServiceUrl));
			switchService.AddServiceEndpoint(typeof(IRadioSwitch), new NetNamedPipeBinding(), string.Empty);
			switchService.Open();

			InitializeComponent();
		}
Example #30
0
        protected override void OnStartup(System.Windows.StartupEventArgs e)
        {
            base.OnStartup(e);

            // Retrieve the current jump list.
            JumpList jumpList = new JumpList();
            JumpList.SetJumpList(Application.Current, jumpList);

            // Add a new JumpPath for an application task.            
            JumpTask jumpTask = new JumpTask();
            jumpTask.CustomCategory = "Tasks";
            jumpTask.Title = "Do Something";
            jumpTask.ApplicationPath = Assembly.GetExecutingAssembly().Location;
            jumpTask.IconResourcePath = jumpTask.ApplicationPath;
            jumpTask.Arguments = "@#StartOrder";
            jumpList.JumpItems.Add(jumpTask);         

            // Update the jump list.
            jumpList.Apply();

            // Load the main window.
            Window1 win = new Window1();
            win.Show();
        }               
Example #31
0
 public static void RebuildJumpList()
 {
     JumpList myJumpList = new JumpList();
     foreach (string project in Options.General.RecentProjects)
     {
         JumpTask task = new JumpTask();
         task.ApplicationPath = Application.ExecutablePath;
         task.Arguments = "-open \"" + project + "\"";
         task.Title = project;
         task.CustomCategory = "Recent Projects";
         task.IconResourcePath = Path.Combine(Application.StartupPath, "icon.ico");
         task.WorkingDirectory = Application.StartupPath;
         myJumpList.JumpItems.Add(task);
     }
     System.Windows.Application app = System.Windows.Application.Current ?? new System.Windows.Application();
     JumpList.SetJumpList(app, myJumpList);
 }
 public static void AddToRecentCategory(JumpPath jumpPath)
 {
     Verify.IsNotNull <JumpPath>(jumpPath, "jumpPath");
     JumpList.AddToRecentCategory(jumpPath.Path);
 }
Example #33
0
        private void updateJumpList()
        {
            JumpList myJumpList = JumpList.GetJumpList(Application.Current);

            if (myJumpList == null)
            {
                myJumpList = new JumpList();
                JumpList.SetJumpList(Application.Current, myJumpList);
            }

            myJumpList.JumpItems.Clear();
            if (RecentFileList != null && RecentFileList.RecentFiles != null)
            {
                foreach (string item in RecentFileList.RecentFiles)
                {
                    try
                    {
                        JumpTask myJumpTask = new JumpTask();
                        myJumpTask.CustomCategory = Resources.MainWindowVM_updateJumpList_CustomCategoryName;
                        myJumpTask.Title = Path.GetFileName(item);
                        //myJumpTask.Description = "";
                        myJumpTask.ApplicationPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, System.AppDomain.CurrentDomain.FriendlyName);
                        myJumpTask.Arguments = item;
                        myJumpList.JumpItems.Add(myJumpTask);
                    }
                    catch (Exception)
                    {
                        //throw;
                    }
                }
            }
            myJumpList.Apply();
        }
 protected override IEnumerable<Tuple<JumpItem, JumpItemRejectionReason>> ApplyOverride(JumpList list) {
     AppliedList.ShowFrequentCategory = list.ShowFrequentCategory;
     AppliedList.ShowRecentCategory = list.ShowRecentCategory;
     AppliedList.JumpItems.Clear();
     AppliedList.JumpItems.AddRange(list.JumpItems);
     List<Tuple<JumpItem, JumpItemRejectionReason>> rejection = new List<Tuple<JumpItem, JumpItemRejectionReason>>();
     foreach(JumpItem item in list.JumpItems) {
         string title = (item as JumpPath).Return(p => p.Path, () => ((JumpTask)item).Title) ?? string.Empty;
         title.Split(':')
             .Skip(1).SingleOrDefault()
             .Do(s => rejection.Add(new Tuple<JumpItem, JumpItemRejectionReason>(item, (JumpItemRejectionReason)Enum.Parse(typeof(JumpItemRejectionReason), s))));
     }
     foreach(JumpItem item in rejection.Select(r => r.Item1))
         list.JumpItems.Remove(item);
     return rejection;
 }
Example #35
0
        private static void _UpdateJumpList(List<YouTrackService.IssueSummary> recentPrimaryIssues, List<YouTrackService.IssueSummary> recentSecondaryIssues, bool loggedIn)
        {
            var jumplistSource = (JumpList)(loggedIn ? Application.Current.FindResource("SignedInJumpList") : Application.Current.FindResource("SignedOutJumpList"));
            // Clone, rather than modifying the original;
            var jumplist = new JumpList();
            jumplist.JumpItems.AddRange(jumplistSource.JumpItems);

            if (recentSecondaryIssues != null && recentSecondaryIssues.Count > 0)
            {
                jumplist.JumpItems.AddRange(from issueSummary in recentSecondaryIssues
                    select new JumpTask
                    {
                        CustomCategory = "Recently Updated (Secondary)",
                        Title = issueSummary.Summary,
                        Description = issueSummary.Id,
                        Arguments = "-issue:" + issueSummary.Id,
                    });
            }

            if (recentPrimaryIssues != null && recentPrimaryIssues.Count > 0)
            {
                jumplist.JumpItems.AddRange(from issueSummary in recentPrimaryIssues
                    select new JumpTask
                    {
                        CustomCategory = "Recently Updated (Primary)",
                        Title = issueSummary.Summary,
                        Description = issueSummary.Id,
                        Arguments = "-issue:" + issueSummary.Id,
                    });
            }

            JumpList.SetJumpList(Application.Current, jumplist);
        }
        private void ApplyList()
        {
            Verify.IsApartmentState(ApartmentState.STA);
            if (!Utilities.IsOSWindows7OrNewer)
            {
                this.RejectEverything();
                return;
            }
            List <List <JumpList._ShellObjectPair> > list  = null;
            List <JumpList._ShellObjectPair>         list2 = null;
            ICustomDestinationList customDestinationList   = (ICustomDestinationList)Activator.CreateInstance(Type.GetTypeFromCLSID(new Guid("77f10cf0-3db5-4966-b520-b7c54fd35ed6")));
            List <JumpItem>        list3;
            List <JumpList._RejectedJumpItemPair> list4;

            try
            {
                string runtimeId = JumpList._RuntimeId;
                if (!string.IsNullOrEmpty(runtimeId))
                {
                    customDestinationList.SetAppID(runtimeId);
                }
                Guid         guid = new Guid("92CA9DCD-5622-4bba-A805-5E9F541BD8C9");
                uint         num;
                IObjectArray shellObjects = (IObjectArray)customDestinationList.BeginList(out num, ref guid);
                list2 = JumpList.GenerateJumpItems(shellObjects);
                list3 = new List <JumpItem>(this.JumpItems.Count);
                list4 = new List <JumpList._RejectedJumpItemPair>(this.JumpItems.Count);
                list  = new List <List <JumpList._ShellObjectPair> >
                {
                    new List <JumpList._ShellObjectPair>()
                };
                foreach (JumpItem jumpItem in this.JumpItems)
                {
                    if (jumpItem == null)
                    {
                        list4.Add(new JumpList._RejectedJumpItemPair
                        {
                            JumpItem = jumpItem,
                            Reason   = JumpItemRejectionReason.InvalidItem
                        });
                    }
                    else
                    {
                        object obj = null;
                        try
                        {
                            obj = JumpList.GetShellObjectForJumpItem(jumpItem);
                            if (obj == null)
                            {
                                list4.Add(new JumpList._RejectedJumpItemPair
                                {
                                    Reason   = JumpItemRejectionReason.InvalidItem,
                                    JumpItem = jumpItem
                                });
                            }
                            else if (JumpList.ListContainsShellObject(list2, obj))
                            {
                                list4.Add(new JumpList._RejectedJumpItemPair
                                {
                                    Reason   = JumpItemRejectionReason.RemovedByUser,
                                    JumpItem = jumpItem
                                });
                            }
                            else
                            {
                                JumpList._ShellObjectPair item = new JumpList._ShellObjectPair
                                {
                                    JumpItem    = jumpItem,
                                    ShellObject = obj
                                };
                                if (string.IsNullOrEmpty(jumpItem.CustomCategory))
                                {
                                    list[0].Add(item);
                                }
                                else
                                {
                                    bool flag = false;
                                    foreach (List <JumpList._ShellObjectPair> list5 in list)
                                    {
                                        if (list5.Count > 0 && list5[0].JumpItem.CustomCategory == jumpItem.CustomCategory)
                                        {
                                            list5.Add(item);
                                            flag = true;
                                            break;
                                        }
                                    }
                                    if (!flag)
                                    {
                                        list.Add(new List <JumpList._ShellObjectPair>
                                        {
                                            item
                                        });
                                    }
                                }
                                obj = null;
                            }
                        }
                        finally
                        {
                            Utilities.SafeRelease <object>(ref obj);
                        }
                    }
                }
                list.Reverse();
                if (this.ShowFrequentCategory)
                {
                    customDestinationList.AppendKnownCategory(KDC.FREQUENT);
                }
                if (this.ShowRecentCategory)
                {
                    customDestinationList.AppendKnownCategory(KDC.RECENT);
                }
                foreach (List <JumpList._ShellObjectPair> list6 in list)
                {
                    if (list6.Count > 0)
                    {
                        string customCategory = list6[0].JumpItem.CustomCategory;
                        JumpList.AddCategory(customDestinationList, customCategory, list6, list3, list4);
                    }
                }
                customDestinationList.CommitList();
            }
            catch
            {
                if (TraceShell.IsEnabled)
                {
                    TraceShell.Trace(TraceEventType.Error, TraceShell.RejectingJumpItemsBecauseCatastrophicFailure);
                }
                this.RejectEverything();
                return;
            }
            finally
            {
                Utilities.SafeRelease <ICustomDestinationList>(ref customDestinationList);
                if (list != null)
                {
                    foreach (List <JumpList._ShellObjectPair> list7 in list)
                    {
                        JumpList._ShellObjectPair.ReleaseShellObjects(list7);
                    }
                }
                JumpList._ShellObjectPair.ReleaseShellObjects(list2);
            }
            list3.Reverse();
            this._jumpItems = list3;
            EventHandler <JumpItemsRejectedEventArgs> jumpItemsRejected      = this.JumpItemsRejected;
            EventHandler <JumpItemsRemovedEventArgs>  jumpItemsRemovedByUser = this.JumpItemsRemovedByUser;

            if (list4.Count > 0 && jumpItemsRejected != null)
            {
                List <JumpItem> list8 = new List <JumpItem>(list4.Count);
                List <JumpItemRejectionReason> list9 = new List <JumpItemRejectionReason>(list4.Count);
                foreach (JumpList._RejectedJumpItemPair rejectedJumpItemPair in list4)
                {
                    list8.Add(rejectedJumpItemPair.JumpItem);
                    list9.Add(rejectedJumpItemPair.Reason);
                }
                jumpItemsRejected(this, new JumpItemsRejectedEventArgs(list8, list9));
            }
            if (list2.Count > 0 && jumpItemsRemovedByUser != null)
            {
                List <JumpItem> list10 = new List <JumpItem>(list2.Count);
                foreach (JumpList._ShellObjectPair shellObjectPair in list2)
                {
                    if (shellObjectPair.JumpItem != null)
                    {
                        list10.Add(shellObjectPair.JumpItem);
                    }
                }
                if (list10.Count > 0)
                {
                    jumpItemsRemovedByUser(this, new JumpItemsRemovedEventArgs(list10));
                }
            }
        }
 public static void SetJumpList(System.Windows.Application application, JumpList value)
 {
 }
        private static void AddCategory(ICustomDestinationList cdl, string category, List <JumpList._ShellObjectPair> jumpItems, List <JumpItem> successList, List <JumpList._RejectedJumpItemPair> rejectionList, bool isHeterogenous)
        {
            IObjectCollection objectCollection = (IObjectCollection)Activator.CreateInstance(Type.GetTypeFromCLSID(new Guid("2d3468c1-36a7-43b6-ac24-d3f02fd9607a")));

            foreach (JumpList._ShellObjectPair shellObjectPair in jumpItems)
            {
                objectCollection.AddObject(shellObjectPair.ShellObject);
            }
            HRESULT hrLeft;

            if (string.IsNullOrEmpty(category))
            {
                hrLeft = cdl.AddUserTasks(objectCollection);
            }
            else
            {
                hrLeft = cdl.AppendCategory(category, objectCollection);
            }
            if (hrLeft.Succeeded)
            {
                int num = jumpItems.Count;
                while (--num >= 0)
                {
                    successList.Add(jumpItems[num].JumpItem);
                }
                return;
            }
            if (isHeterogenous && hrLeft == HRESULT.DESTS_E_NO_MATCHING_ASSOC_HANDLER)
            {
                if (TraceShell.IsEnabled)
                {
                    TraceShell.Trace(TraceEventType.Error, TraceShell.RejectingJumpListCategoryBecauseNoRegisteredHandler(new object[]
                    {
                        category
                    }));
                }
                Utilities.SafeRelease <IObjectCollection>(ref objectCollection);
                List <JumpList._ShellObjectPair> list = new List <JumpList._ShellObjectPair>();
                foreach (JumpList._ShellObjectPair shellObjectPair2 in jumpItems)
                {
                    if (shellObjectPair2.JumpItem is JumpPath)
                    {
                        rejectionList.Add(new JumpList._RejectedJumpItemPair
                        {
                            JumpItem = shellObjectPair2.JumpItem,
                            Reason   = JumpItemRejectionReason.NoRegisteredHandler
                        });
                    }
                    else
                    {
                        list.Add(shellObjectPair2);
                    }
                }
                if (list.Count > 0)
                {
                    JumpList.AddCategory(cdl, category, list, successList, rejectionList, false);
                    return;
                }
            }
            else
            {
                foreach (JumpList._ShellObjectPair shellObjectPair3 in jumpItems)
                {
                    rejectionList.Add(new JumpList._RejectedJumpItemPair
                    {
                        JumpItem = shellObjectPair3.JumpItem,
                        Reason   = JumpItemRejectionReason.InvalidItem
                    });
                }
            }
        }
Example #39
0
        /// <summary>
        /// Initializes the GUI
        /// </summary>
        private void InitGUI()
        {
            // create glass effect
            RefreshGlassEffect();

            #region Events handlers

            NavigationPane.GotFocus += new RoutedEventHandler(NavigationPane_GotFocus);

            SettingsManager.QueueTracks.CollectionChanged += new NotifyCollectionChangedEventHandler(QueueTracks_CollectionChanged);
            SettingsManager.HistoryTracks.CollectionChanged += new NotifyCollectionChangedEventHandler(HistoryTracks_CollectionChanged);
            SettingsManager.FileTracks.CollectionChanged += new NotifyCollectionChangedEventHandler(LibraryTracks_CollectionChanged);
            SettingsManager.RadioTracks.CollectionChanged += new NotifyCollectionChangedEventHandler(RadioTracks_CollectionChanged);
            if (SettingsManager.FileListConfig != null)
                SettingsManager.FileListConfig.PropertyChanged += new PropertyChangedEventHandler(ViewDetailsConfig_PropertyChanged);
            if (SettingsManager.YouTubeListConfig != null)
                SettingsManager.YouTubeListConfig.PropertyChanged += new PropertyChangedEventHandler(ViewDetailsConfig_PropertyChanged);
            if (SettingsManager.SoundCloudListConfig != null)
                SettingsManager.SoundCloudListConfig.PropertyChanged += new PropertyChangedEventHandler(ViewDetailsConfig_PropertyChanged);
            if (SettingsManager.RadioListConfig != null)
                SettingsManager.RadioListConfig.PropertyChanged += new PropertyChangedEventHandler(ViewDetailsConfig_PropertyChanged);
            if (SettingsManager.JamendoListConfig != null)
                SettingsManager.JamendoListConfig.PropertyChanged += new PropertyChangedEventHandler(ViewDetailsConfig_PropertyChanged);
            if (SettingsManager.QueueListConfig != null)
                SettingsManager.QueueListConfig.PropertyChanged += new PropertyChangedEventHandler(ViewDetailsConfig_PropertyChanged);
            if (SettingsManager.HistoryListConfig != null)
                SettingsManager.HistoryListConfig.PropertyChanged += new PropertyChangedEventHandler(ViewDetailsConfig_PropertyChanged);

            FilesystemManager.SourceModified += new SourceModifiedEventHandler(FilesystemManager_SourceModified);
            FilesystemManager.TrackModified += new PropertyChangedEventHandler(FilesystemManager_TrackModified);
            FilesystemManager.PathModified += new PathModifiedEventHandler(FilesystemManager_PathModified);
            FilesystemManager.PathRenamed += new RenamedEventHandler(FilesystemManager_PathRenamed);
            FilesystemManager.ProgressChanged += new ProgressChangedEventHandler(FilesystemManager_ProgressChanged);
            FilesystemManager.SourceAdded += new SourcesModifiedEventHandler(FilesystemManager_SourceAdded);
            FilesystemManager.SourceRemoved += new SourcesModifiedEventHandler(FilesystemManager_SourceRemoved);

            MediaManager.TrackSwitched += new TrackSwitchedEventHandler(MediaManager_TrackSwitched);
            MediaManager.LoadedTrack += new LoadedTrackDelegate(MediaManager_LoadedTrack);
            MediaManager.Started += new EventHandler(MediaManager_Started);
            MediaManager.SearchMatch = TrackList_SearchMatch;

            UpgradeManager.Checked += new EventHandler(UpgradeManager_Checked);
            UpgradeManager.ErrorOccured += new Core.ErrorEventHandler(UpgradeManager_ErrorOccured);
            UpgradeManager.ProgressChanged += new ProgressChangedEventHandler(UpgradeManager_ProgressChanged);
            UpgradeManager.Upgraded += new EventHandler(UpgradeManager_Upgraded);
            UpgradeManager.UpgradeFound += new EventHandler(UpgradeManager_UpgradeFound);

            PluginManager.RefreshVisualizerSelector += new EventHandler(PluginManager_RefreshVisualizerSelector);
            PluginManager.Installed += new EventHandler<PluginEventArgs>(PluginManager_Installed);
            PluginManager.Uninstalled += new EventHandler<PluginEventArgs>(PluginManager_Uninstalled);
            PluginManager.Initialize();

            SettingsManager.PropertyChanged += new PropertyChangedWithValuesEventHandler(SettingsManager_PropertyChanged);
            ServiceManager.ModifyTracks += new EventHandler<ModifiedEventArgs>(ServiceManager_ModifyTracks);

            NavigationPane.CreateNewPlaylistETB.EnteredEditMode += new EventHandler(EditableTextBlock_EnteredEditMode);
            SystemEvents.SessionSwitch += new SessionSwitchEventHandler(SystemEvents_SessionSwitch);

            resortDelay.Interval = new TimeSpan(0, 0, 0, 0, 500);
            resortDelay.Tick += new EventHandler(ResortDelay_Tick);

            sourceModifiedDelay.Tick += new EventHandler(SourceModifiedDelay_Tick);
            sourceModifiedDelay.Interval = new TimeSpan(0, 0, 0, 1, 500);

            #endregion

            #region Tray icon

            // create system tray icon
            trayIcon = (TaskbarIcon)FindResource("NotifyIcon");
            trayIcon.TrayToolTip = new TrayToolTip(this);
            trayIcon.TrayLeftMouseUp += TaskbarClicked;
            trayMenu = new ContextMenu();
            trayMenuShow = new MenuItem();
            trayMenuExit = new MenuItem();
            trayMenuPlay = new MenuItem();
            trayMenuNext = new MenuItem();
            trayMenuPrev = new MenuItem();
            trayMenuShow.Header = U.T("TrayShow");
            trayMenuExit.Header = U.T("TrayExit");
            trayMenuPlay.Header = U.T("TrayPlay");
            trayMenuNext.Header = U.T("TrayNext");
            trayMenuPrev.Header = U.T("TrayPrev");
            trayMenuShow.Click += TrayShow_Clicked;
            trayMenuExit.Click += TrayExit_Clicked;
            trayMenuPlay.Click += TrayPlayPause_Clicked;
            trayMenuNext.Click += TrayNext_Clicked;
            trayMenuPrev.Click += TrayPrevious_Clicked;
            trayMenu.Items.Add(trayMenuShow);
            trayMenu.Items.Add(new Separator());
            trayMenu.Items.Add(trayMenuPlay);
            trayMenu.Items.Add(trayMenuNext);
            trayMenu.Items.Add(trayMenuPrev);
            trayMenu.Items.Add(new Separator());
            trayMenu.Items.Add(trayMenuExit);
            trayIcon.ContextMenu = trayMenu;

            #endregion

            #region Thumbnail buttons

            //// create thumbnail buttons
            taskbarPrev = new ThumbnailToolbarButton(Properties.Resources.Previous, U.T("TaskbarPrev"));
            taskbarPrev.Enabled = true;
            taskbarPrev.Click += TaskbarPrevious_Clicked;
            taskbarPlay = new ThumbnailToolbarButton(Properties.Resources.Play, U.T("TaskbarPlay"));
            taskbarPlay.Enabled = true;
            taskbarPlay.Click += TaskbarPlayPause_Clicked;
            taskbarNext = new ThumbnailToolbarButton(Properties.Resources.Next, U.T("TaskbarNext"));
            taskbarNext.Enabled = true;
            taskbarNext.Click += TaskbarNext_Clicked;
            TaskbarManager.Instance.ThumbnailToolbars.AddButtons(
                new WindowInteropHelper(this).Handle,
                new ThumbnailToolbarButton[] { taskbarPrev, taskbarPlay, taskbarNext }
            );

            #endregion

            #region Jump lists

            jumpTaskPlay = new JumpTask()
            {
                Title = U.T("JumpPlay", "Title"),
                Arguments = "/play",
                Description = U.T("JumpPlay", "Description"),
                IconResourceIndex = -1,
                ApplicationPath = Assembly.GetEntryAssembly().CodeBase,
            };

            jumpTaskNext = new JumpTask()
            {
                Title = U.T("JumpNext", "Title"),
                Arguments = "/next",
                Description = U.T("JumpNext", "Description"),
                IconResourceIndex = -1,
                ApplicationPath = Assembly.GetEntryAssembly().CodeBase,
            };

            jumpTaskPrev = new JumpTask()
            {
                Title = U.T("JumpPrev", "Title"),
                Arguments = "/previous",
                Description = U.T("JumpPrev", "Description"),
                IconResourceIndex = -1,
                ApplicationPath = Assembly.GetEntryAssembly().CodeBase,
            };

            jumpList = new System.Windows.Shell.JumpList();
            jumpList.JumpItems.Add(jumpTaskPlay);
            jumpList.JumpItems.Add(jumpTaskNext);
            jumpList.JumpItems.Add(jumpTaskPrev);
            jumpList.ShowRecentCategory = true;
            jumpList.ShowFrequentCategory = true;
            System.Windows.Shell.JumpList.SetJumpList(Application.Current, jumpList);

            #endregion

            #region Style

            Utilities.DefaultAlbumArt = "/Platform/Windows 7/GUI/Images/AlbumArt/Default.jpg";

            // rough detection of aero vs classic
            // you'll se a lot more of these around the code
            if (System.Windows.Forms.VisualStyles.VisualStyleInformation.DisplayName == "")
            {
                // applying classic theme
                SolidColorBrush scb = (SolidColorBrush)FindResource("DetailsPaneKey");
                scb.Color = SystemColors.ControlTextColor;
                scb = (SolidColorBrush)FindResource("DetailsPaneValue");
                scb.Color = SystemColors.ControlTextColor;
                scb = (SolidColorBrush)FindResource("InfoPaneTitle");
                scb.Color = SystemColors.ControlTextColor;
                scb = (SolidColorBrush)FindResource("InfoPaneText");
                scb.Color = SystemColors.ControlTextColor;

                MainFrame.BorderBrush = SystemColors.ControlBrush;
                MainFrame.Background = SystemColors.ControlBrush;
                MainContainer.Background = SystemColors.ControlBrush;
                InfoPane.Background = SystemColors.WindowBrush;
                VerticalSplitter.Background = SystemColors.ControlBrush;

                TopToolbar.Style = null;
                DetailsPane.Style = (Style)FindResource("ClassicDetailsPaneStyle");

                OuterBottomRight.BorderBrush = SystemColors.ControlLightLightBrush;
                OuterTopLeft.BorderBrush = SystemColors.ControlDarkBrush;
                InnerBottomRight.BorderBrush = SystemColors.ControlDarkBrush;
                InnerTopLeft.BorderBrush = SystemColors.ControlLightLightBrush;

                ControlPanel.AboutTitle.Style = (Style)FindResource("ClassicControlPanelTitleStyle");
                ControlPanel.ShortcutTitle.Style = (Style)FindResource("ClassicControlPanelTitleStyle");
                ControlPanel.GeneralTitle.Style = (Style)FindResource("ClassicControlPanelTitleStyle");
                Utilities.DefaultAlbumArt = "/Platform/Windows 7/GUI/Images/AlbumArt/Classic.jpg";
            }

            #endregion

            VisualizerList.ItemsSource = PluginManager.VisualizerSelector;

            LibraryTime = 0;
            QueueTime = 0;
            HistoryTime = 0;
            if (SettingsManager.FileTracks != null)
                foreach (TrackData track in SettingsManager.FileTracks)
                    LibraryTime += track.Length;
            if (SettingsManager.QueueTracks != null)
                foreach (TrackData track in SettingsManager.QueueTracks)
                    QueueTime += track.Length;
            if (SettingsManager.HistoryTracks != null)
                foreach (TrackData track in SettingsManager.HistoryTracks)
                    HistoryTime += track.Length;

            NavigationColumn.Width = new GridLength(SettingsManager.NavigationPaneWidth);
            double h = SettingsManager.DetailsPaneHeight;
            DetailsRow.Height = new GridLength(h);

            UpdateVisibility("menubar");
            UpdateVisibility("details");

            RefreshStrings();
            U.ListenForShortcut = true;

            FilesystemManager.AddSystemFolders(true);

            #region Create playlists

            foreach (PlaylistData playlist in SettingsManager.Playlists)
                CreatePlaylist(playlist, false);

            PlaylistManager.PlaylistModified += new ModifiedEventHandler(PlaylistManager_PlaylistModified);
            PlaylistManager.PlaylistRenamed += new RenamedEventHandler(PlaylistManager_PlaylistRenamed);

            if (SettingsManager.CurrentSelectedNavigation == "YouTube")
                NavigationPane.Youtube.Focus();
            else if (SettingsManager.CurrentSelectedNavigation == "SoundCloud")
                NavigationPane.SoundCloud.Focus();
            else if (SettingsManager.CurrentSelectedNavigation == "Radio")
                NavigationPane.Radio.Focus();
            else if (SettingsManager.CurrentSelectedNavigation == "Jamendo")
                NavigationPane.Jamendo.Focus();
            else if (SettingsManager.CurrentSelectedNavigation == "Queue")
                NavigationPane.Queue.Focus();
            else if (SettingsManager.CurrentSelectedNavigation == "History")
                NavigationPane.History.Focus();
            else if (SettingsManager.CurrentSelectedNavigation == "Video")
                NavigationPane.Video.Focus();
            else if (SettingsManager.CurrentSelectedNavigation == "Visualizer")
                NavigationPane.Visualizer.Focus();
            else if (!SettingsManager.CurrentSelectedNavigation.StartsWith("Playlist:"))
                NavigationPane.Files.Focus();
            else
            {
                string name = SettingsManager.CurrentSelectedNavigation.Split(new[] { ':' }, 2)[1];
                foreach (TreeViewItem tvi in NavigationPane.Playlists.Items)
                {
                    if ((string)tvi.Tag == name)
                    {
                        tvi.Focus();
                        break;
                    }
                }
            }

            #endregion

            #region Load track lists

            U.L(LogLevel.Debug, "main", "Initialize track lists");
            switch (SettingsManager.CurrentActiveNavigation)
            {
                case "Queue":
                    if (FileTracks == null)
                        FileTracks = InitTrackList(new ViewDetails(), SettingsManager.FileListConfig, SettingsManager.FileTracks);
                    break;

                case "Radio":
                    if (RadioTracks == null)
                        RadioTracks = InitTrackList(new ViewDetails(), SettingsManager.RadioListConfig, SettingsManager.RadioTracks);
                    break;

                case "YouTube":
                    if (YouTubeTracks == null)
                        YouTubeTracks = (YouTubeTracks)InitTrackList(new YouTubeTracks(), SettingsManager.YouTubeListConfig);
                    break;

                case "SoundCloud":
                    if (SoundCloudTracks == null)
                        SoundCloudTracks = (SoundCloudTracks)InitTrackList(new SoundCloudTracks(), SettingsManager.SoundCloudListConfig);
                    break;

                case "Jamendo":
                    if (JamendoTracks == null)
                        JamendoTracks = (JamendoTracks)InitTrackList(new JamendoTracks(), SettingsManager.JamendoListConfig);
                    break;

                default:
                    if (SettingsManager.CurrentActiveNavigation.StartsWith("Playlist:"))
                    {
                        string pname = SettingsManager.CurrentActiveNavigation.Split(new[] { ':' }, 2)[1];
                        PlaylistData p = PlaylistManager.FindPlaylist(pname);
                        if (p != null)
                        {
                            ViewDetails vd = (ViewDetails)PlaylistTrackLists[pname];
                            if (vd == null)
                                vd = InitTrackList(new ViewDetails(), p.ListConfig, p.Tracks);
                        }
                    }
                    break;
            }
            if (FileTracks == null)
                FileTracks = InitTrackList(new ViewDetails(), SettingsManager.FileListConfig, SettingsManager.FileTracks);

            #endregion

            #region File association prompt

            if (SettingsManager.FirstRun)
            {
                Dispatcher.Invoke(DispatcherPriority.Background, new Action(delegate()
                {
                    // Show welcome dialog
                    TaskDialogResult tdr = Welcome.Show(new WindowInteropHelper(this).Handle);
                    Associations a = new Associations();

                    ProcessStartInfo assProcInfo = new ProcessStartInfo();
                    assProcInfo.FileName = U.FullPath;
                    assProcInfo.Verb = "runas";
                    string assProcArgs = "--associate {0}";

                    try
                    {
                        switch (tdr)
                        {
                            case TaskDialogResult.Yes:
                                assProcInfo.Arguments = String.Format(assProcArgs,
                                    string.Join(",", a.FullFileList.ToArray()));
                                Process.Start(assProcInfo);
                                break;

                            case TaskDialogResult.CustomButtonClicked:
                                a.ShowDialog();
                                assProcInfo.Arguments = String.Format(assProcArgs,
                                    string.Join(",", a.FileList.ToArray()));
                                Process.Start(assProcInfo);
                                break;

                            case TaskDialogResult.Cancel:
                                break;
                        }
                    }
                    catch (Exception e)
                    {
                        U.L(LogLevel.Warning, "MAIN", "Could not set associations: " + e.Message);
                    }
                }));

                SettingsManager.FirstRun = false;
            }

            #endregion

            #region Commented
            //System.Configuration.Configuration config = System.Configuration.ConfigurationManager.OpenExeConfiguration(System.Configuration.ConfigurationUserLevel.PerUserRoamingAndLocal);
            #endregion
        }
 public static void SetJumpList(System.Windows.Application application, JumpList value)
 {
 }
 private static void AddCategory(ICustomDestinationList cdl, string category, List <JumpList._ShellObjectPair> jumpItems, List <JumpItem> successList, List <JumpList._RejectedJumpItemPair> rejectionList)
 {
     JumpList.AddCategory(cdl, category, jumpItems, successList, rejectionList, true);
 }
Example #42
0
        /// <summary>
        /// 添加到跳转列表
        /// </summary>
        /// <param name="title"></param>
        /// <param name="arguments"></param>
        private void AddKeyToJumpList(JumpListEventArgs args)
        {
            JumpList jumpList = JumpList.GetJumpList(App.Current);

            if (jumpList == null) jumpList = new JumpList();
            //jumpList.ShowRecentCategory = false;
            //jumpList.ShowFrequentCategory = true;
            foreach (JumpTask jumpItem in jumpList.JumpItems)
            {
                if (jumpItem.Title == args.Title) return;
            }
            JumpTask jumpTask = new JumpTask();
            jumpTask.Title = args.Title;
            jumpTask.Description = jumpTask.Title;
            jumpTask.Arguments = args.Arguments;
            jumpTask.CustomCategory = args.Category;
            jumpTask.WorkingDirectory = Directory.GetCurrentDirectory();
            jumpTask.ApplicationPath = Assembly.GetExecutingAssembly().Location;
            jumpList.JumpItems.Insert(0, jumpTask);
            if (jumpList.JumpItems.Count > 20)
            {
                jumpList.JumpItems.RemoveAt(20);
            }
            //jumpList.JumpItems.RemoveRange(10, 10);
            JumpList.AddToRecentCategory(jumpTask);

            Application.Current.Dispatcher.Invoke(new Action(() =>
            {
                JumpList.SetJumpList(App.Current, jumpList);
            }));
        }
 public TestNativeJumpList()
     : base(ApplicationJumpItemWrapper.GetJumpItemCommandId) {
     AppliedList = new JumpList();
     RecentCategory = new List<string>();
 }
Example #44
0
 public JumpListService()
 {
     this.jumpList = System.Windows.Shell.JumpList.GetJumpList(Application.Current);
 }
Example #45
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            // Извлечение текущего списка часто используемых элементов
            JumpList jumpList = new JumpList();
            JumpList.SetJumpList(Application.Current, jumpList);

            // Добавление нового объекта JumpPath для файла в папке приложения
            string path = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
            path = Path.Combine(path, "lol.xml");
            if (File.Exists(path))
            {
                JumpTask jumpTask = new JumpTask();
                jumpTask.CustomCategory = "Documentation";
                jumpTask.Title = "Read the lol.xml";
                jumpTask.ApplicationPath = @"C:\Program Files\Notepad++\notepad++.exe";
                jumpTask.IconResourcePath = @"C:\Program Files\Notepad++\notepad++.exe";
                jumpTask.Arguments = path;
                jumpList.JumpItems.Add(jumpTask);
            }

            // Обновление списка часто используемых элементов
            jumpList.Apply();
        }