private ICommand CreateChangeColorCommand( Func <string> getCurrentColor, Action <string> changeColorAction) => new DelegateCommand(() => { var result = ColorDialogWrapper.ShowDialog(getCurrentColor().FromHTML(), true); if (result.Result) { changeColorAction.Invoke(result.LegacyColor.ToHTML()); } });
private ICommand CreateChangeColorCommand( Func <Color> getCurrentColor, Action <Color> changeColorAction) => new DelegateCommand(() => { var result = ColorDialogWrapper.ShowDialog(getCurrentColor(), true); if (result.Result) { changeColorAction.Invoke(result.Color); } });
public void Execute(object parameter) { var color = (Color)parameter; var result = ColorDialogWrapper.ShowDialog(color); if (result.Result) { this.ChangeColorDelegate?.Invoke(result.Color); this.refreshViewAction?.Invoke(); } }
public void Execute(object parameter) { var range = (ProgressBarColorRange)parameter; var result = ColorDialogWrapper.ShowDialog(range.Color); if (result.Result) { range.Color = result.Color; this.refreshViewAction?.Invoke(); } }
private ICommand CreateChangeAlphaColorCommand( Func <string> getCurrentColor, Func <int> getCurrentAlpha, Action <string, int> changeColorAction) => new DelegateCommand(() => { var baseColor = getCurrentColor().FromHTML(); var color = Color.FromArgb( (byte)getCurrentAlpha(), baseColor.R, baseColor.G, baseColor.B); var result = ColorDialogWrapper.ShowDialog(color, false); if (result.Result) { changeColorAction.Invoke( result.LegacyColor.ToHTML(), (int)result.Color.A); } });
/// <summary> /// オプションのLoad /// </summary> private void LoadOption() { this.LoadSettingsOption(); this.OverlayForceVisibleCheckBox.CheckedChanged += (s1, e1) => { Settings.Default.OverlayForceVisible = this.OverlayForceVisibleCheckBox.Checked; Settings.Default.Save(); }; this.UseOtherThanFFXIVCheckbox.CheckedChanged += (s1, e1) => { if (this.UseOtherThanFFXIVCheckbox.Checked) { this.OverlayForceVisibleCheckBox.Checked = true; this.EnabledPTPlaceholderCheckBox.Checked = false; this.ResetOnWipeOutCheckBox.Checked = false; this.OverlayForceVisibleCheckBox.Enabled = false; this.EnabledPTPlaceholderCheckBox.Enabled = false; this.ResetOnWipeOutCheckBox.Enabled = false; } else { this.OverlayForceVisibleCheckBox.Enabled = true; this.EnabledPTPlaceholderCheckBox.Enabled = true; this.ResetOnWipeOutCheckBox.Enabled = true; } }; this.SwitchOverlayButton.Click += (s1, e1) => { Settings.Default.OverlayVisible = !Settings.Default.OverlayVisible; Settings.Default.Save(); this.LoadSettingsOption(); }; this.SwitchTelopButton.Click += (s1, e1) => { Settings.Default.TelopAlwaysVisible = !Settings.Default.TelopAlwaysVisible; Settings.Default.Save(); this.LoadSettingsOption(); }; this.LanguageComboBox.SelectedValueChanged += (s1, e1) => { Language language = (Language)this.LanguageComboBox.SelectedItem; this.LanguageRestartLabel.Text = Utility.Translate.GetTranslationsFor(language.Value).GetString("RequiresRestart"); Settings.Default.Language = language.Value; Settings.Default.Save(); this.LoadSettingsOption(); }; this.SaveLogCheckBox.CheckedChanged += (s1, e1) => { this.SaveLogTextBox.Enabled = this.SaveLogCheckBox.Checked; this.SaveLogButton.Enabled = this.SaveLogCheckBox.Checked; }; this.SaveLogButton.Click += (s1, e1) => { if (!string.IsNullOrWhiteSpace(this.SaveLogTextBox.Text)) { this.FolderBrowserDialog.SelectedPath = this.SaveLogTextBox.Text; } if (this.FolderBrowserDialog.ShowDialog(this) == DialogResult.OK) { this.SaveLogTextBox.Text = this.FolderBrowserDialog.SelectedPath; } }; Action action = new Action(() => { if (Settings.Default.OverlayVisible) { this.SwitchOverlayButton.Text = Translate.Get("OverlayDisplaySwitchIsOn"); } else { this.SwitchOverlayButton.Text = Translate.Get("OverlayDisplaySwitchIsOff"); } }); this.OptionTabPage.MouseHover += (s1, e1) => action(); this.SwitchOverlayButton.MouseHover += (s1, e1) => action(); #region ProgressBar Background void changeProgressBarBackgroundPanel( bool isFixMode) { this.BarBackgroundBrightnessPanel.Visible = !isFixMode; this.BarBackgroundColorPanel.Visible = isFixMode; } this.FixBackgroundColorOfBarCheckBox.CheckedChanged += (s, e) => changeProgressBarBackgroundPanel((s as CheckBox).Checked); changeProgressBarBackgroundPanel(this.FixBackgroundColorOfBarCheckBox.Checked); this.BarBackgroundColorButton.Click += (s, e) => { var button = s as Button; var result = ColorDialogWrapper.ShowDialog(button.BackColor); if (result.Result) { button.BackColor = result.Color.ToLegacy(); } }; #endregion ProgressBar Background }
private void VisualSettingControl_Load(object sender, EventArgs e) { var colorSetDirectory = this.GetColorSetDirectory; if (Directory.Exists(colorSetDirectory)) { this.OpenFileDialog.InitialDirectory = colorSetDirectory; this.SaveFileDialog.InitialDirectory = colorSetDirectory; } this.WidthNumericUpDown.Value = this.BarSize.Width; this.HeightNumericUpDown.Value = this.BarSize.Height; this.RefreshSampleImage(); this.ChangeFontItem.Click += (s1, e1) => { var result = FontDialogWrapper.ShowDialog(this.GetFontInfo()); if (result.Result) { this.SetFontInfo(result.Font); this.RefreshSampleImage(); } }; this.ChangeFontColorItem.Click += (s1, e1) => { var result = ColorDialogWrapper.ShowDialog(this.FontColor, true); if (result.Result) { this.FontColor = result.LegacyColor; this.RefreshSampleImage(); } }; this.ChangeFontOutlineColorItem.Click += (s1, e1) => { var result = ColorDialogWrapper.ShowDialog(this.FontOutlineColor, true); if (result.Result) { this.FontOutlineColor = result.LegacyColor; this.RefreshSampleImage(); } }; this.ChangeWarningFontColorItem.Click += (s1, e1) => { var result = ColorDialogWrapper.ShowDialog(this.WarningFontColor, true); if (result.Result) { this.WarningFontColor = result.LegacyColor; this.RefreshSampleImage(); } }; this.ChangeWarningFontOutlineColorItem.Click += (s1, e1) => { var result = ColorDialogWrapper.ShowDialog(this.WarningFontOutlineColor, true); if (result.Result) { this.WarningFontOutlineColor = result.LegacyColor; this.RefreshSampleImage(); } }; this.ChangeBarColorItem.Click += (s1, e1) => { var result = ColorDialogWrapper.ShowDialog(this.BarColor, true); if (result.Result) { this.BarColor = result.LegacyColor; this.RefreshSampleImage(); } }; this.ChangeBarOutlineColorItem.Click += (s1, e1) => { var result = ColorDialogWrapper.ShowDialog(this.BarOutlineColor, true); if (result.Result) { this.BarOutlineColor = result.LegacyColor; this.RefreshSampleImage(); } }; this.ChangeBackgoundColorItem.Click += (s1, e1) => { var result = ColorDialogWrapper.ShowDialog(this.backgroundColor, true); if (result.Result) { this.backgroundColor = Color.FromArgb( this.alphaDialog.Alpha, result.LegacyColor);; this.RefreshSampleImage(); } }; this.ChangeBackgroundAlphaItem.Click += async(s1, e1) => { this.alphaDialog.Alpha = this.backgroundColor.A; if (await Task.Run(() => this.alphaDialog.ShowDialog(this)) != DialogResult.Cancel) { this.backgroundColor = Color.FromArgb( this.alphaDialog.Alpha, this.backgroundColor); this.RefreshSampleImage(); } }; this.LoadColorSetItem.Click += async(s1, e1) => { if (await Task.Run(() => this.OpenFileDialog.ShowDialog(this)) != DialogResult.Cancel) { using (var sr = new StreamReader(this.OpenFileDialog.FileName, new UTF8Encoding(false))) { var xs = new XmlSerializer(typeof(ColorSet)); var colorSet = xs.Deserialize(sr) as ColorSet; if (colorSet != null) { this.FontColor = colorSet.FontColor.FromHTML(); this.FontOutlineColor = colorSet.FontOutlineColor.FromHTML(); this.WarningFontColor = colorSet.WarningFontColor.FromHTML(); this.WarningFontOutlineColor = colorSet.WarningFontOutlineColor.FromHTML(); this.BarColor = colorSet.BarColor.FromHTML(); this.BarOutlineColor = colorSet.BarOutlineColor.FromHTML(); this.backgroundColor = string.IsNullOrWhiteSpace(colorSet.BackgroundColor) ? Color.Transparent : Color.FromArgb(colorSet.BackgroundAlpha, colorSet.BackgroundColor.FromHTML()); this.RefreshSampleImage(); } } } }; this.SaveColorSetItem.Click += async(s1, e1) => { if (string.IsNullOrWhiteSpace(this.SaveFileDialog.FileName)) { this.SaveFileDialog.FileName = "スペスペ配色セット.xml"; } if (await Task.Run(() => this.SaveFileDialog.ShowDialog(this)) != DialogResult.Cancel) { var colorSet = new ColorSet() { FontColor = this.FontColor.ToHTML(), FontOutlineColor = this.FontOutlineColor.ToHTML(), WarningFontColor = this.WarningFontColor.ToHTML(), WarningFontOutlineColor = this.WarningFontOutlineColor.ToHTML(), BarColor = this.BarColor.ToHTML(), BarOutlineColor = this.BarOutlineColor.ToHTML(), BackgroundColor = this.backgroundColor.ToHTML(), BackgroundAlpha = this.backgroundColor.A, }; using (var sw = new StreamWriter(this.SaveFileDialog.FileName, false, new UTF8Encoding(false))) { var xs = new XmlSerializer(typeof(ColorSet)); xs.Serialize(sw, colorSet); } } }; this.WidthNumericUpDown.ValueChanged += (s1, e1) => { this.RefreshSampleImage(); }; this.HeightNumericUpDown.ValueChanged += (s1, e1) => { this.RefreshSampleImage(); }; this.ResetSpellFontItem.Click += (s1, e1) => { foreach (var s in SpellTable.Instance.Table) { s.Font = this.GetFontInfo(); } SpellsController.Instance.ClosePanels(); SpellTable.Instance.Save(true); }; this.ResetSpellBarSizeItem.Click += (s1, e1) => { foreach (var s in SpellTable.Instance.Table) { s.BarWidth = this.BarSize.Width; s.BarHeight = this.BarSize.Height; } SpellsController.Instance.ClosePanels(); SpellTable.Instance.Save(true); }; this.ResetSpellColorItem.Click += (s1, e1) => { foreach (var s in SpellTable.Instance.Table) { s.FontColor = this.FontColor.ToHTML(); s.FontOutlineColor = this.FontOutlineColor.ToHTML(); s.WarningFontColor = this.WarningFontColor.ToHTML(); s.WarningFontOutlineColor = this.WarningFontOutlineColor.ToHTML(); s.BarColor = this.BarColor.ToHTML(); s.BarOutlineColor = this.BarOutlineColor.ToHTML(); s.BackgroundColor = this.backgroundColor.ToHTML(); s.BackgroundAlpha = this.backgroundColor.A; } SpellsController.Instance.ClosePanels(); SpellTable.Instance.Save(true); }; this.ResetTelopFontItem.Click += (s1, e1) => { foreach (var s in TickerTable.Instance.Table) { s.Font = this.GetFontInfo(); } TickersController.Instance.CloseTelops(); TickerTable.Instance.Save(true); }; this.ResetTelopColorItem.Click += (s1, e1) => { foreach (var s in TickerTable.Instance.Table) { s.FontColor = this.FontColor.ToHTML(); s.FontOutlineColor = this.FontOutlineColor.ToHTML(); s.BackgroundColor = this.backgroundColor.ToHTML(); s.BackgroundAlpha = this.backgroundColor.A; } TickersController.Instance.CloseTelops(); TickerTable.Instance.Save(true); }; }