public SchemeCreator(Point Origin, MaterialForm BaseFormToOverlay)
        {
            BackBrush = Brushes.Magenta;
            SetStyle(ControlStyles.SupportsTransparentBackColor, true);
            FormBorderStyle    = System.Windows.Forms.FormBorderStyle.None;
            CurrentHoveredPath = new GraphicsPath();
            //set the backcolor and transparencykey on same color.
            this.BackColor       = Color.Magenta;
            this.TransparencyKey = Color.Magenta;
            InitializeComponent();
            FillBrush           = new SolidBrush(MaterialSkinManager.Instance.GetApplicationBackgroundColor());
            _Origin             = Origin;
            _BaseForm           = BaseFormToOverlay;
            objAnimationManager = new AnimationManager()
            {
                Increment     = 0.015,
                AnimationType = AnimationType.EaseInOut
            };
            DoubleBuffered = true;
            objAnimationManager.OnAnimationProgress += sender => Invalidate();
            objAnimationManager.OnAnimationFinished += objAnimationManager_OnAnimationFinished;
            Visible       = false;
            _ActiveKey    = _PrimaryKey;
            _Primary      = Primary.Indigo500;
            _PrimaryDark  = Primary.Indigo700;
            _PrimaryLight = Primary.Indigo100;
            _Accent       = Accent.Pink200;
            _Text         = TextShade.WHITE;
            BaseFormToOverlay.LocationChanged += BaseFormToOverlay_LocationChanged;
            initColorHints();
            Size     = _BaseForm.Size;
            Location = _BaseForm.Location;

            MouseUp += SchemeCreator_MouseUp;
        }
示例#2
0
        private void LoadTheme(Themes theme)
        {
            Primary   p   = (Primary)Enum.Parse(typeof(Primary), theme.Primary.ToString());
            Primary   dp  = (Primary)Enum.Parse(typeof(Primary), theme.DarkPrimary.ToString());
            Primary   lp  = (Primary)Enum.Parse(typeof(Primary), theme.LightPrimary.ToString());
            Accent    acc = (Accent)Enum.Parse(typeof(Accent), theme.Accent.ToString());
            TextShade ts  = (TextShade)Enum.Parse(typeof(TextShade), theme.TextShade.ToString());

            cbPrimary.SelectedIndex      = Array.IndexOf(Enum.GetValues(p.GetType()), p);
            cbDarkPrimary.SelectedIndex  = Array.IndexOf(Enum.GetValues(dp.GetType()), dp);
            cbLightPrimary.SelectedIndex = Array.IndexOf(Enum.GetValues(lp.GetType()), lp);

            cbAccent.SelectedIndex    = Array.IndexOf(Enum.GetValues(acc.GetType()), acc);
            cbTextShade.SelectedIndex = Array.IndexOf(Enum.GetValues(ts.GetType()), ts);

            if (MaterialSkinManager.Instance.Theme != (MaterialSkinManager.Themes)theme.Mode) //changing theme to the same theme is still expensive
            {
                MaterialSkinManager.Instance.Theme = (MaterialSkinManager.Themes)theme.Mode;
            }

            currentSelectedTheme = theme;
            Settings set = BLLocalDatabase.Setting.Settings;

            set.CurrentTheme = theme.Id;
            BLLocalDatabase.Setting.UpdateSettings(set);

            GC.Collect();
        }
示例#3
0
 public ColorSchemeValues(Primary primary, Primary darkPrimary, Primary lightPrimary, Accent accent, TextShade textShade)
 {
     this.primary      = primary;
     this.darkPrimary  = darkPrimary;
     this.lightPrimary = lightPrimary;
     this.accent       = accent;
     this.textShade    = textShade;
 }
示例#4
0
文件: ggLoL.cs 项目: JCases/ggLoL
        public ggLoL(MaterialSkinManager.Themes theme, Primary colorP,
                     Primary darkP, Primary lightP, Accent accent, TextShade shade)
        {
            InitializeComponent();

            msm = MaterialSkinManager.Instance;
            msm.AddFormToManage(this);
            msm.Theme = theme;

            msm.ColorScheme = new ColorScheme(
                colorP, darkP, lightP, accent, shade);

            timer.Start();
        }
