Ejemplo n.º 1
0
        public void GetTaskbarInfo()
        {
            WinForms.NotifyIcon icon = new WinForms.NotifyIcon();

            Taskbar bar = new Taskbar();
            Point point = bar.GetTangentPosition(icon);
        }
Ejemplo n.º 2
0
        private void ShowKeyEditor(object sender, RoutedEventArgs e)
        {
            using (var editor = new HotKeyEditor(manager))
            {
                var taskbar = new Taskbar();
                switch (taskbar.Edge)
                {
                case ScreenEdge.Bottom:
                case ScreenEdge.Right:
                    editor.Top  = Top - (editor.Height * 0.50);
                    editor.Left = Left - (editor.Width * 0.60);
                    break;

                case ScreenEdge.Top:
                    editor.Top  = Top + (Height * 0.50);
                    editor.Left = Left - (editor.Width * 0.80);
                    break;

                case ScreenEdge.Left:
                    editor.Top  = Top - (editor.Height * 0.50);
                    editor.Left = Left + (Width * 0.30);
                    break;
                }

                IsPinned          = true;
                manager.IsEnabled = false;

                editor.ShowDialog();
            }

            IsPinned          = false;
            manager.IsEnabled = true;

            taskPanel.ResetEditKeys();
        }
Ejemplo n.º 3
0
        private void DoAbout(object sender, EventArgs e)
        {
            if (IsOpaque && !IsPinned)
            {
                Hide();
            }

            if (aboutBox == null)
            {
                aboutBox = new AboutBox();
            }

            var taskbar = new Taskbar();
            var point   = taskbar.GetTangentPosition(trayIcon);

            aboutBox.SetPositionRelativeTo(point, taskbar.Edge);
            aboutBox.Show();
        }
Ejemplo n.º 4
0
        private void ShowAppWindow()
        {
            if ((tracker != null) && tracker.IsOpaque)
            {
                tracker.Hide();
            }

            if ((aboutBox != null) && aboutBox.IsOpaque)
            {
                aboutBox.Hide();
            }

            // there is no event to indicate when Shuffled changes so we need to peek
            taskPanel.IsShuffled = controller.Shuffle;

            var   taskbar = new Taskbar();
            Point point   = taskbar.GetTangentPosition(trayIcon);

            SetPositionRelativeTo(point, taskbar.Edge);
            Show();
        }
Ejemplo n.º 5
0
        private void DoTrackPlaying(ITrack track)
        {
            if (!tracker.Dispatcher.CheckAccess())
            {
                //Logger.WriteLine(Logger.Level.Debug, "DEBUG", "DoTrackPlaying.BeginInvoke");
                tracker.Dispatcher.BeginInvoke((Action) delegate
                {
                    DoTrackPlaying(track);
                });

                return;
            }

            //Logger.WriteLine(Logger.Level.Debug, "DEBUG", "DoTrackPlaying");

            // TODO: why do we need to do this?  the 'track' parameter is not alway populated
            // for some reason.  Is this when we BeginInvoke?  Why?
            track = controller.CurrentTrack;

            //Logger.WriteLine(Logger.Level.Debug, "DEBUG", String.Format("track is null? ({0})", track == null ? "Yes" : "No"));

            taskPanel.LyricsState = string.IsNullOrEmpty(track?.Lyrics) ? "0" : string.Empty;

            SetNotifyIcon(track);

            // if already showing main app window, don't need to show tracker
            if (IsOpaque)
            {
                return;
            }

            if (Properties.Settings.Default.TrackerEnabled)
            {
                var   taskbar = new Taskbar();
                Point point   = taskbar.GetTangentPosition(trayIcon);
                tracker.SetPositionRelativeTo(point, taskbar.Edge);
                tracker.ShowActivated = false;
                tracker.Show();
            }
        }
Ejemplo n.º 6
0
        //----------------------------------------------------------------------------------------
        /// <summary>
        /// Positions the window just above a specified coordinate, centering
        /// the window over that position.
        /// </summary>
        /// <param name="x">The X coordinate over which the window is to be centered.</param>
        /// <param name="y">The Y coordinate over which the window is to be placed.</param>
        public void SetPositionRelateiveTo(Point point, Taskbar.Dock docking)
        {
            double limitted;			// max width or height limit depending on docking
            double centered;			// vertical or horizontal center depending on docking

            if ((docking == Taskbar.Dock.Bottom) || (docking == Taskbar.Dock.Top))
            {
                limitted = SystemParameters.WorkArea.Width - Width - DefaultWindowMargin;
                centered = point.X - (Width / 2);

                Left = (centered > limitted ? limitted : centered);

                if (docking == Taskbar.Dock.Bottom)
                {
                    Top = point.Y - Height - DefaultWindowMargin;
                }
                else
                {
                    Top = point.Y + DefaultWindowMargin;
                }
            }
            else
            {
                limitted = SystemParameters.WorkArea.Height - Height - DefaultWindowMargin;
                centered = point.Y - (Height / 2);

                Top = (centered > limitted ? limitted : centered);

                if (docking == Taskbar.Dock.Left)
                {
                    Left = point.X + DefaultWindowMargin;
                }
                else
                {
                    Left = point.X - Width - DefaultWindowMargin;
                }
            }
        }