Example #1
0
 public void ActivateItem(ToolboxItem item)
 {
     if (item is ToolboxModule)
     {
         ProjectModule newView = ((ToolboxModule)item).Module;
         window.SetView(newView);
         ModuleComponent comp = window.CanvasAdding as ModuleComponent;
         if (comp != null && comp.Module == newView)
         {
             window.BeginAdd(null, null);
         }
     }
 }
    public static ModuleComponent[] SeederModuleArray()
    {
        int index  = 1;
        var result = new List <ModuleComponent>();
        var admin  = new ModuleComponent
        {
            Id           = index,
            DisplayOrder = 0,
            ModuleName   = "Admin",
            Level        = 0
        };

        result.Add(admin);
        var dashboard = new ModuleComponent
        {
            Id           = ++index,
            DisplayOrder = 1,
            ModuleName   = "Dashboard",
            Level        = 0
        };

        result.Add(dashboard);
        var Organisation = new ModuleComponent
        {
            Id           = ++index,
            ModuleName   = "Organisation",
            Level        = 1,
            DisplayOrder = 0,
            ParentId     = admin.Id
        };

        result.Add(Organisation);
        var Leave = new ModuleComponent
        {
            Id           = ++index,
            ModuleName   = "Leave",
            Level        = 1,
            DisplayOrder = 3,
            ParentId     = dashboard.Id
        };

        result.Add(Leave);
        return(result.ToArray());
    }
Example #3
0
        public void SelectItem(ToolboxItem item)
        {
            Component master;

            if (item is ToolboxComponent)
            {
                master = ((ToolboxComponent)item).Component;
            }
            else if (item is ToolboxModule)
            {
                ProjectModule module = ((ToolboxModule)item).Module;
                if (module == window.CurrentModule)
                {
                    OnToolboxChanged(ToolboxChangedArgs.ChangeTypes.ItemUnselected, item);
                    master = null;
                }
                else
                {
                    master = new ModuleComponent(module, () => {
                        Transaction xn      = new Transaction();
                        IProjectAccess proj = xn.RequestReadAccess(window.Project);
                        using (xn.Start()) {
                            return(proj.GetModuleName(module));
                        }
                    });
                }
            }
            else
            {
                master = null;
            }
            if (master != null)
            {
                window.BeginAdd(master, () => {
                    OnToolboxChanged(ToolboxChangedArgs.ChangeTypes.ItemUnselected, item);
                });
            }
        }
Example #4
0
 public Instance CreateInstance(ModuleComponent component)
 {
     return(new LayoutInstance(component, this));
 }
 public LayoutInstance(ModuleComponent component, LayoutModel layoutModel) : base(component)
 {
     this.subLayoutModel = layoutModel;
 }