Exemple #1
0
 private void OkButtonClick(object sender, RoutedEventArgs e)
 {
     if (OkClick != null)
     {
         OkClick.Invoke(this, EventArgs.Empty);
     }
 }
 /// <summary>
 /// Button_Click_Ok
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Button_Click_Ok(object sender, RoutedEventArgs e)
 {
     OFDWReturnCode = OpenFileDlgWindowReturnCode.Ok;
     OkClick?.Invoke(null, null);
     Hide();
     SaveFileList();
 }
 private void btnOk_Click(object sender, EventArgs e)
 {
     try
     {
         OkClick?.Invoke(this);
     }
     catch (Exception)
     {
     }
 }
Exemple #4
0
        private void ButtonApplyClick(object sender, EventArgs e)
        {
            var settings = new SmartSystemMenuSettings();

            foreach (DataGridViewRow row in gvProcessExclusions.Rows)
            {
                settings.ProcessExclusions.Add(row.Cells[0].Value.ToString());
            }

            foreach (DataGridViewRow row in gvStartProgram.Rows)
            {
                settings.MenuItems.StartProgramItems.Add(new StartProgramMenuItem {
                    Title = row.Cells[0].Value.ToString(), FileName = row.Cells[1].Value.ToString(), Arguments = row.Cells[2].Value.ToString()
                });
            }

            foreach (DataGridViewRow row in gvHotkeys.Rows.OfType <DataGridViewRow>().Where(x => x.Tag is Settings.MenuItem))
            {
                var menuItem = (Settings.MenuItem)row.Tag;
                settings.MenuItems.Items.Add(menuItem);
            }

            settings.LanguageName = cmbLanguage.SelectedValue == null ? "" : cmbLanguage.SelectedValue.ToString();

            if (!settings.Equals(_settings))
            {
                MessageBox.Show(_settings.LanguageSettings.GetValue("message_box_attention_content"), _settings.LanguageSettings.GetValue("message_box_attention_title"), MessageBoxButtons.OK);

                try
                {
                    settings.LanguageSettings = _settings.LanguageSettings;

                    var settingsFileName = Path.Combine(AssemblyUtils.AssemblyDirectory, "SmartSystemMenu.xml");
                    SmartSystemMenuSettings.Save(settingsFileName, settings);
                    if (OkClick != null)
                    {
                        OkClick.Invoke(this, new SmartSystemMenuSettingsEventArgs(settings));
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Failed to save the settings." + Environment.NewLine + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }

            Close();
        }
Exemple #5
0
        public SwitchIconSelect(ScenarioModel scenarioModel, bool isSecondIcon)
        {
            InitializeComponent();
            var iconsControls = Enum.GetNames(typeof(Icon))
                                .OrderBy(x => x)
                                .Select(x => new SwitchIconModel(scenarioModel, isSecondIcon)
            {
                Icon = x
            })
                                .Select(x =>
            {
                var control         = Resolve(x.Icon);
                control.DataContext = x;
                control.Margin      = new Thickness(1, 1, 0, 0);
                control.Selected    = () => OkClick?.Invoke(this, new RoutedEventArgs());
                return(control);
            });

            int odd = 0;

            foreach (var control in iconsControls)
            {
                var sp = stackPanel1;
                if (odd == 1)
                {
                    sp = stackPanel2;
                }
                else if (odd == 2)
                {
                    sp = stackPanel3;
                }
                sp.Children.Add(control);
                odd++;
                if (odd == 3)
                {
                    odd = 0;
                }
            }

            tbSearch.Text = LastSearch;
        }
        private void ButtonApplyClick(object sender, EventArgs e)
        {
            var settings = new SmartSystemMenuSettings();

            foreach (DataGridViewRow row in gvProcessExclusions.Rows)
            {
                settings.ProcessExclusions.Add(row.Cells[0].Value.ToString());
            }

            foreach (DataGridViewRow row in gvStartProgram.Rows)
            {
                settings.MenuItems.StartProgramItems.Add(new StartProgramItem {
                    Title = row.Cells[0].Value.ToString(), FileName = row.Cells[1].Value.ToString(), Arguments = row.Cells[2].Value.ToString()
                });
            }

            if (!settings.Equals(_settings))
            {
                MessageBox.Show("You should restart the application manually to apply the settings.", "Attention", MessageBoxButtons.OK);

                try
                {
                    var settingsFileName = Path.Combine(AssemblyUtils.AssemblyDirectory, "SmartSystemMenu.xml");
                    SmartSystemMenuSettings.Save(settingsFileName, settings);
                    if (OkClick != null)
                    {
                        OkClick.Invoke(this, new SmartSystemMenuSettingsEventArgs(settings));
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Failed to save the settings." + Environment.NewLine + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }

            Close();
        }
Exemple #7
0
 private void OkButtonClickHandler(object sender, RoutedEventArgs e)
 {
     deckChooserFlyout.Hide();
     OkClick?.Invoke(sender, e);
 }
 private void btnOk_Click(object sender, EventArgs e)
 {
     btnOk.Enabled = gr1.Enabled = gr2.Enabled = gr3.Enabled = false;
     OkClick?.Invoke(sender, e);
 }
 private void Ok_Click(object sender, RoutedEventArgs e)
 {
     OkClick?.Invoke(sender, e);
 }
 void propertyGrid_OkClick(object sender, EventArgs e)
 {
     OkClick?.Invoke(this, e);
 }
Exemple #11
0
        private void ButtonApplyClick(object sender, EventArgs e)
        {
            var settings = new SmartSystemMenuSettings();

            foreach (DataGridViewRow row in gvProcessExclusions.Rows)
            {
                settings.ProcessExclusions.Add(row.Cells[0].Value.ToString());
            }

            foreach (DataGridViewRow row in gvWindowSize.Rows)
            {
                if (row.Tag is WindowSizeMenuItem item)
                {
                    settings.MenuItems.WindowSizeItems.Add(new WindowSizeMenuItem
                    {
                        Title  = item.Title,
                        Left   = item.Left,
                        Top    = item.Top,
                        Width  = item.Width,
                        Height = item.Height,
                        Key1   = item.Key1,
                        Key2   = item.Key2,
                        Key3   = item.Key3
                    });
                }
            }

            foreach (DataGridViewRow row in gvStartProgram.Rows)
            {
                settings.MenuItems.StartProgramItems.Add((StartProgramMenuItem)row.Tag);
            }

            settings.MenuItems.Items                        = (IList <Settings.MenuItem>)gvHotkeys.Tag;
            settings.Closer.Key1                            = _closerSettings.Key1;
            settings.Closer.Key2                            = _closerSettings.Key2;
            settings.Closer.MouseButton                     = _closerSettings.MouseButton;
            settings.Closer.Type                            = _closerSettings.Type;
            settings.SaveSelectedItems.AeroGlass            = chkAeroGlass.Checked;
            settings.SaveSelectedItems.AlwaysOnTop          = chkAlwaysOnTop.Checked;
            settings.SaveSelectedItems.HideForAltTab        = chkHideForAltTab.Checked;
            settings.SaveSelectedItems.Alignment            = chkAlignment.Checked;
            settings.SaveSelectedItems.Transparency         = chkTransparency.Checked;
            settings.SaveSelectedItems.Priority             = chkPriority.Checked;
            settings.SaveSelectedItems.MinimizeToTrayAlways = chkMinimizeToTrayAlways.Checked;
            settings.Sizer         = (WindowSizerType)cmbSizer.SelectedIndex;
            settings.EnableHighDPI = chkEnableHighDPI.Checked;
            settings.LanguageName  = cmbLanguage.SelectedValue == null ? "" : cmbLanguage.SelectedValue.ToString();

            if (!settings.Equals(_settings))
            {
                MessageBox.Show(_settings.Language.GetValue("message_box_attention_content"), _settings.Language.GetValue("message_box_attention_title"), MessageBoxButtons.OK);

                try
                {
                    settings.Language = _settings.Language;

                    var settingsFileName = Path.Combine(AssemblyUtils.AssemblyDirectory, "SmartSystemMenu.xml");
                    SmartSystemMenuSettings.Save(settingsFileName, settings);
                    if (OkClick != null)
                    {
                        OkClick.Invoke(this, new SmartSystemMenuSettingsEventArgs(settings));
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Failed to save the settings." + Environment.NewLine + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }

            Close();
        }