Пример #1
0
        private void newToolStripMenuItem2_Click(object sender, EventArgs e)
        {
            WindowsAliasChooser wac = new WindowsAliasChooser();

            if (wac.ShowDialog(this) == DialogResult.OK)
            {
                Config.WindowsAlias wa = new Config.WindowsAlias();
                wa.enabled             = false;
                wa.ID                  = cfg.NextID();
                wa.name                = wac.Alias;
                wa.command             = wac.Command;
                wa.args_pattern        = wac.Args;
                wa.working_dir         = wac.WorkingDir;
                wa.hidden              = wac.Hidden;
                wa.target_hidden       = wac.TargetHidden;
                wa.open_console        = wac.Console;
                wa.target_open_console = wac.TargetConsole;
                wa.admin               = wac.Admin;
                cfg.windows_aliases.Add(wa);

                _saveConfig();
                _updateLists();
                _updateAliases();
            }
        }
Пример #2
0
        private void editToolStripMenuItem2_Click(object sender, EventArgs e)
        {
            if (windowsListView.FocusedItem == null)
            {
                return;
            }
            Config.WindowsAlias wa = cfg.GetWindowsAlias((int)windowsListView.FocusedItem.Tag);
            if (wa == null)
            {
                return;
            }
            WindowsAliasChooser wac = new WindowsAliasChooser(wa);

            if (wac.ShowDialog(this) == DialogResult.OK)
            {
                // We must delete the alias involved, however it will not be updated
                string filename = Path.Combine(aliases_location, _normalizeAliasName(wa.name));
                try { File.Delete(filename); } catch { }

                wa.name                = wac.Alias;
                wa.command             = wac.Command;
                wa.args_pattern        = wac.Args;
                wa.working_dir         = wac.WorkingDir;
                wa.hidden              = wac.Hidden;
                wa.target_hidden       = wac.TargetHidden;
                wa.open_console        = wac.Console;
                wa.target_open_console = wac.TargetConsole;
                wa.admin               = wac.Admin;

                // We must delete the alias involved, however it will not be updated
                filename = Path.Combine(aliases_location, _normalizeAliasName(wa.name));
                try { File.Delete(filename); } catch { }

                _saveConfig();
                _updateLists();
                _updateAliases();
            }
        }