示例#5
0
        private void colorSchemeIndexChanged(object sender, EventArgs e)
        {
            try
            {
                Primary   p   = (Primary)Enum.Parse(typeof(Primary), cbPrimary.SelectedItem.ToString());
                Primary   dp  = (Primary)Enum.Parse(typeof(Primary), cbDarkPrimary.SelectedItem.ToString());
                Primary   lp  = (Primary)Enum.Parse(typeof(Primary), cbLightPrimary.SelectedItem.ToString());
                Accent    acc = (Accent)Enum.Parse(typeof(Accent), cbAccent.SelectedItem.ToString());
                TextShade ts  = (TextShade)Enum.Parse(typeof(TextShade), cbTextShade.SelectedItem.ToString());
                MaterialSkin.MaterialSkinManager.Instance.ColorScheme = new ColorScheme(p, dp, lp, acc, ts);

                //Make sure the form header also changes color
                MaterialForm1.Instance.Invalidate();
            }
            catch { }
        }
        /// <summary>
        /// The form that allows
        /// </summary>
        /// <param name="reminderFile"></param>
        public MaterialRemindMeImporter(string reminderFile)
        {
            BLIO.Log("Constructing RemindMeImporter");
            BLIO.Log("Form1 null: " + (Form1.Instance == null).ToString());
            BLIO.Log("Form1: " + Form1.Instance);


            // Initialize MaterialSkinManager
            MaterialSkinManager materialSkinManager = MaterialSkinManager.Instance;

            materialSkinManager.AddFormToManage(this);

            Themes theme = BLLocalDatabase.Theme.GetThemeById(BLLocalDatabase.Setting.Settings.CurrentTheme.Value);

            if (theme != null)
            {
                Primary   p   = (Primary)Enum.Parse(typeof(Primary), theme.Primary.ToString());
                Primary   dp  = (Primary)Enum.Parse(typeof(Primary), theme.DarkPrimary.ToString());
                Primary   lp  = (Primary)Enum.Parse(typeof(Primary), theme.LightPrimary.ToString());
                Accent    acc = (Accent)Enum.Parse(typeof(Accent), theme.Accent.ToString());
                TextShade ts  = (TextShade)Enum.Parse(typeof(TextShade), theme.TextShade.ToString());


                materialSkinManager.Theme       = (MaterialSkinManager.Themes)theme.Mode;
                materialSkinManager.ColorScheme = new ColorScheme(p, dp, lp, acc, ts);
            }


            //This is the only other form that you need to set this for again(after form1) because it is ran differently, namely from program.cs
            //As Application.Run() instead of loading it from the current application

            InitializeComponent();
            this.Opacity      = 0;
            this.remindmeFile = reminderFile;
            AppDomain.CurrentDomain.SetData("DataDirectory", IOVariables.databaseFile);
            tmrFadeIn.Start();

            this.MaximumSize = this.Size;
            this.MinimumSize = this.Size;

            BLIO.Log("RemindMeImporter constructed");
        }
示例#7
0
        private void ReColor()
        {
            MaterialSkinManager.Instance.Theme = (Properties.Settings.Default.darktheme) ? MaterialSkinManager.Themes.DARK : MaterialSkinManager.Themes.LIGHT;

            if (purpleThemeRadioButton.Checked)
            {
                ColorScheme schem2e = new ColorScheme(
                    ColorTranslator.FromHtml("#482880"),  // Primary
                    ColorTranslator.FromHtml("#341d5b"),  // DarkPrimary
                    ColorTranslator.FromHtml("#845bcb"),  // Light
                    ColorTranslator.FromHtml("#ffbb40"),  // Accent
                    TextShade.WHITE, MaterialSkinManager.Instance.GetApplicationBackgroundColor());
                if (MaterialSkinManager.Instance.ColorScheme != schem2e)
                {
                    MaterialSkinManager.Instance.ColorScheme = schem2e;
                }
                return;
            }


            TextShade tx = TextShade.WHITE;

            if (ThemeInfo.GetThemeColor().GetBrightness() > .5f)
            {
                tx = TextShade.BLACK;
            }
            ColorScheme scheme = new ColorScheme(
                ThemeInfo.GetThemeColor(),                                       // Primary
                ControlPaint.Dark(ThemeInfo.GetThemeColor(), .1f),               // DarkPrimary
                ControlPaint.Light(ThemeInfo.GetThemeColor(), .8f),              // Light
                SetHue(ControlPaint.Light(ThemeInfo.GetThemeColor(), .8f), 120), // Accent
                tx, MaterialSkinManager.Instance.GetApplicationBackgroundColor());

            if (MaterialSkinManager.Instance.ColorScheme != scheme)
            {
                MaterialSkinManager.Instance.ColorScheme = scheme;
            }
        }
