Esempio n. 1
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            if (Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName).Length > 1)
            {
                MessageBox.Show("A instance of SoundInvoker are running", "SoundInvoker", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Close();
                return;
            }
            INSTANCE  = this;
            audioITEM = Extensions.Load();
            for (int i = 0; i < audioITEM.Count; i++)
            {
                AudioControl control = new AudioControl();
                control.SetAudio(audioITEM[i]);
                flowLayoutPanel.Controls.Add(control);
            }
            optionsUI = new OptionsUI
            {
                options = Extensions.LoadOptions()
            };
            account       = Extensions.LoadAccount();
            twitchOptions = new TwitchOptions();
            if (account.auto_login)
            {
                TwitchLogin();
            }

            splayer = new SoundPlayer(optionsUI.options.max_cache);

            listener          = new KeyboardListener();
            listener.KeyDown += Listener_KeyDown;
            listener.KeyUp   += Listener_KeyUp;
        }
Esempio n. 2
0
 public AudioControl()
 {
     InitializeComponent();
     INSTANCE = this;
     item     = new SoundItem();
     inKeySet = false;
 }
Esempio n. 3
0
        private void DeleteButton_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Do you want remove this item?", "ITEM", MessageBoxButtons.YesNo);

            if (result == DialogResult.Yes)
            {
                INSTANCE = null;
                MainForm.INSTANCE.DeleteControl(this);
                this.Dispose();
            }
        }
Esempio n. 4
0
        private void SaveButton_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(item.key1) || string.IsNullOrEmpty(item.key2))
            {
                MessageBox.Show("Key binding needed.", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (string.IsNullOrEmpty(item.path))
            {
                MessageBox.Show("Sound needed, please add a sound.", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (cmdName.Text[0] != '!')
            {
                MessageBox.Show("Command need '!' symbol.", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            SetEnable(false);
            item.cmd = cmdName.Text;

            MainForm.INSTANCE.SaveItem(item);
            INSTANCE = null;
        }