Exemplo n.º 1
0
        public FormMain()
        {
            InitializeComponent();

            Icon = Icon.ExtractAssociatedIcon(Program.Assembly.Location);

            toolStripButtonOpen.SetImage(MaterialDesign.Instance, MaterialDesign.IconType.folder_open, 48, SystemColors.Control);
            toolStripButtonQSwatch.SetImage(MaterialDesign.Instance, MaterialDesign.IconType.color_lens, 48, SystemColors.Control);
            toolStripButtonHistory.SetImage(MaterialDesign.Instance, MaterialDesign.IconType.restore, 48, SystemColors.Control);

            toolStripButtonTopMost.SetImage(MaterialDesign.Instance, MaterialDesign.IconType.layers, 48, SystemColors.Control);
            toolStripButtonAbout.SetImage(MaterialDesign.Instance, MaterialDesign.IconType.info, 48, SystemColors.Control);
            toolStripButtonClose.SetImage(MaterialDesign.Instance, MaterialDesign.IconType.close, 48, SystemColors.Control);

            toolStripButtonUpdates.SetImage(MaterialDesign.Instance, MaterialDesign.IconType.system_update_alt, 48, SystemColors.Control);

            panelColor.BackgroundImage = MaterialDesign.GetImage(MaterialDesign.IconType.colorize, 48, SystemColors.Control);

#if DEBUG
            Color = ColorHelper.ToColor("#F44336");
            SetColor();

            FormHelper.ExtractResources(panelColor.BackgroundImage, panelColor.Name);
            FormHelper.ExtractResources(toolStripMenu);
#endif
        }
Exemplo n.º 2
0
        private void SetColor()
        {
            if (Properties.Settings.Default.History == null)
            {
                Properties.Settings.Default.History = new System.Collections.Specialized.StringCollection();
            }

            if (!Properties.Settings.Default.History.Contains(Color.ToArgb().ToString()))
            {
                Properties.Settings.Default.History.Add(Color.ToArgb().ToString());
                Properties.Settings.Default.Save();
            }

            panelColor.BackColor       = Color;
            panelColor.BackgroundImage = MaterialDesign.GetImage(MaterialDesign.IconType.colorize, 48, Color.Invert());

            toolStripButtonHistory.Enabled = Properties.Settings.Default.History != null && Properties.Settings.Default.History.Count > 0;

            textBoxHEX.Text = ColorHelper.ToHEX(Color);

            textBoxR.Value = Color.R;
            textBoxG.Value = Color.G;
            textBoxB.Value = Color.B;

            var hsv = ColorHelper.ToHSB(Color);

            textBoxH.Value = (decimal)hsv.Hue360;
            textBoxS.Value = (decimal)hsv.Saturation100;
            textBoxV.Value = (decimal)hsv.Brightness100;
        }
 public IActionResult Edit(MaterialDesignViewModel obj)
 {
     //check for valid model
     if (ModelState.IsValid)
     {
         using (MaterialDesignDBContext db = new MaterialDesignDBContext())
         {
             //object for view model
             MaterialDesign md = obj.NewMaterialDesign;
             //retrieve primary key/id from route data
             md.MaterialDesignId = Guid.Parse(RouteData.Values["id"].ToString());
             //update record status
             db.Entry(md).State = EntityState.Modified;
             db.SaveChanges();
         }
     }
     return(RedirectToAction("Index"));
 }
Exemplo n.º 4
0
        internal static void Initialize()
        {
#if DEBUG
            ImageHelper.GetEditorIcon(MaterialDesign.GetImage(Program.Icon, 256, Color.White));
#endif
        }