Exemplo n.º 1
0
        public Canvas ConstructContentObject(MtpVisualObjectRecord xaml)
        {
            var contentObject = xaml?.Symbol?.SymbolData as Canvas;

            contentObject = UIElementHelper.cloneElement(contentObject) as Canvas;
            return(contentObject);
        }
Exemplo n.º 2
0
        public MtpVisualObjectRecord FindVisualObjectByClass(
            string eClassVersion = null, string eClassClass = null, string eClassIRDI = null)
        {
            // prepare input
            eClassClass = MtpVisualObjectRecord.FilterEclassClass(eClassClass);

            // minimal match
            if (eClassClass != null)
            {
                eClassClass = eClassClass.Trim();
            }
            if (eClassIRDI != null)
            {
                eClassIRDI = eClassIRDI.Trim();
            }
            if ((eClassClass == null || eClassClass.Length < 1) &&
                (eClassIRDI == null || eClassIRDI.Length < 1))
            {
                return(null);
            }

            // try find
            MtpVisualObjectRecord foundRec = null;
            int foundPrio = -1;

            foreach (var rec in records)
            {
                // record either needs to have class or irdi
                if ((rec.eClassClasses == null || rec.eClassClasses.Count < 1) &&
                    (rec.eClassIRDIs == null || rec.eClassIRDIs.Count < 1))
                {
                    continue;
                }

                // try to find negative events!
                if (eClassVersion != null && eClassVersion.Length > 0 && rec.eClassVersions != null &&
                    !rec.eClassVersions.ContainsKey(eClassVersion))
                {
                    continue;
                }
                //// if (eClassClass != null && eClassClass.Length > 0 && rec.eClassClasses != null
                ////    && !rec.eClassClasses.ContainsKey(eClassClass))
                ////    continue;
                if (!MatchEclassClass(rec.eClassClasses, eClassClass))
                {
                    continue;
                }
                if (eClassIRDI != null && eClassIRDI.Length > 0 && rec.eClassIRDIs != null &&
                    !rec.eClassIRDIs.ContainsKey(eClassIRDI))
                {
                    continue;
                }

                // check if better?
                if (rec.Priority >= foundPrio)
                {
                    foundRec  = rec;
                    foundPrio = rec.Priority;
                }
            }

            // end of search
            return(foundRec);
        }