示例#1
0
 public MidiSlider()
 {
     nanoSliderTray = new TrayApplicationContext();
     if (!nanoSliderTray.ProgramAlreadyRuning())
     {
         Task.Run(() => Slider());
         Application.Run(nanoSliderTray);//run everything before this line or wont be runned
     }
 }
示例#2
0
        static void Main()
        {
            Config     config   = new Config();
            Sett       settings = config.SourceSettings();
            List <App> apps     = config.SourceAppConfig();


            if (apps == null)   // error in json
            {
                const string message = "Configuration Volume file error.";
                const string caption = "Midi2Vol";
                MessageBox.Show(message, caption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                config.removeAppConfig();
                Application.Restart(); // restart to load new app configs
                Environment.Exit(0);
            }
            else if (settings == null)   //error in json
            {
                const string message = "Configuration Setting file error.";
                const string caption = "Midi2Vol";
                MessageBox.Show(message, caption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                config.removeSett();
                Application.Restart(); // restart to load new sett configs
                Environment.Exit(0);
            }

            else
            {
                TrayApplicationContext nanoSliderTray = new TrayApplicationContext(settings);
                MidiSlider             nanoSlider     = new MidiSlider(settings, apps, nanoSliderTray);

                if (RunningInstance() == null)
                {
                    Debug.WriteLine("lets run");
                    Task.Run(() => nanoSlider.Slider());
                    Application.Run(nanoSliderTray);//run everything before this line or wont be runned
                }
                else
                {
                    nanoSliderTray.ProgramAlreadyRuning();
                }
            }
        }