示例#1
0
文件: Main.cs 项目: richardj97/Macro
        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";
            }
        }
示例#2
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);
            }
        }
示例#3
0
        private void btnOpenMacro_Click(object sender, EventArgs e)
        {
            // confirm action
            if (_recorder.CurrentMacro != null && _recorder.CurrentMacro.Events.Length > 0)
            {
                var result = MessageBox.Show("Are you sure you want to load this file and overwrite the current macro?", "Clear macro?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (result == DialogResult.No)
                {
                    return;
                }
            }

            // browse for file
            var dialog = new OpenFileDialog
            {
                Title  = "Open Macro",
                Filter = "RabidWombat Macro Files (*.rbwt)|*.rbwt|All Files (*.*)|*.*"
            };

            // load macro into recorder
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                var loadedMacro = new Macro.Macro();
                loadedMacro.Load(dialog.FileName);
                _recorder.LoadMacro(loadedMacro);
            }
        }