示例#8
0
        public Settings()
        {
            var key = Registry.CurrentUser;

            key = createAndGetSubkey(key, "Software");
            key = createAndGetSubkey(key, "LightController");
            key = createAndGetSubkey(key, "0.1");

            createAndSetKeyIfNotExists(key, "ip");
            createAndSetKeyIfNotExists(key, "theme");
            createAndSetKeyIfNotExists(key, "colorSchemePrimary");
            createAndSetKeyIfNotExists(key, "colorSchemeLightPrimary");
            createAndSetKeyIfNotExists(key, "colorSchemeDarkPrimary");
            createAndSetKeyIfNotExists(key, "colorSchemeAccentPrimary");
            createAndSetKeyIfNotExists(key, "colorSchemeTextShade");
            createAndSetKeyIfNotExists(key, "colorSchemeIndex");
            createAndSetKeyIfNotExists(key, "hideOnStartup");

            Enum.TryParse((string)key.GetValue("theme"), out MaterialSkinManager.Themes themeVar);
            Enum.TryParse((string)key.GetValue("colorSchemePrimary"), out Primary colorSchemePrimaryVar);
            Enum.TryParse((string)key.GetValue("colorSchemeLightPrimary"), out Primary colorSchemeLightPrimaryVar);
            Enum.TryParse((string)key.GetValue("colorSchemeDarkPrimary"), out Primary colorSchemeDarkPrimaryVar);
            Enum.TryParse((string)key.GetValue("colorSchemeAccentPrimary"), out Accent colorSchemeAccentPrimaryVar);
            Enum.TryParse((string)key.GetValue("colorSchemeTextShade"), out TextShade colorSchemeTextShadeVar);

            this.ipVar = (string)key.GetValue("ip");
            this.colorSchemeIndexVar         = Convert.ToInt32(key.GetValue("colorSchemeIndex").ToString());
            this.hideOnStartupVar            = Convert2.stringToBool(key.GetValue("hideOnStartup").ToString());
            this.themeVar                    = themeVar;
            this.colorSchemePrimaryVar       = colorSchemePrimaryVar;
            this.colorSchemeLightPrimaryVar  = colorSchemeLightPrimaryVar;
            this.colorSchemeDarkPrimaryVar   = colorSchemeDarkPrimaryVar;
            this.colorSchemeAccentPrimaryVar = colorSchemeAccentPrimaryVar;
            this.colorSchemeTextShadeVar     = colorSchemeTextShadeVar;
            this.themeVar                    = themeVar;

            this.regKey = key;
        }
		/// <summary>
		/// Defines the Color Scheme to be used for all forms.
		/// </summary>
		/// <param name="primary">The primary color, a -500 color is suggested here.</param>
		/// <param name="darkPrimary">A darker version of the primary color, a -700 color is suggested here.</param>
		/// <param name="lightPrimary">A lighter version of the primary color, a -100 color is suggested here.</param>
		/// <param name="accent">The accent color, a -200 color is suggested here.</param>
		/// <param name="textShade">The text color, the one with the highest contrast is suggested.</param>
		public ColorScheme(Primary primary, Primary darkPrimary, Primary lightPrimary, Accent accent, TextShade textShade)
        {
            //Color
            PrimaryColor = ((int) primary).ToColor();
            DarkPrimaryColor = ((int) darkPrimary).ToColor();
            LightPrimaryColor = ((int) lightPrimary).ToColor();
            AccentColor = ((int) accent).ToColor();
			TextColor = ((int) textShade).ToColor();

            //Pen
            PrimaryPen = new Pen(PrimaryColor);
            DarkPrimaryPen = new Pen(DarkPrimaryColor);
            LightPrimaryPen = new Pen(LightPrimaryColor);
            AccentPen = new Pen(AccentColor);
            TextPen = new Pen(TextColor);

            //Brush
            PrimaryBrush = new SolidBrush(PrimaryColor);
            DarkPrimaryBrush = new SolidBrush(DarkPrimaryColor);
            LightPrimaryBrush = new SolidBrush(LightPrimaryColor);
            AccentBrush = new SolidBrush(AccentColor);
            TextBrush = new SolidBrush(TextColor);
        }
