public override void Init(string[] args) { if (WinFormsRunner.Instance != null) { throw new Duplicati.Library.Interface.UserInformationException("Multiple trayicon instances not allowed!"); } WinFormsRunner.Instance = this; //We need this ugly hack to get a handle that we can call Invoke on, // and sadly the TrayIcon does not expose one, and forcing the context menu // to create one causes weird "lost clicks" m_handleProvider = new Form() { FormBorderStyle = FormBorderStyle.None, Width = 10, Height = 10, Top = 0, Left = 0 }; m_handleProvider.Show(); m_handleProvider.Hide(); m_trayIcon = new NotifyIcon(); m_trayIcon.DoubleClick += new EventHandler(m_trayIcon_DoubleClick); m_trayIcon.Click += new EventHandler(m_trayIcon_Click); base.Init(args); }
public override void Init (string[] args) { if (WinFormsRunner.Instance != null) throw new Exception("Multiple trayicon instances not allowed!"); WinFormsRunner.Instance = this; //We need this ugly hack to get a handle that we can call Invoke on, // and sadly the TrayIcon does not expose one, and forcing the context menu // to create one causes weird "lost clicks" m_handleProvider = new Form() { FormBorderStyle = FormBorderStyle.None, Width = 10, Height = 10, Top = 0, Left = 0 }; m_handleProvider.Show(); m_handleProvider.Hide(); m_trayIcon = new NotifyIcon(); m_trayIcon.DoubleClick += new EventHandler(m_trayIcon_DoubleClick); m_trayIcon.Click += new EventHandler(m_trayIcon_Click); base.Init(args); }