void LoadModel(PointTypeEnum pointType, string path)
        {
            switch (pointType)
            {
            case PointTypeEnum.RGB:
                FileName = "Pattern_RGB.xml";
                //FileName = "Pattern_RGB_3.xml";
                break;

            case PointTypeEnum.RGBW:
                FileName = "Pattern_RGBW.xml";
                break;

            case PointTypeEnum.RGBWT:
                FileName = "Pattern_RGBWT.xml";
                break;

            case PointTypeEnum.CW:
                FileName = "Pattern_CW.xml";
                break;

            case PointTypeEnum.WT:
                FileName = "Pattern_WT.xml";
                break;
            }

            string patternPath = path + @"\" + FileName;

            Params = File.ReadAllText(patternPath);

            BuildPattern(UpSliderList);
            BuildPattern(DownSliderList);
        }
Exemple #2
0
        void ParseProfile(string profile)
        {
            PointTypeEnum pt    = PointTypeEnum.W;
            XElement      xdata = XElement.Parse(profile);

            HaveDimmer = bool.Parse(xdata.Attribute("HaveDimmer").Value);
            Enum.TryParse(xdata.Attribute("PointType").Value, out pt);
            PointType = pt;
        }
        void ParsePatternParams(PointTypeEnum pointType, string profile)
        {
            XElement basePoints1 = null;
            XElement basePoints2 = null;


            XElement root       = XElement.Parse(profile);
            int      pointCount = int.Parse(root.Attribute("PointCount").Value);

            PointCount = pointCount;
            Pattern    = new PatternPoint[pointCount];
            for (int i = 0; i < pointCount; i++)
            {
                Pattern[i] = new PatternPoint();
            }

            switch (pointType)
            {
            case PointTypeEnum.RGB:
                basePoints1 = root.Elements("RGB").First();
                break;

            case PointTypeEnum.RGBW:
                basePoints1 = root.Elements().First(p => p.Name == "RGB");
                basePoints2 = root.Elements().First(p => p.Name == "White");
                break;

            case PointTypeEnum.RGBWT:
                basePoints1 = root.Elements().First(p => p.Name == "RGB");
                basePoints2 = root.Elements().First(p => p.Name == "WhiteTemp");
                break;

            case PointTypeEnum.CW:
                basePoints1 = root.Elements().First(p => p.Name == "Warm");
                basePoints2 = root.Elements().First(p => p.Name == "Cold");
                break;

            case PointTypeEnum.WT:
                basePoints1 = root.Elements().First(p => p.Name == "WhiteTemp");
                break;

            case PointTypeEnum.W:
                basePoints1 = root.Elements().First(p => p.Name == "White");
                break;
            }

            CreateSliderList(basePoints1, UpSliderList);
            CreateSliderList(basePoints2, DownSliderList);
        }
Exemple #4
0
 public LightElement(PointTypeEnum pointType, ControlSpace space) : this()
 {
     ControlSpace = space;
     PointType    = pointType;
     if (pointType == PointTypeEnum.RGB && space.Id == 1)
     {
         ColorSequenceList = LightElement.ColorSequenseRGB;
         ColorSequence     = ColorSequenceList[0];
     }
     if (pointType == PointTypeEnum.RGBW && space.Id == 1)
     {
         ColorSequenceList = LightElement.ColorSequenseRGBW;
         ColorSequence     = ColorSequenceList[0];
     }
     Name = string.Format($"{ControlSpace.Prefix}_{pointType}_");
 }
Exemple #5
0
        public LightElement(PointTypeEnum pointType, ControlSpace space) : this()
        {
            ControlSpace = space;
            PointType    = pointType;

            if (space.Prefix == "AN" || space.Prefix == "DX")
            {
                if (pointType == PointTypeEnum.RGB)
                {
                    ColorSequence = "RGB";
                }
                if (pointType == PointTypeEnum.RGBW)
                {
                    ColorSequence = "RGBW";
                }
            }
            Name = string.Format($"{ControlSpace.Prefix}_{pointType}_");
        }
Exemple #6
0
 private static void CSprefixChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     if (d != null)
     {
         LE_UC         uc     = (LE_UC)d;
         string        prefix = (string)e.NewValue;
         PointTypeEnum pt     = uc.PointType;
         if (prefix == "AN" || prefix == "DX")
         {
             uc.lsProps.Visibility = Visibility.Visible;
             if (pt == PointTypeEnum.RGB || pt == PointTypeEnum.RGBW)
             {
                 uc.colorSeq.Visibility = Visibility.Visible;
             }
         }
         else
         {
             uc.lsProps.Visibility = Visibility.Collapsed;
         }
     }
 }
Exemple #7
0
 private static void PointTypeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     if (d != null)
     {
         LE_UC         uc     = (LE_UC)d;
         var           x      = uc.colorSeqCb;
         PointTypeEnum pt     = (PointTypeEnum)e.NewValue;
         string        prefix = uc.CSprefix;
         if (pt != PointTypeEnum.W && pt != PointTypeEnum.WT && pt != PointTypeEnum.CW)
         {
             uc.rgbProps.Visibility = Visibility.Visible;
             if (prefix == "AN" || prefix == "DX")
             {
                 uc.colorSeq.Visibility = Visibility.Visible;
             }
         }
         else
         {
             uc.rgbProps.Visibility = Visibility.Collapsed;
             uc.colorSeq.Visibility = Visibility.Collapsed;
         }
     }
 }
Exemple #8
0
        LightElementVM CreateLightElementVM(PointTypeEnum pointType)
        {
            LightElementVM leVM = null;
            LightElement   le   = new LightElement(pointType, AppContext.ControlSpace);

            le.Partition = AppContext.Partition;

            leVM = new LightElementVM(le);

            if (leVM.Model.ControlSpace.Prefix == "AN" || leVM.Model.ControlSpace.Prefix == "DX")
            {
                if (leVM.Model.PointType == PointTypeEnum.RGB)
                {
                    leVM.ColorSequenceList = LightElement.ColorSequenseRGB;
                }
                if (leVM.Model.PointType == PointTypeEnum.RGBW)
                {
                    leVM.ColorSequenceList = LightElement.ColorSequenseRGBW;
                }
            }

            return(leVM);
        }
Exemple #9
0
        void ParseProfile(string profile)
        {
            PointTypeEnum pt    = PointTypeEnum.W;
            XElement      xdata = XElement.Parse(profile);

            if (xdata.Attribute("Model") != null)
            {
                Model = xdata.Attribute("Model").Value;
            }
            HaveDimmer = bool.Parse(xdata.Attribute("HaveDimmer").Value);
            if (xdata.Attribute("Name") != null)
            {
                Name = xdata.Attribute("Name").Value;
            }
            Enum.TryParse(xdata.Attribute("PointType").Value, out pt);
            PointType = pt;
            if (Id == 0)
            {
                ControlChannels.Add(new NLPowerChannel()
                {
                    HaveDimmer = HaveDimmer, PointType = PointType
                });
            }
        }