Example #1
0
        public bool Group(string pInput, out ImageLayers pReturn)
        {
            ImageLayers temp = new ImageLayers(mName + " " + pInput);

            foreach (ImageLayer layer in mLayers)
            {
                if (layer.mName.Contains(pInput))
                {
                    temp.AddLayer(layer);
                }
            }

            pReturn = temp;
            if (temp.mLayers.Count > 0)
            {
                return(true);
            }
            return(false);
        }
Example #2
0
        public Multimeter(string pLayerPath)
        {
            ImageLayers segments    = new ImageLayers("mSegments");
            ImageLayers subsegments = new ImageLayers("mSubsegments");

            mFocusState = eFocusState.eNormal;

            mClickedPaint       = new SKPaint();
            mClickedPaint.Color = new SKColor(0, 0, 0, 200);

            //New layer images
            mSegments    = new List <ImageLayers>();
            mSubSegments = new List <ImageLayers>();
            mBargraph    = new ImageLayers("mBargraph");
            mOther       = new ImageLayers("mOther");

            //Sort images into appropreate layered images
            string[] files = System.IO.Directory.GetFiles(pLayerPath);
            foreach (string filename in files)
            {
                if (filename.Contains("seg"))
                {
                    segments.AddLayer(filename);
                }

                else if (filename.Contains("sub"))
                {
                    subsegments.AddLayer(filename);
                }

                else if (filename.Contains("bar"))
                {
                    mBargraph.AddLayer(filename);
                }

                else
                {
                    mOther.AddLayer(filename);
                }
            }

            //Sort Images alphabetically within layered images
            subsegments.Sort();
            mBargraph.Sort();
            segments.Sort();
            mOther.Sort();

            //Sort segments and subsegments into seperate digits
            ImageLayers returned;
            int         i;

            //Setup the different segments
            i = 1;
            while (segments.Group("seg" + (i++).ToString(), out returned))
            {
                mSegments.Add(returned);
            }

            //Setup the different subsegments
            i = 1;
            while (subsegments.Group("sub" + (i++).ToString(), out returned))
            {
                mSubSegments.Add(returned);
            }

            //Move decimal point to the end
            foreach (ImageLayers temp in mSegments)
            {
                temp.ToBottom("dp");
            }

            foreach (ImageLayers temp in mSubSegments)
            {
                temp.ToBottom("dp");
            }
        }