|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Practices.Unity;
using RehostedDesigner.Services.Contracts;
using System.Activities.Presentation.Toolbox;
using RehostedDesigner.ToolboxModule.Contracts;
namespace RehostedDesigner.ToolboxModule
{
public class StandartToolboxViewModel : IToolboxViewModel
{
public StandartToolboxViewModel(IUnityContainer container)
{
this.ToolBox = new ToolboxControl();
if (container.IsRegistered<IToolboxCreatorService>())
{
this.ReloadToolboxIcons(container.Resolve<IToolboxCreatorService>());
}
}
public ToolboxControl ToolBox { get; private set; }
public void ReloadToolboxIcons(IToolboxCreatorService toolboxService)
{
List<ToolboxCategory> categories = toolboxService.GetCategories();
List<ToolboxItemWrapper> activityTypes = new List<ToolboxItemWrapper>();
categories.ForEach(cat => cat.Tools.ToList().ForEach(el => activityTypes.Add(el)));
ToolboxIconCreator.LoadToolboxIcons(activityTypes, toolboxService.GetIconReaders());
this.ToolBox.Categories.Clear();
categories.ForEach(cat => this.ToolBox.Categories.Add(cat));
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.