Ejemplo n.º 1
0
        private void menu_dependencies_tier(object sender, RoutedEventArgs e)
        {
            var mi = (MenuItem)sender;
            var cm = (ContextMenu)mi.Parent;
            var uib = (tier_ui_base)cm.PlacementTarget;
            var src_tier = (IPartsTier)uib.Tier;
            var igti = src_tier.TiersHost;

            var uic = uib.UiContent;

            var dep_tier = new DependenciesTier(src_tier.Parts, p => new DepPart { Source = p }, u =>
            {
                throw new Exception("slave tier (Dep) should not add new parts");
            })
            {
                TierType = "Dep"
            };
            igti.Add(dep_tier);
            #if false
            UpdateLayout();

            var pc = Panel.Children;
            var contp = (ContentPresenter)pc[pc.Count - 1];
            var tlp = contp.EnumerateVisualChildren().FirstOfType<TreeLayoutPanel>();
            tlp.Children.Clear();

            tree_ui_part x1 = null, x2 = null;
            foreach (var p in src_tier.Parts)
            {
                var dep = new CopyPart
                {
                    //PartsHost = p.PartsHost,
                    Source = p,
                };
                dep_tier.Add(dep);

                var tup = new tree_ui_part(dep);
                if (x1 == null)
                    x1 = tup;
                else if (x2 == null)
                    x2 = tup;
                else
                {
                    TreeLayoutPanel.SetTreeParent(x1, tup);
                    TreeLayoutPanel.SetTreeParent(x2, tup);
                    x1 = tup;
                    x2 = null;
                }
                tlp.Children.Add(tup);
            }
            #endif
        }
Ejemplo n.º 2
0
 public tree_ui_part(CopyPart dep)
     : this(dep.Text)
 {
     this.edge = dep;
 }
Ejemplo n.º 3
0
 public void Promote(IPart p)
 {
     int ix = Parts.IndexOf(p);
     var _old = Parts[ix];
     var _new = new CopyPart
     {
         Source = _old,
         //Target = new TextPart
         //{
         //	//PartsHost = _old.PartsHost,
         //	Text = _old.Text
         //},
     };
     Parts[ix] = _new;
 }