Exemplo n.º 1
0
        public static HotspotDefinitionList JsonToHotspotList(string txt)
        {
            try
            {
                var retval      = new HotspotDefinitionList();
                var jBorderList = JArray.Parse(txt);

                // Parse out HOTSPOT Definitions
                foreach (var jRec in jBorderList)
                {
                    var rec = new HotspotDefinition();
                    rec.Active    = StringToBool((string)jRec["active"]);
                    rec.Id        = (int)jRec["id"];
                    rec.MaskColor = JsonToMaskColor(jRec["mask_color"]);
                    rec.Name      = (string)jRec["name"];
                    retval.HotspotDefinitions.Add(rec);
                }

                return(retval);
            }
            catch (Exception ex)
            {
                var newEx = new Exception("Invalid JSON data format returned for 'State'.", ex);
                throw newEx;
            }
        }
Exemplo n.º 2
0
        public HttpStatusCode GetListOfHotspots(out HotspotDefinitionList rec)
        {
            // To allow legacy code to work with the new SVG Configuration now used by MOVE, we'll map
            // the SVG structures into the legacy structures.
            // todo: CONTROL needs to upgrade to using the new SVG calls and data structures.

            AreaDefinitionList areasList;
            LineDefinitionList ignored;

            rec = new HotspotDefinitionList();
            var responseCode = GetSVGLayoutInfo(out areasList, out ignored);

            // Map SVG structure "AreaDefinitionList" into legacy "HotspotDefinitionList"
            foreach (var area in areasList.AreaDefinitions)
            {
                var hotspot = new HotspotDefinition();
                hotspot.Active    = area.Active;
                hotspot.Id        = area.Id;
                hotspot.MaskColor = GetSystemDrawingColorFromHexString(area.Color);
                hotspot.Name      = area.Name;
                rec.HotspotDefinitions.Add(hotspot);
            }

            return(responseCode);
        }