Exemplo n.º 1
0
        private void checkBoxUseExecutable_CheckedChanged(object sender, EventArgs e)
        {
            SettingsApplication app = listViewApplications.SelectedItem as SettingsApplication;

            if (app == null)
            {
                return;
            }

            app.UseExecutable = checkBoxUseExecutable.Checked;
        }
Exemplo n.º 2
0
        private void textBoxWindowTitle_TextChanged(object sender, EventArgs e)
        {
            SettingsApplication app = listViewApplications.SelectedItem as SettingsApplication;

            if (app == null)
            {
                return;
            }

            app.WindowTitle = textBoxWindowTitle.Text;
        }
Exemplo n.º 3
0
        private void buttonRemove_Click(object sender, EventArgs e)
        {
            SettingsApplication app = listViewApplications.SelectedItem as SettingsApplication;

            if (app == null)
            {
                return;
            }
            Settings.Current.Applications.Remove(app);
            RefreshApplicationsList();
        }
Exemplo n.º 4
0
        private void listViewApplications_SelectedIndexChanged(object sender, EventArgs e)
        {
            SettingsApplication app = listViewApplications.SelectedItem as SettingsApplication;

            if (app == null)
            {
                buttonRemove.Enabled           = false;
                textBoxApplicationName.Text    = "";
                textBoxApplicationName.Enabled = false;
                textBoxWindowTitle.Text        = "";
                textBoxWindowTitle.Enabled     = false;
                checkBoxUseWindowTitle.Checked = false;
                checkBoxUseWindowTitle.Enabled = false;
                textBoxExecutable.Text         = "";
                textBoxExecutable.Enabled      = false;
                checkBoxUseExecutable.Checked  = false;
                checkBoxUseExecutable.Enabled  = false;
                buttonBrowse.Enabled           = false;
                //labelFindFromWindow.Enabled = false;
            }
            else if (app.Name == "Default")
            {
                buttonRemove.Enabled           = false;
                textBoxApplicationName.Text    = "Default";
                textBoxApplicationName.Enabled = false;
                textBoxWindowTitle.Text        = "";
                textBoxWindowTitle.Enabled     = false;
                checkBoxUseWindowTitle.Checked = false;
                checkBoxUseWindowTitle.Enabled = false;
                textBoxExecutable.Text         = "";
                textBoxExecutable.Enabled      = false;
                checkBoxUseExecutable.Checked  = false;
                checkBoxUseExecutable.Enabled  = false;
                buttonBrowse.Enabled           = false;
                //labelFindFromWindow.Enabled = false;
            }
            else
            {
                buttonRemove.Enabled           = true;
                textBoxApplicationName.Text    = app.Name;
                textBoxApplicationName.Enabled = true;
                textBoxWindowTitle.Text        = app.WindowTitle;
                textBoxWindowTitle.Enabled     = true;
                checkBoxUseWindowTitle.Checked = app.UseWindowTitle;
                checkBoxUseWindowTitle.Enabled = true;
                textBoxExecutable.Text         = app.Executable;
                textBoxExecutable.Enabled      = true;
                checkBoxUseExecutable.Checked  = app.UseExecutable;
                checkBoxUseExecutable.Enabled  = true;
                buttonBrowse.Enabled           = true;
                //labelFindFromWindow.Enabled = true;
            }
        }
Exemplo n.º 5
0
        private void labelFindFromWindow_MouseUp(object sender, MouseEventArgs e)
        {
            _findFromWindowActive = false;

            if (_findFromWindowValid == false)
            {
                SettingsApplication app = listViewApplications.SelectedItem as SettingsApplication;
                if (app != null)
                {
                    Settings.Current.Applications.Remove(app);
                }
            }

            RefreshApplicationsList();
        }
Exemplo n.º 6
0
        private void labelFindFromWindow_MouseDown(object sender, MouseEventArgs e)
        {
            _findFromWindowActive = true;

            SettingsApplication app = new SettingsApplication();

            app.Name = "Find Window";
            Settings.Current.Applications.Add(app);
            RefreshApplicationsList();
            listViewApplications.SelectedIndices.Clear();
            listViewApplications.SelectedIndices.Add(listViewApplications.Items.Count - 1);

            _findFromWindowOriginalName       = textBoxApplicationName.Text;
            _findFromWindowOriginalExecutable = textBoxExecutable.Text;
        }
Exemplo n.º 7
0
        private void SetExecutable(string executable)
        {
            int imageIndex = _imageList.GetExecutableIndex(executable);

            if (imageIndex > 1)
            {
                _imageList.AddImage(System.IO.Path.GetFileName(executable), imageListApplicationIcons.Images[imageIndex]);
            }

            textBoxExecutable.Text = System.IO.Path.GetFileName(executable);
            SettingsApplication newApplication = new SettingsApplication();

            if ((textBoxApplicationName.Text.Length == 0) || (textBoxApplicationName.Text == newApplication.Name))
            {
                textBoxApplicationName.Text = System.IO.Path.GetFileNameWithoutExtension(executable);
            }
            RefreshApplicationsList();
        }
Exemplo n.º 8
0
        private void RefreshApplicationsList()
        {
            int selectedIndex = -1;

            if (listViewApplications.SelectedIndices.Count > 0)
            {
                selectedIndex = listViewApplications.SelectedIndices[0];
            }

            listViewApplications.DataSource = null;
            listViewApplications.DataSource = Settings.Current.Applications;

            foreach (ListViewItem item in listViewApplications.Items)
            {
                SettingsApplication application = item.Tag as SettingsApplication;
                if (application.Name == "Default")
                {
                    item.ImageIndex = 0;
                }
                else
                {
                    if (application.ExecutableImage.Image != null)
                    {
                        _imageList.AddImage(application.Executable, application.ExecutableImage.Image);
                    }
                    item.ImageIndex = _imageList.GetExecutableIndex(application.Executable);
                }
            }

            if (selectedIndex >= listViewApplications.Items.Count)
            {
                selectedIndex = listViewApplications.Items.Count - 1;
            }
            if (selectedIndex >= 0)
            {
                listViewApplications.SelectedIndices.Clear();
                listViewApplications.SelectedIndices.Add(selectedIndex);
            }
        }
Exemplo n.º 9
0
        private void textBoxExecutable_TextChanged(object sender, EventArgs e)
        {
            SettingsApplication app = listViewApplications.SelectedItem as SettingsApplication;

            if (app == null)
            {
                return;
            }

            app.Executable = textBoxExecutable.Text;

            int imageIndex = _imageList.GetExecutableIndex(textBoxExecutable.Text);

            if (imageIndex <= 1)
            {
                pictureBoxExeIcon.Image = null;
            }
            else
            {
                pictureBoxExeIcon.Image   = imageListApplicationIcons.Images[imageIndex];
                app.ExecutableImage.Image = imageListApplicationIcons.Images[imageIndex];
            }
        }
Exemplo n.º 10
0
 private void buttonCancel_Click(object sender, EventArgs e)
 {
     _selectedApplication = null;
     Settings.RevertToSaved();
 }
Exemplo n.º 11
0
 private void buttonOK_Click(object sender, EventArgs e)
 {
     _selectedApplication = listViewApplications.SelectedItem as SettingsApplication;
     Settings.Save();
 }