示例#10
0
        /// <summary>
        /// Defines the Color Scheme to be used for all forms.
        /// </summary>
        /// <param name="primary">The primary color, a -500 color is suggested here.</param>
        /// <param name="darkPrimary">A darker version of the primary color, a -700 color is suggested here.</param>
        /// <param name="lightPrimary">A lighter version of the primary color, a -100 color is suggested here.</param>
        /// <param name="accent">The accent color, a -200 color is suggested here.</param>
        /// <param name="textShade">The text color, the one with the highest contrast is suggested.</param>
        public ColorScheme(Primary primary, Primary darkPrimary, Primary lightPrimary, Accent accent,
                           TextShade textShade, Accent danger = Accent.Red400, Accent warning = Accent.Orange400,
                           Accent success = Accent.Green700, Primary lightGray = Primary.Grey100)
        {
            //Color
            PrimaryColor      = ((int)primary).ToColor();
            DarkPrimaryColor  = ((int)darkPrimary).ToColor();
            LightPrimaryColor = ((int)lightPrimary).ToColor();
            AccentColor       = ((int)accent).ToColor();
            TextColor         = ((int)textShade).ToColor();
            DangerColor       = ((int)danger).ToColor();
            WarningColor      = ((int)warning).ToColor();
            SuccessColor      = ((int)success).ToColor();
            LightGrayColor    = ((int)lightGray).ToColor();

            //Pen
            PrimaryPen      = new Pen(PrimaryColor);
            DarkPrimaryPen  = new Pen(DarkPrimaryColor);
            LightPrimaryPen = new Pen(LightPrimaryColor);
            AccentPen       = new Pen(AccentColor);
            TextPen         = new Pen(TextColor);
            DangerPen       = new Pen(DangerColor);
            WarningPen      = new Pen(WarningColor);
            SuccessPen      = new Pen(SuccessColor);
            LightGrayPen    = new Pen(LightGrayColor);

            //Brush
            PrimaryBrush      = new SolidBrush(PrimaryColor);
            DarkPrimaryBrush  = new SolidBrush(DarkPrimaryColor);
            LightPrimaryBrush = new SolidBrush(LightPrimaryColor);
            AccentBrush       = new SolidBrush(AccentColor);
            TextBrush         = new SolidBrush(TextColor);
            DangerBrush       = new SolidBrush(DangerColor);
            WarningBrush      = new SolidBrush(WarningColor);
            SuccessBrush      = new SolidBrush(SuccessColor);
            LightGrayBrush    = new SolidBrush(LightGrayColor);
        }
示例#11
0
        public ColorScheme(string customPrimary, string customDarkPrimary, string customLightPrimary, string customAccent, TextShade textShade)
        {
            //Color

            /*PrimaryColor = ((int)new System.ComponentModel.Int32Converter().ConvertFromString(customPrimary)).ToColor();
             * DarkPrimaryColor = ((int)new System.ComponentModel.Int32Converter().ConvertFromString(customDarkPrimary)).ToColor();
             * LightPrimaryColor = ((int)new System.ComponentModel.Int32Converter().ConvertFromString(customLightPrimary)).ToColor();
             * AccentColor = ((int)new System.ComponentModel.Int32Converter().ConvertFromString(customAccent)).ToColor();*/
            PrimaryColor      = GetIntFromHexColor(customPrimary).ToColor();
            DarkPrimaryColor  = GetIntFromHexColor(customDarkPrimary).ToColor();
            LightPrimaryColor = GetIntFromHexColor(customLightPrimary).ToColor();
            AccentColor       = GetIntFromHexColor(customAccent).ToColor();
            TextColor         = ((int)textShade).ToColor();

            //Pen
            PrimaryPen      = new Pen(PrimaryColor);
            DarkPrimaryPen  = new Pen(DarkPrimaryColor);
            LightPrimaryPen = new Pen(LightPrimaryColor);
            AccentPen       = new Pen(AccentColor);
            TextPen         = new Pen(TextColor);

            //Brush
            PrimaryBrush      = new SolidBrush(PrimaryColor);
            DarkPrimaryBrush  = new SolidBrush(DarkPrimaryColor);
            LightPrimaryBrush = new SolidBrush(LightPrimaryColor);
            AccentBrush       = new SolidBrush(AccentColor);
            TextBrush         = new SolidBrush(TextColor);
        }
