コード例 #1
0
        void RefreshWaveCombo()
        {
            WaveFileInfo previouslySelected = (comboBoxWave.SelectedItem as WaveFileInfo);

            SkipFlaggedEventHandlers = true;
            Enabled = false;
            comboBoxWave.DataSource = null;
            comboBoxWave.DataSource = WaveFilePool.GetAvailableWaves();
            Enabled = true;

            object matchToPreviouslySelected = null;

            foreach (var item in comboBoxWave.Items)
            {
                if ((item as WaveFileInfo).ValueEquals(previouslySelected))
                {
                    matchToPreviouslySelected = item;
                }
            }

            object matchToCurrentWave = null;

            foreach (var item in comboBoxWave.Items)
            {
                if ((item as WaveFileInfo).ValueEquals(TheWave?.Wave))
                {
                    matchToCurrentWave = item;
                }
            }

            if (matchToPreviouslySelected != null)
            {
                comboBoxWave.SelectedItem = matchToPreviouslySelected;
            }
            else if (matchToCurrentWave != null)
            {
                comboBoxWave.SelectedItem = matchToCurrentWave;
            }
            else if (previouslySelected != null)
            {
                TheWave.SetWave(previouslySelected);
            }
            SkipFlaggedEventHandlers = false;

            CheckNoWaveState();
        }
コード例 #2
0
        public WaveEditor()
        {
            InitializeComponent();

            if (!FormMain.RunFromDesigner)
            {
                comboBoxWave.DataSource = WaveFilePool.GetAvailableWaves();
                TTip.SetToolTip(pictureBoxRefresh, $"Refresh available sounds." + Environment.NewLine +
                                $"Put your custom sound files ({WaveFilePool.WaveFileExtension}) in: \"{WaveFilePool.WaveFolder}\"");
                TTip.SetToolTip(pictureBoxAddWaves, $"Open Windows explorer to manage your custom sounds ({WaveFilePool.WaveFileExtension}).");
                TTip.SetToolTip(labelNoWaves, $"Please add sound files ({WaveFilePool.WaveFileExtension}) to \"{WaveFilePool.WaveFolder}\" and click the refresh button.");
                TTip.SetToolTip(comboBoxWave, $"Select the sound file to play. Due to audio implementation, only the first 5 seconds of the wave will be played.");
                TTip.SetToolTip(numericUpDownLoop, $"Loop count. How many times the sound is played in succession per single trigger. Max=9.");
                TTip.SetToolTip(trackBarPan, $"Mouse middle button = center");

                InitializeAppearance();
            }

            AddEventHandlers();
        }