示例#1
0
        public static SettingsWrapper LoadFromAppConfig()
        {
            SettingsWrapper s = new SettingsWrapper();

            s.BuzzSounds                  = PACEBuzz.Properties.Settings.Default.buzzSounds.Cast <string>().ToList();
            s.ResetShortcutKey            = PACEBuzz.Properties.Settings.Default.resetShortcutKey;
            s.ResetShortcutShift          = PACEBuzz.Properties.Settings.Default.resetShortcutShift;
            s.ResetShortcutControl        = PACEBuzz.Properties.Settings.Default.resetShortcutControl;
            s.NextBuzzShortcutKey         = PACEBuzz.Properties.Settings.Default.nextBuzzShortcutKey;
            s.NextBuzzShortcutShift       = PACEBuzz.Properties.Settings.Default.nextBuzzShortcutShift;
            s.NextBuzzShortcutControl     = PACEBuzz.Properties.Settings.Default.nextBuzzShortcutControl;
            s.CountdownShortcutKey        = PACEBuzz.Properties.Settings.Default.countdownShortcutKey;
            s.CountdownShortcutShift      = PACEBuzz.Properties.Settings.Default.countdownShortcutShift;
            s.CountdownShortcutControl    = PACEBuzz.Properties.Settings.Default.countdownShortcutControl;
            s.LightCheckShortcutKey       = PACEBuzz.Properties.Settings.Default.lightCheckShortcutKey;
            s.LightCheckShortcutShift     = PACEBuzz.Properties.Settings.Default.lightCheckShortcutShift;
            s.LightCheckShortcutControl   = PACEBuzz.Properties.Settings.Default.lightCheckShortcutControl;
            s.PreviousBuzzShortcutKey     = PACEBuzz.Properties.Settings.Default.previousBuzzShortcutKey;
            s.PreviousBuzzShortcutShift   = PACEBuzz.Properties.Settings.Default.previousBuzzShortcutShift;
            s.PreviousBuzzShortcutControl = PACEBuzz.Properties.Settings.Default.previousBuzzShortcutControl;
            s.AlwaysOnTop                 = PACEBuzz.Properties.Settings.Default.alwaysOnTop;
            s.Blink = PACEBuzz.Properties.Settings.Default.blink;
            s.AllowBuzzerCancels       = PACEBuzz.Properties.Settings.Default.allowBuzzerCancels;
            s.ShowInTaskBar            = PACEBuzz.Properties.Settings.Default.showInTaskBar;
            s.CountdownLengthInSeconds = PACEBuzz.Properties.Settings.Default.countdownLengthInSeconds;
            s.QuitPrompt           = PACEBuzz.Properties.Settings.Default.quitPrompt;
            s.FirstPlayerCanCancel = PACEBuzz.Properties.Settings.Default.firstPlayerCanCancel;
            s.BuzzerType           = PACEBuzz.Properties.Settings.Default.buzzerType;

            return(s);
        }
示例#2
0
 private void OnSettingsChanged(object sender, SettingsCallbackEventArgs args)
 {
     this.isModalDialogOpen = false;
     this.settings          = args.ModifiedSettings;
     this.ApplySettings();
     this.CheckIfBuzzHandsetsPresent();
     this.ResetAllLights();
 }