示例#12
0
        /// <summary>
        /// Defines the Color Scheme to be used for all forms with custom colors.
        /// </summary>
        /// <param name="primary">The primary color, a -500 color is suggested here.</param>
        /// <param name="darkPrimary">A darker version of the primary color, a -700 color is suggested here.</param>
        /// <param name="lightPrimary">A lighter version of the primary color, a -100 color is suggested here.</param>
        /// <param name="accent">The accent color, a -200 color is suggested here.</param>
        /// <param name="textShade">The text color, the one with the highest contrast is suggested.</param>
        public ColorScheme(int customPrimary, int customDarkPrimary, int customLightPrimary, int customAccent, TextShade textShade)
        {
            //Color
            PrimaryColor      = (customPrimary).ToColor();
            DarkPrimaryColor  = (customDarkPrimary).ToColor();
            LightPrimaryColor = (customLightPrimary).ToColor();
            AccentColor       = (customAccent).ToColor();
            TextColor         = ((int)textShade).ToColor();

            //Pen
            PrimaryPen      = new Pen(PrimaryColor);
            DarkPrimaryPen  = new Pen(DarkPrimaryColor);
            LightPrimaryPen = new Pen(LightPrimaryColor);
            AccentPen       = new Pen(AccentColor);
            TextPen         = new Pen(TextColor);

            //Brush
            PrimaryBrush      = new SolidBrush(PrimaryColor);
            DarkPrimaryBrush  = new SolidBrush(DarkPrimaryColor);
            LightPrimaryBrush = new SolidBrush(LightPrimaryColor);
            AccentBrush       = new SolidBrush(AccentColor);
            TextBrush         = new SolidBrush(TextColor);
        }
示例#13
0
 public static Color ToColor(this TextShade argb)
 {
     return(((int)argb).ToColor());
 }
示例#14
0
        public ColorScheme(Color primary, Color darkPrimary, Color lightPrimary, Color accent, TextShade textShade)
        {
            //Color
            PrimaryColor      = primary;
            DarkPrimaryColor  = darkPrimary;
            LightPrimaryColor = lightPrimary;
            AccentColor       = accent;
            TextColor         = ((int)textShade).ToColor();

            //Pen
            PrimaryPen      = new Pen(PrimaryColor);
            DarkPrimaryPen  = new Pen(DarkPrimaryColor);
            LightPrimaryPen = new Pen(LightPrimaryColor);
            AccentPen       = new Pen(AccentColor);
            TextPen         = new Pen(TextColor);

            //Brush
            PrimaryBrush      = new SolidBrush(PrimaryColor);
            DarkPrimaryBrush  = new SolidBrush(DarkPrimaryColor);
            LightPrimaryBrush = new SolidBrush(LightPrimaryColor);
            AccentBrush       = new SolidBrush(AccentColor);
            TextBrush         = new SolidBrush(TextColor);
        }
示例#15
0
 public ColorScheme(Primary primary, Primary darkPrimary, Primary lightPrimary, Accent accent, TextShade textShade)
 {
     this.PrimaryColor      = ((int)primary).ToColor();
     this.DarkPrimaryColor  = ((int)darkPrimary).ToColor();
     this.LightPrimaryColor = ((int)lightPrimary).ToColor();
     this.AccentColor       = ((int)accent).ToColor();
     this.TextColor         = ((int)textShade).ToColor();
     this.PrimaryPen        = new Pen(this.PrimaryColor);
     this.DarkPrimaryPen    = new Pen(this.DarkPrimaryColor);
     this.LightPrimaryPen   = new Pen(this.LightPrimaryColor);
     this.AccentPen         = new Pen(this.AccentColor);
     this.TextPen           = new Pen(this.TextColor);
     this.PrimaryBrush      = new SolidBrush(this.PrimaryColor);
     this.DarkPrimaryBrush  = new SolidBrush(this.DarkPrimaryColor);
     this.LightPrimaryBrush = new SolidBrush(this.LightPrimaryColor);
     this.AccentBrush       = new SolidBrush(this.AccentColor);
     this.TextBrush         = new SolidBrush(this.TextColor);
 }
