コード例 #1
0
 internal void Add(BaseComponent component)
 {
     component.Accept(new ObjectModifyVisitor(this.Model));
     component.Accept(new ViewDirectorVisitor(ViewFactory, this.view.Font));
     component.Init();
     this.Model.Items.Add(component);
     this.Model.Items = this.Model.Items.OrderBy(x => x.SortOrder).ToList();
     this.view.Invalidate();
     component.Changed     += new Action <BaseComponent>(Component_Change);
     this.SelectedComponent = component;
     CommitChange();
 }
コード例 #2
0
 private void LoadInstance()
 {
     try
     {
         FlowChartComponent fc = Util.ConvertFromJSON <FlowChartComponent>(System.Windows.Forms.Clipboard.GetText());
         BaseComponent      c  = (BaseComponent)Activator.CreateInstance(Type.GetType(fc.Type));
         c.SetComponent(fc);
         c.ID = Util.GetUniqueID();
         c.Accept(new ObjectCreateVisitor(Model, fc));
         this.OnAdd(c);
     }
     catch
     {
     }
 }
コード例 #3
0
        internal void Load(FlowChartContainer container)
        {
            this.isReseting        = true;
            this.SelectedComponent = null;
            this.Model.Items.Clear();

            container.Items.ForEach(x => {
                BaseComponent c = (BaseComponent)Activator.CreateInstance(Type.GetType(x.Type));
                c.SetComponent(x);
                this.Add(c);
            });

            container.Items.ForEach(x =>
            {
                BaseComponent c = this.Model.Items.Find(y => y.ID == x.ID);
                c.Accept(new ObjectCreateVisitor(Model, x));
            });

            this.view.Invalidate();
            this.isReseting = false;
        }