Beispiel #1
0
        public Navigation()
        {
            InitializeComponent();

            m_owlIcons = new System.Drawing.Icon[6];

            System.IO.Stream iconStream = Application.GetResourceStream(new Uri("pack://application:,,,/Owl;component/media/owl.ico")).Stream;
            m_owlIcons[0] = new System.Drawing.Icon(iconStream, 16, 16);//new Size(16,16));
            iconStream.Dispose();
            iconStream    = Application.GetResourceStream(new Uri("pack://application:,,,/Owl;component/media/owl_2.ico")).Stream;
            m_owlIcons[1] = new System.Drawing.Icon(iconStream, 16, 16);//new Size(16,16));
            iconStream.Dispose();
            iconStream    = Application.GetResourceStream(new Uri("pack://application:,,,/Owl;component/media/owl_4.ico")).Stream;
            m_owlIcons[2] = new System.Drawing.Icon(iconStream, 16, 16);//new Size(16,16));
            iconStream.Dispose();
            iconStream    = Application.GetResourceStream(new Uri("pack://application:,,,/Owl;component/media/owl_6.ico")).Stream;
            m_owlIcons[3] = new System.Drawing.Icon(iconStream, 16, 16);//new Size(16,16));
            iconStream.Dispose();
            iconStream    = Application.GetResourceStream(new Uri("pack://application:,,,/Owl;component/media/owl_8.ico")).Stream;
            m_owlIcons[4] = new System.Drawing.Icon(iconStream, 16, 16);//new Size(16,16));
            iconStream.Dispose();
            iconStream    = Application.GetResourceStream(new Uri("pack://application:,,,/Owl;component/media/owl_10.ico")).Stream;
            m_owlIcons[5] = new System.Drawing.Icon(iconStream, 16, 16);//new Size(16,16));
            iconStream.Dispose();


            m_notifyIcon = new System.Windows.Forms.NotifyIcon();
            m_notifyIcon.BalloonTipText  = "The app has been minimized. Click the tray icon to show.";
            m_notifyIcon.BalloonTipTitle = "Owl";
            m_notifyIcon.Text            = "Owl";
            m_notifyIcon.Icon            = m_owlIcons[0];
            //System.Drawing.Icon as a Resource
            //new Icon(GetType(),"Icon1.ico");
            //m_notifyIcon.Icon = new System.Drawing.Icon(new System.Uri("Media/owl.ico"));
            //new System.Drawing.Icon("D:\\Perso\\Dev\\littlebeagle\\LittleBeagle\\Media\\owl.ico");
            m_notifyIcon.Click     += new EventHandler(m_notifyIcon_Click);
            m_notifyIcon.MouseMove += new System.Windows.Forms.MouseEventHandler(m_notifyIcon_BalloonTipShown);

            ((Application.Current as App).JobItems).CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(Job_CollectionChanged);

            m_hotkey = new KeyboardHandler(this);
            m_hotkey.HotKeyPressed += m_notifyIcon_Click;
        }
Beispiel #2
0
        private void Window_Closed(object sender, EventArgs e)
        {
            if (_timer != null)
            {
                _timer.Dispose();
                _timer = null;
            }
            foreach (System.Drawing.Icon ico in m_owlIcons)
            {
                if (ico != null)
                {
                    ico.Dispose();
                }
            }

            m_notifyIcon.Dispose();
            m_notifyIcon = null;

            m_hotkey.Dispose();
            m_hotkey = null;
        }