private void MainForm_Load(object sender, EventArgs e)
        {
            if (StartWithWindowsRegistryKey.GetValue(StartWithWindowsRegistryKeyName) != null)
            {
                StartWithWindowsCB.Checked = true;
                BeginInvoke((MethodInvoker)MinimizeToTray);
            }

            DashButtonListener.OnNetworkListenerStarted += OnNetworkListenerStarted;
            DashButtonListener.OnDashButtonClicked      += OnDashButtonClicked;
            DashButtonListener.OnActionExceptionThrown  += OnActionExceptionThrown;
            DashButtonListener.OnExceptionThrown        += OnExceptionThrown;

            Log("Starting network listeners...");
            Task.Run(() =>
            {
                try
                {
                    DashButtonListener.Start();
                }
                catch (DashButtonCoreException dbce)
                {
                    Log($"An error has occurred while starting the network listener: \n" + dbce.Message);
                }
            });
        }
Beispiel #2
0
 protected override void OnStart(string[] args)
 {
     EventLog.WriteEntry("Starting network listener...");
     try
     {
         DashButtonListener.Start();
         EventLog.WriteEntry(DashButtonListener.DashButtons.Count + " buttons registered.");
     }
     catch (DashButtonCoreException e)
     {
         OnExceptionThrown(e);
     }
 }