Пример #1
0
        private void _customizeProcessMenuItem_Click(object sender, EventArgs e)
        {
            using (SelectProcess selectProc = new SelectProcess())
            {
                if (DialogResult.OK == selectProc.ShowDialog())
                {
                    foreach (ListViewItem item in _reservedProcessListView.Items)
                    {
                        if (string.Equals(item.Text, selectProc.ProcessName, StringComparison.InvariantCultureIgnoreCase))
                        {
                            MessageBox.Show("Sepcified process already exists.", "Process Exists", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1);
                            return;
                        }
                    }
                    AppSwitchProcessSettings settings = new AppSwitchProcessSettings();
                    settings.Load(string.Format(@"{0}\{1}\{2}\{3}", GScrollRegistry.GScrollKey, GScrollRegistry.AppSwitchKey, GScrollRegistry.AppSwitch_ProcessKey, selectProc.ProcessName), true);

                    using (GeneralSettingsHost host = new GeneralSettingsHost())
                    {
                        if (DialogResult.OK == host.ShowDialog(string.Format("Settings for {0}", selectProc.ProcessName), settings))
                        {
                            ListViewItem newItem = new ListViewItem(new string[] { selectProc.ProcessName, settings.Ignore.ToString(), settings.CanClose.ToString(), settings.CanMinimize.ToString() });
                            newItem.Tag = settings;

                            _reservedProcessListView.Items.Add(newItem);
                        }
                        else
                        {
                            settings.Dispose();
                        }
                    }
                }
            }
        }
Пример #2
0
        private void _editProcessMenuItem_Click(object sender, EventArgs e)
        {
            if (_perProcessListView.SelectedIndices.Count > 0)
            {
                ListViewItem item = _perProcessListView.Items[_perProcessListView.SelectedIndices[0]];
                // show a dialog here to create

                GeneralSettings customSettings = null;

                if (null != item.Tag)
                {
                    customSettings = item.Tag as GeneralSettings;
                }
                else
                {
                    customSettings = new GeneralSettings();
                    customSettings.Load(string.Format(@"{0}\{1}\{2}", GScrollRegistry.GScrollKey, GScrollRegistry.PerProcessKey, item.Text), false);
                    item.Tag = customSettings;
                }

                using (GeneralSettingsHost host = new GeneralSettingsHost())
                {
                    host.ShowDialog(string.Format("Settings for {0}", item.Text), customSettings);
                }
            }
        }
Пример #3
0
        private void _editProcessMenuItem_Click(object sender, EventArgs e)
        {
            if (_reservedProcessListView.SelectedIndices.Count > 0)
            {
                ListViewItem             item     = _reservedProcessListView.Items[_reservedProcessListView.SelectedIndices[0]];
                AppSwitchProcessSettings settings = item.Tag as AppSwitchProcessSettings;

                using (GeneralSettingsHost host = new GeneralSettingsHost())
                {
                    host.ShowDialog(string.Format("Settings for {0}", item.Text), settings);
                    item.SubItems[1].Text = settings.Ignore.ToString();
                    item.SubItems[2].Text = settings.CanClose.ToString();
                    item.SubItems[3].Text = settings.CanMinimize.ToString();
                }
            }
        }
Пример #4
0
        private void _customizeProcessMenuItem_Click(object sender, EventArgs e)
        {
            using (SelectProcess selectProc = new SelectProcess())
            {
                if (DialogResult.OK == selectProc.ShowDialog())
                {
                    foreach (ListViewItem item in _perProcessListView.Items)
                    {
                        if (string.Equals(item.Text, selectProc.ProcessName, StringComparison.InvariantCultureIgnoreCase))
                        {
                            MessageBox.Show("Sepcified process already exists.", "Process Exists", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1);
                            return;
                        }
                    }

                    GeneralSettings customSettings = new GeneralSettings();
                    customSettings.Load(string.Format(@"{0}\{1}\{2}", GScrollRegistry.GScrollKey, GScrollRegistry.PerProcessKey, selectProc.ProcessName), true);

                    using (GeneralSettingsHost host = new GeneralSettingsHost())
                    {
                        if (DialogResult.OK == host.ShowDialog(string.Format("Settings for {0}", selectProc.ProcessName), customSettings))
                        {
                            // add the list item here
                            ListViewItem item = new ListViewItem(selectProc.ProcessName);
                            item.Tag = customSettings;

                            _perProcessListView.Items.Add(item);
                        }
                        else
                        {
                            customSettings.Dispose();
                        }
                    }
                }
            }
        }
