コード例 #1
0
        /// <summary>
        /// Invoked after a short delay when a track is switched to.
        /// </summary>
        /// <param name="e">The event data</param>
        private void MediaManager_TrackSwitchedDelayed(TrackSwitchedEventArgs e)
        {
            if (trackSwitchDelay != null)
                trackSwitchDelay.Stop();

            Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate()
            {
                if (trayIcon != null) ((TrayToolTip)trayIcon.TrayToolTip).SetTrack(e.NewTrack);

                if (SettingsManager.ShowOSD)
                {
                    TrayNotification notification = new TrayNotification(e.NewTrack, this);
                    if (trayIcon != null)
                        trayIcon.ShowCustomBalloon(notification, System.Windows.Controls.Primitives.PopupAnimation.Fade, 4000);
                }

                JumpTask jumpTask = new JumpTask()
                {
                    Title = e.NewTrack.Artist + " - " + e.NewTrack.Title,
                    Arguments = e.NewTrack.Path,
                    Description = e.NewTrack.Artist + " - " + e.NewTrack.Title,
                    IconResourcePath = "C:\\Windows\\System32\\imageres.dll",
                    IconResourceIndex = 190,
                    ApplicationPath = Assembly.GetEntryAssembly().CodeBase,
                };

                System.Windows.Shell.JumpList.AddToRecentCategory(jumpTask);
            }));
        }
コード例 #2
0
        /// <summary>
        /// Invoked when an upgrade is found
        /// </summary>
        /// <param name="sender">The sender of the event</param>
        /// <param name="e">The event data</param>
        private void UpgradeManager_UpgradeFound(object sender, EventArgs e)
        {
            U.L(LogLevel.Debug, "MAIN", "Upgrade manager found upgrade");
            Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate()
            {
                ControlPanel.UpgradeMessageText.Text = U.T("UpgradeFound");
                ControlPanel.UpgradeMessageIcon.Source = new BitmapImage(new Uri("/Platform/Windows 7/GUI/Images/Icons/Info.ico", UriKind.RelativeOrAbsolute));
                ControlPanel.UpgradeMessage.Visibility = System.Windows.Visibility.Visible;
                ControlPanel.EnableUpgradeDo();
                if (TaskbarItemInfo != null)
                    TaskbarItemInfo.ProgressState = System.Windows.Shell.TaskbarItemProgressState.None;

                if (SettingsManager.UpgradePolicy == UpgradePolicy.Notify)
                {
                    TrayNotification notification = new TrayNotification(this);
                    trayIcon.ShowCustomBalloon(notification, System.Windows.Controls.Primitives.PopupAnimation.Fade, 3600000);
                    ControlPanel.PrefDoUpgrade.Visibility = Visibility.Visible;
                }
            }));
        }
コード例 #3
0
ファイル: MainWindow.xaml.cs プロジェクト: uQr/stoffi
        /// <summary>
        /// Invoked after a short delay when a track is switched to.
        /// </summary>
        /// <param name="state">The state (not used)</param>
        private void MediaManager_TrackSwitchedDelayed(object state)
        {
            trackSwitchDelay.Change(Timeout.Infinite, Timeout.Infinite);
            TrackData track = SettingsManager.CurrentTrack;
            if (track == null) return;

            Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate()
            {
                if (SettingsManager.ShowOSD)
                {
                    TrayNotification notification = new TrayNotification(track, this);
                    if (trayIcon != null)
                        trayIcon.ShowCustomBalloon(notification, System.Windows.Controls.Primitives.PopupAnimation.Fade, 4000);
                }

                // TODO: This hangs Stoffi sometimes for a few seconds
                JumpTask jumpTask = new JumpTask()
                {
                    Title = track.Artist + " - " + track.Title,
                    Arguments = track.Path,
                    Description = track.Artist + " - " + track.Title,
                    IconResourcePath = "C:\\Windows\\System32\\imageres.dll",
                    IconResourceIndex = 190,
                    ApplicationPath = Assembly.GetEntryAssembly().CodeBase,
                };

                System.Windows.Shell.JumpList.AddToRecentCategory(jumpTask);
            }));
        }