示例#16
0
        public void Load()
        {
            string[] files = Directory.GetFiles(".", "-profile.ggLoL");

            if (files.Length > 1)
            {
                // TO DO -> Option to take a Info from Users (More than 1)
                string users = "";
                foreach (string i in files)
                {
                    users += " | " + i.Replace("-profile.ggLoL", "");
                }

                MessageBox.Show("Users: " + users);
            }

            else if (files.Length == 1)
            {
                string fileName = files[0];

                if (!File.Exists(fileName))
                {
                    MessageBox.Show("Error with file " + fileName);
                }
                else
                {
                    try
                    {
                        StreamReader reader = new StreamReader(fileName);

                        // User Info
                        this.name     = reader.ReadLine();
                        this.password = reader.ReadLine();
                        this.email    = reader.ReadLine();
                        this.nick     = reader.ReadLine();

                        this.verify = reader.ReadLine().Split(':')[1] == "0" ? false : true;

                        // Colors and Theme
                        int count = 0;

                        string    coloursSave = reader.ReadLine();
                        Primary[] colour      = new Primary[3];

                        foreach (string i in coloursSave.Split('|'))
                        {
                            // TO DO i.Split(':')[1];
                            count++;
                        }

                        colour[0] = Primary.BlueGrey800;
                        colour[1] = Primary.BlueGrey900;
                        colour[2] = Primary.BlueGrey900;

                        Accent    accent = Accent.LightBlue700;
                        TextShade shade  = TextShade.WHITE;

                        string accentSave = reader.ReadLine();
                        foreach (string i in accentSave.Split('|'))
                        {
                            // TO DO i.Split(':')[1];
                        }

                        string themeSave = reader.ReadLine();

                        MaterialSkinManager.Themes theme =
                            themeSave.Split(':')[1] ==
                            MaterialSkinManager.Themes.LIGHT.ToString() ?
                            MaterialSkinManager.Themes.LIGHT
                            : MaterialSkinManager.Themes.DARK;

                        ggLoL lol = new ggLoL(theme, colour[0], colour[1],
                                              colour[2], accent, shade);

                        reader.Close();
                    }
                    catch (PathTooLongException e) { MessageBox.Show(e.Message); }
                    catch (FileNotFoundException e) { MessageBox.Show(e.Message); }
                    catch (IOException e) { MessageBox.Show(e.Message); }
                    catch (Exception e) { MessageBox.Show(e.Message); }
                }
            }
        }
示例#17
0
        /// <summary>
        /// Defines the Color Scheme to be used for all forms.
        /// </summary>
        /// <param name="primary">The primary color, a -500 color is suggested here.</param>
        /// <param name="darkPrimary">A darker version of the primary color, a -700 color is suggested here.</param>
        /// <param name="lightPrimary">A lighter version of the primary color, a -100 color is suggested here.</param>
        /// <param name="accent">The accent color, a -200 color is suggested here.</param>
        /// <param name="textShade">The text color, the one with the highest contrast is suggested.</param>
        public ColorScheme(Color primary, Color darkPrimary, Color lightPrimary, Color accent, TextShade textShade)
        {
            //Color
            PrimaryColor = primary;
            DarkPrimaryColor = darkPrimary;
            LightPrimaryColor = lightPrimary;
            AccentColor = accent;
            TextColor = ((int)textShade).ToColor();

            //Pen
            PrimaryPen = new Pen(PrimaryColor);
            DarkPrimaryPen = new Pen(DarkPrimaryColor);
            LightPrimaryPen = new Pen(LightPrimaryColor);
            AccentPen = new Pen(AccentColor);
            TextPen = new Pen(TextColor);

            //Brush
            PrimaryBrush = new SolidBrush(PrimaryColor);
            DarkPrimaryBrush = new SolidBrush(DarkPrimaryColor);
            LightPrimaryBrush = new SolidBrush(LightPrimaryColor);
            AccentBrush = new SolidBrush(AccentColor);
            TextBrush = new SolidBrush(TextColor);
        }
