コード例 #1
0
        private void SetUnreadOverlay(int count)
        {
            if (_taskbarManager == null)
            {
                return;
            }

            CleanupDigitIcon();

            if (count == 0)
            {
                _taskbarManager.SetOverlayIcon(base.Handle, null, String.Empty);

                HideTrayIcon();
            }
            else
            {
                try {
                    int digitsNumber;
                    Int32.TryParse(count.ToString("00"), out digitsNumber);

                    using (Bitmap numbers = ImageHelper.GetDigitIcon(digitsNumber)) {
                        if (numbers == null)
                        {
                            _iconDigits = Resources.Icons.Warning as Icon;
                        }
                        else
                        {
                            _iconDigits = Icon.FromHandle(numbers.GetHicon());
                        }

                        // letting this generate even if the option isn't on. allows the user to show/hide the icon at will.
                        using (Bitmap trayNumbers = ImageHelper.GetTrayIcon(numbers)) {
                            _iconTray = Icon.FromHandle(trayNumbers.GetHicon());
                        }
                    }

                    _taskbarManager.SetOverlayIcon(base.Handle, _iconDigits, String.Empty);

                    _TrayIcon.Icon = _iconTray;

                    if (_config.ShowTrayIcon)
                    {
                        _TrayIcon.Visible = true;
                    }
                }
                catch (System.Runtime.InteropServices.ExternalException) {
                    SetWarningOverlay();
                }
            }
        }
コード例 #2
0
        private async void StartBtn_Click(object sender, RoutedEventArgs e)
        {
            if (!VModel.Ready)
            {
                return;
            }

            _manager.SetOverlayIcon(Properties.Resources.image_export, "Processing");
            TaskbarItemInfo.ProgressState = TaskbarItemProgressState.Normal;
            await VModel.Begin();

            TaskbarItemInfo.ProgressState = TaskbarItemProgressState.None;
            _manager.SetOverlayIcon(null, "");
        }
コード例 #3
0
        public ITaskbarItem SetOverlayIcon(Icon icon, string accessibilityText)
        {
#if !__MonoCS__
            _taskbarManager.SetOverlayIcon(_windowHandle, icon, accessibilityText);
#endif
            return(this);
        }
コード例 #4
0
        internal void ProcessCommandLineArgs(string[] args)
        {
            Color color = Color.White;

            System.Drawing.Icon icon = null;
            string accesibilityText  = null;

            try
            {
                ParseArguments(args, ref color, ref icon, ref accesibilityText);
            }
            catch (ArgumentException)
            {
                Debug.Assert(false, String.Format("Wrong command line parameter: {0}", args[1]));
            }

            if (icon != null)
            {
                if (CoreHelpers.RunningOnWin7)
                {
                    taskbarManager.SetOverlayIcon(icon, accesibilityText);
                }

                textBox.BackColor = color;
            }
            Activate();
        }
コード例 #5
0
        private void SetUnreadOverlay(int count)
        {
            if (_taskbarManager == null)
            {
                return;
            }

            CleanupDigitIcon();

            if (count == 0)
            {
                _taskbarManager.SetOverlayIcon(base.Handle, null, String.Empty);

                HideTrayIcon();
            }
            else
            {
                int digitsNumber;
                Int32.TryParse(count.ToString("00"), out digitsNumber);

                using (Bitmap numbers = ImageHelper.GetDigitIcon(digitsNumber)) {
                    if (numbers == null)
                    {
                        _iconDigits = Utilities.ResourceHelper.GetIcon("Warning.ico");
                    }
                    else
                    {
                        _iconDigits = Icon.FromHandle(numbers.GetHicon());
                    }

                    using (Bitmap trayNumbers = ImageHelper.GetTrayIcon(numbers)) {
                        _iconTray = Icon.FromHandle(trayNumbers.GetHicon());
                    }
                }

                _taskbarManager.SetOverlayIcon(base.Handle, _iconDigits, String.Empty);

                if (_config.ShowTrayIcon)
                {
                    _TrayIcon.Icon    = _iconTray;
                    _TrayIcon.Visible = true;
                }
            }
        }
