Example #1
0
        public void MoveObject(
            string sourceNamespace,
            string objectClassName,
            string targetNamespace
            )
        {
            if (sourceNamespace is null)
            {
                throw new ArgumentNullException(nameof(sourceNamespace));
            }

            if (objectClassName is null)
            {
                throw new ArgumentNullException(nameof(objectClassName));
            }

            if (targetNamespace is null)
            {
                throw new ArgumentNullException(nameof(targetNamespace));
            }

            var combined = new List <IXamlPerformable>();

            combined.AddRange(Controls);
            combined.AddRange(RefFroms);
            combined.AddRange(Classes);

            //in backward order!
            foreach (var positioned in combined.OrderByDescending(c => c.Index))
            {
                var performable = positioned as IXamlPerformable;

                if (performable.Perform(
                        sourceNamespace,
                        objectClassName,
                        targetNamespace,
                        ref _xaml,
                        out var newXmlns
                        ))
                {
                    _changesExists = true;

                    if (newXmlns != null)
                    {
                        Xmlns.Add(newXmlns);
                    }
                }
            }

            var reloadedXmlns = ReadXmlns().ToList();

            if (reloadedXmlns.Count > 0)
            {
                var indexToInsert = reloadedXmlns.Max(x => x.Index + x.Length);

                foreach (var xmlns in Xmlns.Where(x => !x.Saved))
                {
                    xmlns.SaveTo(ref _xaml, ref indexToInsert);
                }
            }
        }
 /// <summary>
 /// MPItemViews class constructor
 /// </summary>
 public ItemViewList()
 {
     Items = new List <ItemView>();
     Xmlns.Add("ns2", "http://walmart.com/");
 }
Example #3
0
 /// <summary>
 /// Inventory class constructor
 /// </summary>
 public Inventory()
 {
     Quantity = new Quantity();
     Xmlns.Add("wm", "http://walmart.com/");
 }