Exemple #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();
                        }
                    }
                }
            }
        }
        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();
                        }
                    }
                }
            }
        }
        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();
                        }
                    }
                }
            }
        }
Exemple #4
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();
                        }
                    }
                }
            }
        }