コード例 #6
0
ファイル: Main.cs プロジェクト: summarine/Gmail-Notifier-Plus
        private void SetUnreadOverlay(int count)
        {
            if (_taskbarManager == null)
            {
                return;
            }

            //CleanupDigitIcon();

            if (count == 0)
            {
                _taskbarManager.SetOverlayIcon(base.Handle, null, String.Empty);

                HideTrayIcon();
            }
            else
            {
                try {
                    int  unreadNumber;
                    Icon overlay;

                    Int32.TryParse(count.ToString("00"), out unreadNumber);
                    overlay = ImageHelper.GetNumberIcon(unreadNumber);

                    if (overlay == null)
                    {
                        overlay = Resources.Icons.NewFallback;
                    }

                    _taskbarManager.SetOverlayIcon(base.Handle, overlay, String.Empty);

                    _TrayIcon.Icon = overlay;
                    _TrayIcon.Text = String.Concat(GmailNotifierPlus.Resources.Strings.WindowTitle, " (Unread: ", unreadNumber.ToString(), ")");

                    if (_config.ShowTrayIcon)
                    {
                        _TrayIcon.Visible = true;
                    }
                }
                catch (System.Runtime.InteropServices.ExternalException) {
                    SetWarningOverlay();
                }
            }
        }
コード例 #7
0
        internal void ProcessCommandLineArgs(string[] args)
        {
            Color color = Colors.White;

            System.Drawing.Icon icon = null;
            string accesibilityText  = null;

            try
            {
                if (args.Length >= 2)
                {
                    switch ((Status)Enum.Parse(typeof(Status), args[1]))
                    {
                    case Status.Online:
                        color            = Colors.Green;
                        icon             = WpfSample.Properties.Resources.Green;
                        accesibilityText = Status.Online.ToString();
                        break;

                    case Status.Away:
                        color            = Colors.Yellow;
                        icon             = WpfSample.Properties.Resources.Yellow;
                        accesibilityText = Status.Away.ToString();
                        break;

                    case Status.Busy:
                        color            = Colors.Red;
                        icon             = WpfSample.Properties.Resources.Red;
                        accesibilityText = Status.Busy.ToString();
                        break;

                    default:
                        Debug.Assert(false, "Shoult not be here");
                        break;
                    }
                }
            }
            catch (ArgumentException)
            {
                Debug.Assert(false, String.Format("Wrong command line parameter: {0}", args[1]));
            }

            if (icon != null)
            {
                if (CoreHelpers.RunningOnWin7)
                {
                    taskbarManager.SetOverlayIcon(icon, accesibilityText);
                }

                ((MainWindow)MainWindow).SetColor(color);
            }
            MainWindow.Activate();
        }