Пример #5
0
        private void _customizeProcessMenuItem_Click(object sender, EventArgs e)
        {
            using (SelectProcess selectProc = new SelectProcess())
            {
                if (DialogResult.OK == selectProc.ShowDialog())
                {
                    foreach (ListViewItem item in _perProcessListView.Items)
                    {
                        if (string.Equals(item.Text, selectProc.ProcessName, StringComparison.InvariantCultureIgnoreCase))
                        {
                            MessageBox.Show("Sepcified process already exists.", "Process Exists", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1);
                            return;
                        }
                    }

                    GeneralSettings customSettings = new GeneralSettings();
                    customSettings.Load(string.Format(@"{0}\{1}\{2}", GScrollRegistry.GScrollKey, GScrollRegistry.PerProcessKey, selectProc.ProcessName), true);

                    using (GeneralSettingsHost host = new GeneralSettingsHost())
                    {
                        if (DialogResult.OK == host.ShowDialog(string.Format("Settings for {0}", selectProc.ProcessName), customSettings))
                        {
                            // add the list item here
                            ListViewItem item = new ListViewItem(selectProc.ProcessName);
                            item.Tag = customSettings;

                            _perProcessListView.Items.Add(item);
                        }
                        else
                        {
                            customSettings.Dispose();
                        }
                    }
                }
            }
        }
Пример #6
0
        private void _editProcessMenuItem_Click(object sender, EventArgs e)
        {
            if (_perProcessListView.SelectedIndices.Count > 0)
            {
                ListViewItem item = _perProcessListView.Items[_perProcessListView.SelectedIndices[0]];
                // show a dialog here to create

                GeneralSettings customSettings = null;

                if (null != item.Tag)
                {
                    customSettings = item.Tag as GeneralSettings;
                }
                else
                {
                    customSettings = new GeneralSettings();
                    customSettings.Load(string.Format(@"{0}\{1}\{2}", GScrollRegistry.GScrollKey, GScrollRegistry.PerProcessKey, item.Text), false);
                    item.Tag = customSettings;
                }

                using (GeneralSettingsHost host = new GeneralSettingsHost())
                {
                    host.ShowDialog(string.Format("Settings for {0}", item.Text), customSettings);
                }
            }
        }
Пример #7
0
        private void _customizeProcessMenuItem_Click(object sender, EventArgs e)
        {
            using (SelectProcess selectProc = new SelectProcess())
            {
                if (DialogResult.OK == selectProc.ShowDialog())
                {
                    foreach (ListViewItem item in _reservedProcessListView.Items)
                    {
                        if (string.Equals(item.Text, selectProc.ProcessName, StringComparison.InvariantCultureIgnoreCase))
                        {
                            MessageBox.Show("Sepcified process already exists.", "Process Exists", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1);
                            return;
                        }
                    }
                    AppSwitchProcessSettings settings = new AppSwitchProcessSettings();
                    settings.Load(string.Format(@"{0}\{1}\{2}\{3}", GScrollRegistry.GScrollKey, GScrollRegistry.AppSwitchKey, GScrollRegistry.AppSwitch_ProcessKey, selectProc.ProcessName), true);

                    using (GeneralSettingsHost host = new GeneralSettingsHost())
                    {
                        if (DialogResult.OK == host.ShowDialog(string.Format("Settings for {0}", selectProc.ProcessName), settings))
                        {
                            ListViewItem newItem = new ListViewItem(new string[] { selectProc.ProcessName, settings.Ignore.ToString(), settings.CanClose.ToString(), settings.CanMinimize.ToString() });
                            newItem.Tag = settings;

                            _reservedProcessListView.Items.Add(newItem);
                        }
                        else
                        {
                            settings.Dispose();
                        }
                    }
                }
            }
        }
Пример #8
0
        private void _editProcessMenuItem_Click(object sender, EventArgs e)
        {
            if (_reservedProcessListView.SelectedIndices.Count > 0)
            {
                ListViewItem item = _reservedProcessListView.Items[_reservedProcessListView.SelectedIndices[0]];
                AppSwitchProcessSettings settings = item.Tag as AppSwitchProcessSettings;

                using (GeneralSettingsHost host = new GeneralSettingsHost())
                {
                    host.ShowDialog(string.Format("Settings for {0}", item.Text), settings);
                    item.SubItems[1].Text = settings.Ignore.ToString();
                    item.SubItems[2].Text = settings.CanClose.ToString();
                    item.SubItems[3].Text = settings.CanMinimize.ToString();
                }
            }
        }