Example #1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            AppDomain.CurrentDomain.AssemblyResolve += OnResolveAssembly;
            Application.Current.ShutdownMode         = ShutdownMode.OnExplicitShutdown;
            base.OnStartup(e);

            var assembly = Assembly.GetExecutingAssembly();

            PreferencesManager.CorrectAutoLaunchPath(assembly.Location);
            var sysTray = new SysTray();

            sysTray.BeginInit();

            RemoteWebListener.WebCommandExecutionReceived += SocketCommandExecution.ExecuteCommand;
            RemoteWebListener.StartListening();
            RemoteSerialListener.StartListening();

            //ConfigurationHelper.ShowConfigurationWindow();
        }
Example #2
0
        public static void UpdateAvailablePorts()
        {
            MenuItem item = nIcon.ContextMenu.MenuItems[2];

            item.MenuItems.Clear();
            foreach (string portName in SerialPortService.GetAvailableSerialPorts().OrderBy(s => s))
            {
                item.MenuItems.Add(portName).Click += async(s, c) =>
                {
                    bool isChecked = (s as MenuItem).Checked;
                    RemoteSerialListener.ClearCurrentPort();
                    if (!isChecked)
                    {
                        if (!(await RemoteSerialListener.TestPort(portName)))
                        {
                            System.Windows.MessageBox.Show($"Port {portName} has not been recognized");
                        }
                    }
                };
            }
        }