示例#3
0
        public MainWindow()
        {
            InitializeComponent();
            this.QueuedPlayers = new List <Player>();
            this.settings      = SettingsWrapper.LoadFromAppConfig();
            this.resetToolTip  = new ToolTip();
            this.resetToolTip.SetToolTip(this.imgMinReset, "Reset Buzzer, Get Rid of All Buzzes in Queue");
            this.nextBuzzToolTip = new ToolTip();
            this.nextBuzzToolTip.SetToolTip(this.imgMinNextBuzz, "Next Buzz in Queue");
            this.settingsToolTip = new ToolTip();
            this.settingsToolTip.SetToolTip(this.imgMinSettings, "Settings");
            this.lightCheckToolTip = new ToolTip();
            this.lightCheckToolTip.SetToolTip(this.imgMinLightCheck, "Briefly light all of the buzzers to test that their lights are working.");
            this.bonusCountdownToolTip = new ToolTip();
            this.bonusCountdownToolTip.SetToolTip(this.imgMinBonusCountdown, "Start countdown");
            this.closeToolTip = new ToolTip();
            this.closeToolTip.SetToolTip(this.imgMinExit, "Exit");
            this.buzzersDetectedToolTip = new ToolTip();
            this.buzzersDetectedToolTip.SetToolTip(this.lblBuzzersDetected, "# of Buzzers Detected. In arcade mode, this may include more than are plugged into control board");
            this.helpToolTip = new ToolTip();
            this.helpToolTip.SetToolTip(this.imgMinHelp, "Help");
            this.lblMinBonusCountdown.Visible = false;
            this.refreshToolTip = new ToolTip();
            this.refreshToolTip.SetToolTip(this.imgMinRefresh, "Check for newly plugged in buzzers");
            this.showLastBuzzToolTip = new ToolTip();
            this.showLastBuzzToolTip.SetToolTip(this.imgMinForceLastLight, "Light up who last buzzed");
            this.previousBuzzStack = new Stack <Player>();

            this.ApplySettings();
            this.onSettingsChanged += new SettingsChangedEventHandler(OnSettingsChanged);
            this.onFormClosed      += new FormClosedEventHandler(OnFormClosed);

            // Initialize sounds
            this.errorSound = Path.Combine("Sounds", "error.wav");

            this.soundFiles = new List <string>();
            for (int i = 1; i <= 8; i++)
            {
                this.soundFiles.Add(Path.Combine("Sounds", "beep" + i + ".wav"));
            }

            this.CheckIfBuzzHandsetsPresent();
            this.ResetAllLights();

            // Play the buzz on load to get the sound cached
            this.SafePlaySound(this.soundFiles[7]);
        }
示例#4
0
 public SettingsCallbackEventArgs(SettingsWrapper settings)
 {
     this.ModifiedSettings = settings;
 }
