Ejemplo n.º 1
0
 void update(ColorModel source)
 {
     changingValues = true;
     GetBaseColor(source);
     if (source != ColorModel.Rgb)
     {
         RgbR = basecolor.R;
         RgbG = basecolor.G;
         RgbB = basecolor.B;
     }
     if (source != ColorModel.RgbPerc)
     {
         try
         {
             var c = basecolor.ToRgb(RgbType.Percent);
             RgbPercR = c.R;
             RgbPercG = c.G;
             RgbPercB = c.B;
         }
         catch (Exception ex)
         {
             Debug.WriteLine(ex);
             throw;
         }
     }
     if (source != ColorModel.RgbByte)
     {
         var c = basecolor.ToRgb(RgbType.Byte);
         RgbByteR = c.R;
         RgbByteG = c.G;
         RgbByteB = c.B;
     }
     if (source != ColorModel.Cmy)
     {
         var c = basecolor.ToCmyk();
         CmyC = c.C;
         CmyM = c.M;
         CmyY = c.Y;
     }
     if (source != ColorModel.Cmyk)
     {
         var c = basecolor.ToCmyk(CmykType.CmykNormalized);
         CmykC = c.C;
         CmykM = c.M;
         CmykY = c.Y;
         CmykK = c.K;
     }
     if (source != ColorModel.Hsv)
     {
         try
         {
             var c = basecolor.ToHsv();
             HsvH = c.H;
             HsvS = c.S;
             HsvV = c.V;
         }
         catch (Exception ex)
         {
             Debug.WriteLine(ex);
         }
     }
     if (source != ColorModel.Xyz)
     {
         var c = basecolor.ToXyz();
         XyzX = c.X;
         XyzY = c.Y;
         XyzZ = c.Z;
     }
     if (source != ColorModel.Yiq)
     {
         var c = basecolor.ToYiq();
         YiqY = c.Y;
         YiqI = c.I;
         YiqQ = c.Q;
     }
     if (source != ColorModel.hex)
     {
         var c = basecolor;
         Hex = c.Hex;
     }
     OnPropertyChanged("RectColor");
     changingValues = false;
 }