public void ReloadPtmManager()
        {
            IKernel      kernel = new StandardKernel(new InjectionModules());
            IEventBroker broker = kernel.Get <IEventBroker>();

            mConfig.LoadConfig();
            _ = new PtmManager(broker, mConfig);
        }
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            IKernel      kernel     = new StandardKernel(new InjectionModules());
            IEventBroker broker     = kernel.Get <IEventBroker>();
            PtmManager   ptmManager = new PtmManager(broker);

            Application.Run(new Form1());
        }
 private void StopScanning()
 {
     btnSetPTM.BackColor      = System.Drawing.Color.FromArgb(((int)(((byte)(60)))), ((int)(((byte)(60)))), ((int)(((byte)(60)))));
     mConfig.PTMConfiguration = mNewPtmConfiguration;
     mConfig.SaveConfig();
     mPtmDevicePollTimer.Stop();
     mScanning = false;
     UpdateControls();
     DisposeDevices();
     PtmManager.UpdatePtmDevice();
     ReloadPtmManager();
 }
Exemple #4
0
        static void Main()
        {
            //if (Environment.OSVersion.Version.Major & gt;= 6)
            SetProcessDPIAware();
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            AppPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            string configFilePath = Path.Combine(AppPath, "AppConfig.json");

            IKernel    kernel = new StandardKernel(new InjectionModules());
            IAppConfig config = kernel.Get <IAppConfig>();

            IEventBroker broker = kernel.Get <IEventBroker>();

            _ = new PtmManager(broker, config);
            PtmManager.mPtmTimer.Stop();
            _ = new AutoDeafenManager(broker, config);
            AutoDeafenManager.mOutputTimer.Stop();

            try
            {
                config.LoadConfig(configFilePath);
            }
            catch (FileNotFoundException)
            {
                config.SaveConfig();
            }
            catch (Exception)
            {
                config.SaveConfig();
                MessageBox.Show("Error loading configuration file. The configuration file has become corrupt and will be reset to the default settings.", "Error Loading Configuration", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                config.AppPath = AppPath;
            }

            Application.Run(new Form1());
            kernel.Dispose();
        }