コード例 #1
0
        private void EditorFontColorExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            EditorSetOptions?option = e.Parameter as EditorSetOptions?;

            if (!option.HasValue)
            {
                return;
            }

            switch (option.Value)
            {
            case EditorSetOptions.Default:
                Application.Current.Resources["TextBrush"] = new SolidColorBrush(Colors.White);
                break;

            case EditorSetOptions.Set:
            {
                ColorPickerControls.Dialogs.ColorPickerStandardDialog dialog = new ColorPickerControls.Dialogs.ColorPickerStandardDialog();
                SolidColorBrush brush = Application.Current.Resources["TextBrush"] as SolidColorBrush;
                dialog.InitialColor = brush.Color;
                dialog.Owner        = ShellService.Instance.MainWindow;
                bool?dialogResult = dialog.ShowDialog();
                if (dialogResult != null && (bool)dialogResult == true)
                {
                    Application.Current.Resources["TextBrush"] = new SolidColorBrush(dialog.SelectedColor);
                }
            }
            break;
            }
        }
コード例 #2
0
        private void BackgroundColorExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            EditorSetOptions?option = e.Parameter as EditorSetOptions?;

            if (!option.HasValue)
            {
                return;
            }

            switch (option.Value)
            {
            case EditorSetOptions.Default:
                Engine.Instance.SceneManager.BackgroundColor = SceneManager.DefaultBackgroundColor;
                break;

            case EditorSetOptions.Set:
            {
                ColorPickerControls.Dialogs.ColorPickerStandardDialog dialog = new ColorPickerControls.Dialogs.ColorPickerStandardDialog();
                dialog.colorPickerFull.SelectedColorChanged += (s, param) =>
                {
                    Engine.Instance.SceneManager.BackgroundColor = param.Value.ToSColor();
                };
                SColor scolor = Engine.Instance.SceneManager.BackgroundColor;
                dialog.InitialColor = Color.FromArgb(scolor.A, scolor.R, scolor.G, scolor.B);
                dialog.Owner        = ShellService.Instance.MainWindow;
                bool?dialogResult = dialog.ShowDialog();
                if (dialogResult != null && (bool)dialogResult == true)
                {
                    Engine.Instance.SceneManager.BackgroundColor = dialog.SelectedColor.ToSColor();
                }
                else
                {
                    Engine.Instance.SceneManager.BackgroundColor = dialog.InitialColor.ToSColor();
                }
            }
            break;

            default:
                break;
            }
        }
コード例 #3
0
        private void ModelColorExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            EditorSetOptions?option = e.Parameter as EditorSetOptions?;

            if (!option.HasValue)
            {
                return;
            }

            M2SceneNode node = ModelSceneService.Instance.MainM2SceneNode;

            switch (option.Value)
            {
            case EditorSetOptions.Set:
                ColorPickerControls.Dialogs.ColorPickerStandardDialog dialog = new ColorPickerControls.Dialogs.ColorPickerStandardDialog();
                dialog.colorPickerFull.SelectedColorChanged += (s, param) =>
                {
                    node.ModelColor = param.Value.ToSColor();
                };
                SColor scolor = node.ModelColor;
                dialog.InitialColor = Color.FromArgb(scolor.A, scolor.R, scolor.G, scolor.B);
                dialog.Owner        = ShellService.Instance.MainWindow;
                bool?dialogResult = dialog.ShowDialog();
                if (dialogResult != null && (bool)dialogResult == true)
                {
                    node.ModelColor = dialog.SelectedColor.ToSColor();
                }
                else
                {
                    node.ModelColor = dialog.InitialColor.ToSColor();
                }
                break;

            case EditorSetOptions.Default:
                node.ModelColor = Colors.White.ToSColor();
                break;
            }
        }