Exemple #1
0
        public LightGroup ReadLimitlessLampFile(String filePath)
        {
            LimitlessLampModel limitlessLampModel = ReadLimitlessLamp(filePath);
            List <int>         mData = new List <int>();

            String[] strs = limitlessLampModel.Data.Trim().Split(',');
            for (int i = 0; i < strs.Length; i++)
            {
                if (int.Parse(strs[i]) != 0)
                {
                    int color = int.Parse(strs[i]);
                    mData.Add(color);
                }
                else
                {
                    mData.Add(0);
                }
            }

            LightGroup ll = new LightGroup();

            for (int i = 0; i < limitlessLampModel.Points.Count; i++)
            {
                List <Light> mLl = SetDataToPreviewLaunchpadFromXY(mData, limitlessLampModel.Columns, limitlessLampModel.Rows, (int)limitlessLampModel.Points[i].X, (int)limitlessLampModel.Points[i].Y);
                for (int j = 0; j < mLl.Count; j++)
                {
                    mLl[j].Time = i * limitlessLampModel.Interval;
                }
                ll.AddRange(mLl);
            }
            CreateInstance().ReplaceControl(ll, CreateInstance().normalArr);
            return(ll);
        }
        protected override void LoadFileContent()
        {
            mLaunchpad.Reset();
            points.Clear();

            Operation.LimitlessLampModel limitlessLampModel = Operation.FileBusiness.CreateInstance().ReadLimitlessLamp(filePath);
            for (int i = 0; i < limitlessLampModel.Columns - 1; i++)
            {
                mLaunchpad.AddColumn();
            }
            for (int i = 0; i < limitlessLampModel.Rows - 1; i++)
            {
                mLaunchpad.AddRow();
            }
            mLaunchpad.SetData(limitlessLampModel.Data);
            points = limitlessLampModel.Points;
            lbPoint.Items.Clear();
            foreach (var point in points)
            {
                lbPoint.Items.Add(point.X + "," + point.Y);
            }
            tbInterval.Text = limitlessLampModel.Interval.ToString();
            //pageNames.Clear();
            //XElement xnPages = xnroot.Element("Pages");
            //foreach (XElement pageElement in xnPages.Elements("Page"))
            //{
            //    pageNames.Add(pageElement.Value);
            //}
            //for (int i = 0; i < pageNames.Count; i++)
            //    lbPages.Items.Add(pageNames[i]);
        }