示例#1
0
        void importMaterial_StatusUpdated(object sender, EventArgs e)
        {
            Material importedMaterial = (sender as ImportMaterial).GetImportedMaterial();

            if ((sender as ImportMaterial).IsEdited)
            {
                selectedTreeViewItem.Tag = importedMaterial;
                SaveMaterials();
                InitializeTreeViewMaterials();
                TreeViewItem parent = selectedTreeViewItem.Parent as TreeViewItem;
                if (parent != null)
                {
                    parent.IsExpanded = true;
                }
                groupBoxPreviewMaterial.Content = null;
                //(sender as ImportMaterial).SetImportedMaterial(null);
            }
            else
            {
                ExtendedTreeViewItem extendedItem = new ExtendedTreeViewItem(importedMaterial.FullPath, importedMaterial.Name, importedMaterial.FullPath);
                TreeViewItem         item         = new TreeViewItem();
                item.Tag    = importedMaterial;
                item.Header = extendedItem;
                if (selectedTreeViewItem != null)
                {
                    selectedTreeViewItem.Items.Add(item);
                    Category <Material> currentCategory = selectedTreeViewItem.Tag as Category <Material>;
                    currentCategory.StoredObjects.Add(importedMaterial);
                    SaveMaterials();
                }
                (sender as ImportMaterial).SetImportedMaterial(new Material());
            }
        }
示例#2
0
        void addCategory_StatusUpdated(object sender, EventArgs e)
        {
            Category <FurnitureObject> currentCategory = (sender as AddCategory).CurrentCategory;

            if ((sender as AddCategory).IsEdited == true)
            {
                if (selectedTreeViewItem != null)
                {
                    selectedTreeViewItem.Tag = currentCategory;
                    SaveCategories();
                    InitializeTreeViewCategories();
                    groupBoxRightSide.Content = null;
                }
            }
            else
            {
                ExtendedTreeViewItem extendedItem = new ExtendedTreeViewItem(currentCategory.Path, currentCategory.Name, "");
                TreeViewItem         item         = new TreeViewItem();
                item.Tag    = currentCategory;
                item.Header = extendedItem;
                if (selectedTreeViewItem == null)
                {
                    treeViewCategories.Items.Add(item);
                }
                else
                {
                    selectedTreeViewItem.Items.Add(item);
                    selectedTreeViewItem.IsExpanded = true;
                }
            }
        }
 public void InitializeTreeViewMaterials()
 {
     for (int i = 0; i < materials.Count; i++)
     {
         TreeViewItem         item         = new TreeViewItem();
         ExtendedTreeViewItem extendedItem = new ExtendedTreeViewItem(materials[i].Path, materials[i].Name, materials[i].Path);
         item.Tag    = materials[i];
         item.Header = extendedItem;
         InitializeTreeViewItemMaterials(materials[i], item);
         treeViewMaterials.Items.Add(item);
     }
 }
        public void InitializeTreeViewItemMaterials(TreeViewItem item)
        {
            Category <Material> currentCategory = item.Tag as Category <Material>;

            for (int i = 0; i < currentCategory.SubCategories.Count; i++)
            {
                ExtendedTreeViewItem extendedItem = new ExtendedTreeViewItem(currentCategory.SubCategories[i].Path,
                                                                             currentCategory.SubCategories[i].Name, "");
                TreeViewItem successorItem = new TreeViewItem();
                successorItem.Tag    = currentCategory.SubCategories[i];
                successorItem.Header = extendedItem;
                InitializeTreeViewItemMaterials(successorItem);
                item.Items.Add(successorItem);
            }
        }
示例#5
0
        public void InitializeTreeViewMaterials()
        {
            treeViewMaterials.Items.Clear();
            List <Category <Material> > categories = configuration.Materials;

            for (int i = 0; i < categories.Count; i++)
            {
                ExtendedTreeViewItem extendedItem = new ExtendedTreeViewItem(categories[i].Path, categories[i].Name, "");
                TreeViewItem         item         = new TreeViewItem();
                item.Tag    = categories[i];
                item.Header = extendedItem;
                InitializeTreeViewItemMaterials(item);
                treeViewMaterials.Items.Add(item);
            }
        }
示例#6
0
        private TreeViewItem GetTreeViewItemCopy(TreeViewItem item)
        {
            TreeViewItem copy = new TreeViewItem();

            copy.Tag = item.Tag;
            ExtendedTreeViewItem f = item.Header as ExtendedTreeViewItem;

            copy.Header = new ExtendedTreeViewItem(f.IconPath, f.HeaderName, f.FullPath);
            for (int i = 0; i < item.Items.Count; i++)
            {
                TreeViewItem currentSuccessor = GetTreeViewItemCopy(item.Items[i] as TreeViewItem);
                copy.Items.Add(currentSuccessor);
            }
            return(copy);
        }
 public void PopulateTreeView(Category <FurnitureObject> mainCategory, TreeViewItem currentItem)
 {
     foreach (FurnitureObject obj in mainCategory.StoredObjects)
     {
         ExtendedTreeViewItem extendedItem = new ExtendedTreeViewItem(obj.DefaultIconPath, obj.Name, obj.FullPath);
         extendedItem.Tag = obj;
         TreeViewItem item = new TreeViewItem();
         item.Header = extendedItem;
         currentItem.Items.Add(item);
     }
     foreach (Category <FurnitureObject> c in mainCategory.SubCategories)
     {
         ExtendedTreeViewItem extendedItem = new ExtendedTreeViewItem(c.Path, c.Name, c.Path);
         extendedItem.Tag = "category";
         TreeViewItem item = new TreeViewItem();
         item.Header = extendedItem;
         currentItem.Items.Add(item);
         PopulateTreeView(c, item);
     }
 }
