コード例 #1
0
ファイル: Program.cs プロジェクト: brianavid/PushWhacker
        static void Main()
        {
            ConfigValues configValues = new ConfigValues();

            configValues.Load();

            if (!PushDisplay.Open() && !configValues.UserModeOnly)
            {
                MessageBox.Show("Can't open Push display");
            }
            else
            {
                midiProcessor = new MidiProcessor(configValues);

                if (!midiProcessor.StartProcessing())
                {
                    MessageBox.Show("Can't start Push Midi Processing\n\nThis is usually because another program or browser web page is using Midi and has locked all ports");
                }
                else
                {
                    SystemEvents.SessionEnding += new SessionEndingEventHandler(PushWacker_SesssionEndingEventHandler);
                    var applicationContext = new CustomApplicationContext(configValues, midiProcessor);
                    Application.Run(applicationContext);

                    midiProcessor.StopProcessing();
                }

                PushDisplay.Close();
            }
        }
コード例 #2
0
        private void StoreValues()
        {
            configValues.UserModeOnly    = checkBoxUserModeOnly.Checked;
            configValues.Output          = comboBoxOutput.SelectedItem as string;
            configValues.Layout          = comboBoxLayout.SelectedItem as string;
            configValues.FixLayout       = comboBoxPadStartNote.SelectedIndex != 0;
            configValues.KeyChangeFifths = comboBoxKeyChangeAmount.SelectedIndex != 0;
            configValues.Pressure        = comboBoxPressure.SelectedItem as string;
            configValues.TouchStripMode  = comboBoxTouchStrip.SelectedItem as string;
            configValues.PedalMode       = comboBoxPedal.SelectedItem as string;

            SaveScaleValues();

            configValues.Save();

            midiProcessor.StopProcessing();
            if (!midiProcessor.StartProcessing())
            {
                MessageBox.Show("Can't start Push Midi Processing\n\nThis is usually because another program or browser web page is using Midi and has locked all ports");
            }
        }