Пример #1
0
        private void AddToolboxItem(Visual documentBaseVisual, LayoutWidgetType type, string svgIcon, string caption)
        {
            var item = new LayoutingToolboxItemViewModel
            {
                Type               = type,
                SvgIcon            = svgIcon,
                Name               = caption,
                DocumentBaseVisual = documentBaseVisual
            };

            item.LayoutingItemDragStart += Item_LayoutingItemDragStart;
            item.LayoutingItemDragStop  += Item_LayoutingItemDragStop;
            ToolboxItems.Add(item);
        }
Пример #2
0
        public MainWindow()
        {
            // create settings before InitializeComponent()
            windowSettings = new WindowSettings(this);

            InitializeComponent();


            CreateCommands();

            _toolPanels = new List <ToolPanel>
            {
                ObjectsToolbox,
                PropertiesToolbox,
                SolutionToolbox,
                ToolboxToolbox
            };

            foreach (var panel in _toolPanels)
            {
                panel.MouseLeftButtonDown += Toolbox_MouseLeftButtonDown;
            }

            _objectsTreeView = (TreeView)GetByUid(this, "ObjectsTreeView");


            Models = new XamlDocuments();
            Models.PropertyChanged += ModelPropertyChanged;
            Models.DocumentAdded   += ModelsDocumentAdded;

            Toolbox = new ToolboxItems(Constants.PathToAssembly);
            var ToolBoxListBox = (ListBox)GetByUid(ToolboxToolbox, "ToolBoxListBoxUid");

            if (ToolBoxListBox != null)
            {
                ToolBoxListBox.ItemsSource = Toolbox.Types; //this should be done in code, because listbox located inside a container
            }

            Editors = new ObservableCollection <EditorView>();

            //EditorsContainer.ItemsSource = Editors;

            _propertiesTree = (TreeView)GetByUid(PropertiesToolbox, "PropertiesTree");

            DataContext = this;

            //var propertiesSearchPanel = (StackPanel)GetByUid(PropertiesToolbox, "PropertiesSearchPanel");
            //propertiesSearchPanel.DataContext = PropertiesViewModel;
        }
Пример #3
0
        private void LoadToolboxItems()
        {
            if (ToolboxItems == null)
            {
                ToolboxItems = new ObservableCollection <ToolboxItem>();
            }
            ToolboxItems.Clear();

            foreach (var factory in ActivityViewFactories.Where(f => f.Metadata.IsToolboxItem))
            {
                ToolboxItems.Add(new ToolboxItem
                {
                    Caption      = factory.Metadata.Caption,
                    ActivityType = factory.Metadata.TargetType
                });
            }
        }
 internal ToolboxItemData(SerializationInfo info, StreamingContext context)
 {
     ToolboxItem = (ToolboxItems)info.GetValue("Item", typeof(ToolboxItems));
 }
 /// <summary>
 /// Overloaded constructor.
 /// </summary>
 /// <param name="toolboxItem">Identifies the toolbox item type</param>
 public ToolboxItemData(ToolboxItems toolboxItem)
 {
     ToolboxItem = toolboxItem;
 }