Ejemplo n.º 1
0
        private void openControlButton_Click(object sender, EventArgs e)
        {
            // Confirm action.
            if (_recorder.CurrentMacro != null && _recorder.CurrentMacro.Events.Length > 0)
            {
                var result = MessageBox.Show(_languages.GetLocalizedString("confirm_open_message"),
                                             _languages.GetLocalizedString("confirm_clear_title"), MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (result == DialogResult.No)
                {
                    return;
                }
            }

            // Browse for file
            var dialog = new OpenFileDialog
            {
                Title  = _languages.GetLocalizedString("dialog_open_macro_title"),
                Filter = _languages.GetLocalizedString("dialog_open_macro_filter")
            };

            // Load macro into recorder.
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                var loadedMacro = new Macro.Macro();
                loadedMacro.Load(dialog.FileName);
                _recorder.LoadMacro(loadedMacro);
            }
        }
Ejemplo n.º 2
0
        private void LoadBtn_Click(object sender, EventArgs e)
        {
            if (_recorder.CurrentMacro != null && _recorder.CurrentMacro.Events.Length > 0)
            {
                var result = MessageBox.Show(this, "Are you sure you want to load this file and overwrite the currently recorded macro?",
                                             "Clear Macro?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

                if (result == DialogResult.No)
                {
                    return;
                }
            }

            var dialog = new OpenFileDialog
            {
                Title  = "Open Macro",
                Filter = "Jacobs Macro Files (*.hush)|*.hush|All Files (*.*)|*.*"
            };

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                var loadedMacro = new Silence.Macro.Macro();
                loadedMacro.Load(dialog.FileName);
                _recorder.LoadMacro(loadedMacro);
                StatusLabel.Text = "Status: Macro loaded";
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Loads a macro into the player.
 /// </summary>
 /// <param name="macro">The macro to load into the player.</param>
 public void LoadMacro(Macro macro)
 {
     CurrentMacro = macro;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Clears the current macro from the macro recorder.
 /// </summary>
 public void Clear()
 {
     CurrentMacro = new Macro();
 }