示例#5
0
        public SettingsForm(SettingsWrapper settings, SettingsChangedEventHandler onSettingsChanged, FormClosedEventHandler onFormClosed)
        {
            this.settings          = settings;
            this.OnSettingsChanged = onSettingsChanged;
            this.MainFormShow     += onFormClosed;

            InitializeComponent();
            keyList.Add(SettingsWrapper.NoneShortcut);
            keyList.Add("F1");
            keyList.Add("F2");
            keyList.Add("F3");
            keyList.Add("F4");
            keyList.Add("F5");
            keyList.Add("F6");
            keyList.Add("F7");
            keyList.Add("F8");
            keyList.Add("F9");
            keyList.Add("F10");
            keyList.Add("F11");
            keyList.Add("F12");
            keyList.Add("D1");
            keyList.Add("D2");
            keyList.Add("D3");
            keyList.Add("D4");
            keyList.Add("D5");
            keyList.Add("D6");
            keyList.Add("D7");
            keyList.Add("D8");
            keyList.Add("D9");
            keyList.Add("D0");
            keyList.Add("A");
            keyList.Add("B");
            keyList.Add("C");
            keyList.Add("D");
            keyList.Add("E");
            keyList.Add("F");
            keyList.Add("G");
            keyList.Add("H");
            keyList.Add("I");
            keyList.Add("J");
            keyList.Add("K");
            keyList.Add("L");
            keyList.Add("M");
            keyList.Add("N");
            keyList.Add("O");
            keyList.Add("P");
            keyList.Add("Q");
            keyList.Add("R");
            keyList.Add("S");
            keyList.Add("T");
            keyList.Add("U");
            keyList.Add("V");
            keyList.Add("W");
            keyList.Add("X");
            keyList.Add("Y");
            keyList.Add("Z");

            foreach (string value in keyList)
            {
                this.cmbResetKey.Items.Add(value);
                this.comboNextBuzzShortcutKey.Items.Add(value);
                this.cmbCountdownShortcutKey.Items.Add(value);
                this.cmbLightcheckShortcutKey.Items.Add(value);
                this.cmbPreviousBuzzShortcutKey.Items.Add(value);
            }

            for (int i = 0; i < this.cmbResetKey.Items.Count; i++)
            {
                if (this.cmbResetKey.Items[i].ToString().Equals(this.settings.ResetShortcutKey))
                {
                    this.cmbResetKey.SelectedIndex = i;
                    break;
                }
            }

            for (int i = 0; i < this.comboNextBuzzShortcutKey.Items.Count; i++)
            {
                if (this.comboNextBuzzShortcutKey.Items[i].ToString().Equals(this.settings.NextBuzzShortcutKey))
                {
                    this.comboNextBuzzShortcutKey.SelectedIndex = i;
                    break;
                }
            }

            for (int i = 0; i < this.cmbCountdownShortcutKey.Items.Count; i++)
            {
                if (this.cmbCountdownShortcutKey.Items[i].ToString().Equals(this.settings.CountdownShortcutKey))
                {
                    this.cmbCountdownShortcutKey.SelectedIndex = i;
                    break;
                }
            }

            for (int i = 0; i < this.cmbLightcheckShortcutKey.Items.Count; i++)
            {
                if (this.cmbLightcheckShortcutKey.Items[i].ToString().Equals(this.settings.LightCheckShortcutKey))
                {
                    this.cmbLightcheckShortcutKey.SelectedIndex = i;
                    break;
                }
            }

            for (int i = 0; i < this.cmbPreviousBuzzShortcutKey.Items.Count; i++)
            {
                if (this.cmbPreviousBuzzShortcutKey.Items[i].ToString().Equals(this.settings.PreviousBuzzShortcutKey))
                {
                    this.cmbPreviousBuzzShortcutKey.SelectedIndex = i;
                    break;
                }
            }

            this.chkResetShift.Checked           = this.settings.ResetShortcutShift;
            this.chkResetControl.Checked         = this.settings.ResetShortcutControl;
            this.chkNextBuzzShift.Checked        = this.settings.NextBuzzShortcutShift;
            this.chkNextBuzzControl.Checked      = this.settings.NextBuzzShortcutControl;
            this.chkCountdownShift.Checked       = this.settings.CountdownShortcutShift;
            this.chkCountdownControl.Checked     = this.settings.CountdownShortcutControl;
            this.chkLightCheckShift.Checked      = this.settings.LightCheckShortcutShift;
            this.chkLightCheckControl.Checked    = this.settings.LightCheckShortcutControl;
            this.chkPreviousBuzzShift.Checked    = this.settings.PreviousBuzzShortcutShift;
            this.chkPreviousBuzzControl.Checked  = this.settings.PreviousBuzzShortcutControl;
            this.chkBuzzerCancel.Checked         = this.settings.AllowBuzzerCancels;
            this.chkShowInTaskbar.Checked        = this.settings.ShowInTaskBar;
            this.chkFirstPlayerCanCancel.Enabled = this.settings.AllowBuzzerCancels;
            this.chkFirstPlayerCanCancel.Checked = this.settings.FirstPlayerCanCancel;
            this.chkQuitPrompt.Checked           = this.settings.QuitPrompt;
            this.chkBlink.Checked       = this.settings.Blink;
            this.chkAlwaysOnTop.Checked = this.settings.AlwaysOnTop;

            this.txtCountdownLength.Text = this.settings.CountdownLengthInSeconds.ToString();

            this.cmbSound.Items.Clear();
            for (int i = 1; i <= 8; i++)
            {
                this.cmbSound.Items.Add("beep" + i + ".wav");
            }

            this.cmbBuzzerGroup.Items.Clear();
            for (int i = 1; i <= 8; i++)
            {
                this.cmbBuzzerGroup.Items.Add(i);
            }

            this.cmbBuzzerGroup.SelectedIndex = 0;
            this.soundPlayer = new SoundPlayer();
        }
示例#6
0
 private void OnSettingsChanged(object sender, SettingsCallbackEventArgs args)
 {
     this.isModalDialogOpen = false;
     this.settings          = args.ModifiedSettings;
     this.ApplySettings();
 }