示例#18
0
        /// <summary>
        /// Defines the Color Scheme to be used for all forms.
        /// </summary>
        /// <param name="primary">The primary color, a -500 color is suggested here.</param>
        /// <param name="darkPrimary">A darker version of the primary color, a -700 color is suggested here.</param>
        /// <param name="lightPrimary">A lighter version of the primary color, a -100 color is suggested here.</param>
        /// <param name="accent">The accent color, a -200 color is suggested here.</param>
        /// <param name="textShade">The text color, the one with the highest contrast is suggested.</param>
        public ColorScheme(Primary primary, Primary darkPrimary, Primary lightPrimary, Accent accent, TextShade textShade)
        {
            //Color
            PrimaryColor      = ColorExtension.ToColor((int)primary);      //.ToColor();
            DarkPrimaryColor  = ColorExtension.ToColor((int)darkPrimary);  //.ToColor();
            LightPrimaryColor = ColorExtension.ToColor((int)lightPrimary); //.ToColor();
            AccentColor       = ColorExtension.ToColor((int)accent);       //.ToColor();
            TextColor         = ColorExtension.ToColor((int)textShade);    //.ToColor();

            //Pen
            PrimaryPen      = new Pen(PrimaryColor);
            DarkPrimaryPen  = new Pen(DarkPrimaryColor);
            LightPrimaryPen = new Pen(LightPrimaryColor);
            AccentPen       = new Pen(AccentColor);
            TextPen         = new Pen(TextColor);

            //Brush
            PrimaryBrush      = new SolidBrush(PrimaryColor);
            DarkPrimaryBrush  = new SolidBrush(DarkPrimaryColor);
            LightPrimaryBrush = new SolidBrush(LightPrimaryColor);
            AccentBrush       = new SolidBrush(AccentColor);
            TextBrush         = new SolidBrush(TextColor);
        }
示例#19
0
        void SchemeCreator_MouseUp(object sender, MouseEventArgs e)
        {
            if (PrimaryRect.Contains(e.Location))
            {
                _ActiveKey   = _PrimaryKey;
                Zustand      = 0;
                HoveredIndex = -1;
            }
            if (LightPrimaryRect.Contains(e.Location))
            {
                _ActiveKey   = _PrimaryKey;
                Zustand      = 1;
                HoveredIndex = -1;
            }
            if (DarkPrimaryRect.Contains(e.Location))
            {
                _ActiveKey   = _PrimaryKey;
                Zustand      = 2;
                HoveredIndex = -1;
            }

            if (AccentRect.Contains(e.Location))
            {
                _ActiveKey   = _AccentKey;
                Zustand      = 3;
                HoveredIndex = -1;
            }
            if (TextShadeRect.Contains(e.Location))
            {
                _ActiveKey   = _TextShadeKey;
                Zustand      = 4;
                HoveredIndex = -1;
            }
            if (FabRect.Contains(e.Location))
            {
                MaterialUserControl objSaveControl = new MaterialUserControl();
                objSaveControl.Width   = 400;
                objSaveControl.Padding = new Padding(10);
                MaterialSingleLineTextField objText = new MaterialSingleLineTextField();
                objText.Dock          = DockStyle.Top;
                objText.Hint          = "Geben sie einen Namen für das Farbschema ein:";
                objText.TextChanged  += objText_TextChanged;
                objSaveControl.Height = 70;
                objSaveControl.Controls.Add(objText);
                if (MaterialDialog.Show("Neues Farbschema Speichern", objSaveControl, MaterialDialog.Buttons.OKCancel) == System.Windows.Forms.DialogResult.OK)
                {
                    MaterialSkinManager.Instance.ColorSchemes.add(new ColorSchemePreset()
                    {
                        Name              = SchemeName,
                        AccentColor       = _Accent,
                        DarkPrimaryColor  = _PrimaryDark,
                        LightPrimaryColor = _PrimaryLight,
                        PrimaryColor      = _Primary,
                        TextShade         = _Text
                    });
                }

                _BaseForm.Activate();
                objAnimationManager.StartNewAnimation(AnimationDirection.Out);

                return;
            }

            if (HoveredIndex >= 0)
            {
                switch (Zustand)
                {
                case 0:
                    _Primary = (Primary)ColorRectangles[_ActiveKey][HoveredIndex].Tag;
                    break;

                case 1:
                    _PrimaryLight = (Primary)ColorRectangles[_ActiveKey][HoveredIndex].Tag;
                    break;

                case 2:
                    _PrimaryDark = (Primary)ColorRectangles[_ActiveKey][HoveredIndex].Tag;
                    break;

                case 3:
                    _Accent = (Accent)ColorRectangles[_ActiveKey][HoveredIndex].Tag;
                    break;

                case 4:
                    _Text = (TextShade)ColorRectangles[_ActiveKey][HoveredIndex].Tag;
                    break;
                }
                objPreview.setSchemeToPreview(new ColorScheme(_Primary, _PrimaryDark, _PrimaryLight, _Accent, _Text));
            }

            Invalidate();
        }