示例#8
0
        private void importObject_StatusUpdated(object sender, EventArgs e)
        {
            ImportObject    importObject   = sender as ImportObject;
            FurnitureObject importedObject = importObject.GetImportedObject();

            if ((sender as ImportObject).IsEdited)
            {
                selectedTreeViewItem.Tag = importedObject;
                SaveCategories();
                InitializeTreeViewCategories();
                TreeViewItem parent = selectedTreeViewItem.Parent as TreeViewItem;
                if (parent != null)
                {
                    parent.IsExpanded = true;
                }
                groupBoxRightSide.Content = null;
            }
            else
            {
                ExtendedTreeViewItem extendedItem = new ExtendedTreeViewItem(importedObject.DefaultIconPath, importedObject.Name, importedObject.FullPath);
                TreeViewItem         item         = new TreeViewItem();
                item.Tag    = importedObject;
                item.Header = extendedItem;
                if (selectedTreeViewItem != null)
                {
                    selectedTreeViewItem.Items.Add(item);
                    Category <FurnitureObject> currentCategory = selectedTreeViewItem.Tag as Category <FurnitureObject>;
                    currentCategory.StoredObjects.Add(importedObject);
                    SaveCategories();
                }
                if (importObject.ExistingImportedMaterials == true)
                {
                    configuration.Materials = importObject.GetMaterials();
                    InitializeTreeViewMaterials();
                    groupBoxPreviewMaterial.Content = null;
                }
            }
        }
        public void InitializeTreeViewItemMaterials(Category <Material> materialCategory, TreeViewItem item)
        {
            for (int i = 0; i < materialCategory.SubCategories.Count; i++)
            {
                Category <Material>  currentCategory = materialCategory.SubCategories[i];
                TreeViewItem         successorItem   = new TreeViewItem();
                ExtendedTreeViewItem extendedItem    = new ExtendedTreeViewItem(currentCategory.Path, currentCategory.Name, currentCategory.Path);
                successorItem.Tag    = currentCategory;
                successorItem.Header = extendedItem;
                InitializeTreeViewItemMaterials(currentCategory, successorItem);
                item.Items.Add(successorItem);
            }

            for (int i = 0; i < materialCategory.StoredObjects.Count; i++)
            {
                Material             material          = materialCategory.StoredObjects[i];
                TreeViewItem         successorItem     = new TreeViewItem();
                ExtendedTreeViewItem extendedSuccessor = new ExtendedTreeViewItem(material.FullPath, material.Name, material.FullPath);
                successorItem.Tag    = material;
                successorItem.Header = extendedSuccessor;
                item.Items.Add(successorItem);
            }
        }
示例#10
0
        public void InitializeTreeViewItemMaterials(TreeViewItem item)
        {
            Category <Material> currentCategory = item.Tag as Category <Material>;

            for (int i = 0; i < currentCategory.SubCategories.Count; i++)
            {
                ExtendedTreeViewItem extendedItem  = new ExtendedTreeViewItem(currentCategory.SubCategories[i].Path, currentCategory.SubCategories[i].Name, "");
                TreeViewItem         successorItem = new TreeViewItem();
                successorItem.Tag    = currentCategory.SubCategories[i];
                successorItem.Header = extendedItem;
                InitializeTreeViewItemMaterials(successorItem);
                item.Items.Add(successorItem);
            }

            for (int i = 0; i < currentCategory.StoredObjects.Count; i++)
            {
                Material             material     = currentCategory.StoredObjects[i];
                ExtendedTreeViewItem extendedItem = new ExtendedTreeViewItem(material.FullPath, material.Name, material.FullPath);
                TreeViewItem         objectItem   = new TreeViewItem();
                objectItem.Tag    = material;
                objectItem.Header = extendedItem;
                item.Items.Add(objectItem);
            }
        }
示例#11
0
        public void InitializeTreeViewItemCategories(TreeViewItem item)
        {
            Category <FurnitureObject> currentCategory = item.Tag as Category <FurnitureObject>;

            for (int i = 0; i < currentCategory.SubCategories.Count; i++)
            {
                ExtendedTreeViewItem extendedItem  = new ExtendedTreeViewItem(currentCategory.SubCategories[i].Path, currentCategory.SubCategories[i].Name, "");
                TreeViewItem         successorItem = new TreeViewItem();
                successorItem.Tag    = currentCategory.SubCategories[i];
                successorItem.Header = extendedItem;
                InitializeTreeViewItemCategories(successorItem);
                item.Items.Add(successorItem);
            }

            for (int i = 0; i < currentCategory.StoredObjects.Count; i++)
            {
                FurnitureObject      currentObject = currentCategory.StoredObjects[i];
                ExtendedTreeViewItem extendedItem  = new ExtendedTreeViewItem(currentObject.DefaultIconPath, currentObject.Name, currentObject.FullPath);
                TreeViewItem         objectItem    = new TreeViewItem();
                objectItem.Tag    = currentObject;
                objectItem.Header = extendedItem;
                item.Items.Add(objectItem);
            }
        }