コード例 #8
0
ファイル: Form1.cs プロジェクト: Ytrog/RssBandit
        void Form1_Shown(object sender, System.EventArgs e)
        {
            //thumbnail toolbar button setup
            buttonAdd         = new ThumbnailToolbarButton(Properties.Resources.feed, "Add New Subscription");
            buttonAdd.Enabled = true;
            buttonAdd.Click  += new EventHandler <ThumbnailButtonClickedEventArgs>(buttonAdd_Click);

            buttonRefresh         = new ThumbnailToolbarButton(Properties.Resources.feedRefresh, "Refresh Feeds");
            buttonRefresh.Enabled = true;
            buttonRefresh.Click  += new EventHandler <ThumbnailButtonClickedEventArgs>(buttonRefresh_Click);

            TaskbarManager.Instance.ThumbnailToolbars.AddButtons(this.Handle, buttonAdd, buttonRefresh);
            TaskbarManager.Instance.TabbedThumbnail.SetThumbnailClip(this.Handle, new Rectangle(pictureBox1.Location, pictureBox1.Size));

            string systemFolder = Environment.GetFolderPath(Environment.SpecialFolder.System);

            //setup jumplist
            jumpList = JumpList.CreateJumpList();
            category1.AddJumpListItems(new JumpListLink(Path.Combine(systemFolder, "notepad.exe"), "SteveSi's Office Hours"));
            category2.AddJumpListItems(new JumpListLink(Path.Combine(systemFolder, "mspaint2.exe"), "Add Google Reader Feeds")
            {
                IconReference = new IconReference(Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "Resources\\google.bmp"), 0)
            });
            category2.AddJumpListItems(new JumpListLink(Path.Combine(systemFolder, "mspaint3.exe"), "Add Facebook News Feed")
            {
                IconReference = new IconReference(Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "Resources\\facebook.ico"), 0)
            });
            category2.AddJumpListItems(new JumpListLink(Path.Combine(systemFolder, "mspaint4.exe"), "Refresh Feeds")
            {
                IconReference = new IconReference(Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "Resources\\feedRefresh.ico"), 0)
            });
            jumpList.AddCustomCategories(category1, category2);
            jumpList.AddUserTasks(new JumpListSeparator());

            JumpListCustomCategory empty = new JumpListCustomCategory(String.Empty);

            empty.AddJumpListItems(new JumpListLink("http://www.rssbandit.org", "Go to rssbandit.org")
            {
                IconReference = new IconReference(Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "Resources\\app.ico"), 0)
            });

            jumpList.AddCustomCategories(empty);

            TaskbarManager.Instance.SetProgressState(TaskbarProgressBarState.NoProgress);
            jumpList.Refresh();

            windowsTaskbar.SetOverlayIcon(this.Handle, Properties.Resources.envelope, "New Items");
            // windowsTaskbar.SetOverlayIcon(this.Handle, null, null); <-- to clear
        }
コード例 #9
0
        private void BGWorker_ProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            var detail = (Plugin.PluginDetail)e.UserState;

            if (System.IO.File.Exists(detail.PluginIconPath))
            {
                try
                {
                    taskbarInstance.SetOverlayIcon(new Icon(detail.PluginIconPath), detail.Name);
                }
                catch (Exception)
                {
                    // ¯\_(ツ)_/¯
                }
            }
        }
コード例 #10
0
        private void Main_Move(object sender, System.EventArgs e)
        {
            Point posAddForm  = new Point(formRequest.Size.Width / 2, formRequest.Size.Height / 2);
            Point posMainForm = new Point(config.Size.Width / 2, config.Size.Height / 2);

            formRequest.Location = new Point((config.Location.X + posMainForm.X) - posAddForm.X, (config.Location.Y + posMainForm.Y) - posAddForm.Y);

            // Text
            //TaskbarProgressBarState state =  (TaskbarProgressBarState)(Enum.Parse(typeof(TaskbarProgressBarState), "Error"));

            windowsTaskbar.SetProgressState(TaskbarProgressBarState.Normal);
            windowsTaskbar.SetProgressValue(40, 100);

            windowsTaskbar.SetOverlayIcon(Properties.Resources.worker, "Worker");
            // TaskbarManager.Instance.SetOverlayIcon(Nothing, Nothing)

            if (this.WindowState != FormWindowState.Maximized)
            {
                config.Location = this.Location;
                config.Save();
            }
        }
コード例 #11
0
 private void labelNoIconOverlay_Click(object sender, EventArgs e)
 {
     windowsTaskbar.SetOverlayIcon(this.Handle, null, null);
     HighlightOverlaySelection(labelNoIconOverlay);
 }
コード例 #12
0
 void ResetOverlay()
 {
     mWindowsTaskBar.SetProgressState(TaskbarProgressBarState.NoProgress);
     mWindowsTaskBar.SetOverlayIcon(null, "");
 }