Пример #1
0
        public EditProgramForm(ProgramSettings progSettings)
        {
            InitializeComponent();

            comboBoxWindowStyle.Items.AddRange(Enum.GetNames(typeof(ProcessWindowStyle)));

            if (progSettings != null)
            {
                DisplayName      = progSettings.Name;
                Filename         = progSettings.FileName;
                StartupFolder    = progSettings.Folder;
                Parameters       = progSettings.Arguments;
                StartState       = progSettings.WindowState;
                UseShellExecute  = progSettings.UseShellExecute;
                ForceWindowFocus = progSettings.ForceWindowFocus;
                IgnoreSystemWide = progSettings.IgnoreSystemWide;
            }
        }
Пример #2
0
    private bool EditProgram(ProgramSettings progSettings)
    {
      EditProgramForm editProg = new EditProgramForm(progSettings);

      if (editProg.ShowDialog(this) == DialogResult.OK)
      {
        progSettings.Name = editProg.DisplayName;
        progSettings.FileName = editProg.Filename;
        progSettings.Folder = editProg.StartupFolder;
        progSettings.Arguments = editProg.Parameters;
        progSettings.WindowState = editProg.StartState;
        progSettings.UseShellExecute = editProg.UseShellExecute;
        progSettings.IgnoreSystemWide = editProg.IgnoreSystemWide;

        Program.UpdateNotifyMenu();
        return true;
      }

      return false;
    }
Пример #3
0
    private void AddProgram()
    {
      ProgramSettings progSettings = new ProgramSettings();

      if (EditProgram(progSettings))
      {
        Program.Config.Programs.Add(progSettings);

        RefreshProgramList();

        // TODO: Detect and offer preconfigured settings ...
        /*
        string programFile = Path.GetFileName(progSettings.FileName);
        string settingsFile = Path.Combine(Program.FolderDefaultSettings, programFile + ".xml");
        if (File.Exists(settingsFile))
        {
          if (MessageBox.Show(this, String.Format("Do you want to use the default settings for {0} ({1})?", progSettings.Name, programFile), "Default settings available", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
          {
            AppProfile appProfile = LoadDefaultSettings(settingsFile);

            if (appProfile != null)
            {
              progSettings.ButtonMappings.AddRange(appProfile.ButtonMappings);

              RefreshButtonList();
            }
          }
        }
        */
      }
    }
Пример #4
0
        private void AddProgram(object sender, EventArgs e)
        {
            ProgramSettings progSettings = new ProgramSettings();

            if (EditProgram(progSettings))
            {
                Program.Config.Programs.Add(progSettings);

                RefreshProgramList();
            }
        }
    public EditProgramForm(ProgramSettings progSettings)
    {
      InitializeComponent();

      comboBoxWindowStyle.Items.AddRange(Enum.GetNames(typeof (ProcessWindowStyle)));

      if (progSettings != null)
      {
        DisplayName = progSettings.Name;
        Filename = progSettings.FileName;
        StartupFolder = progSettings.Folder;
        Parameters = progSettings.Arguments;
        StartState = progSettings.WindowState;
        UseShellExecute = progSettings.UseShellExecute;
        ForceWindowFocus = progSettings.ForceWindowFocus;
        IgnoreSystemWide = progSettings.IgnoreSystemWide;
      }
    }