Ejemplo n.º 1
0
        private void treeViewMaterials_Selected(object sender, RoutedEventArgs e)
        {
            const string iconsMaterialDirectory = @"Icons\IconsMaterialCategory";

            if (selectedItemType == LastSelectedItemType.CategoryMaterial || selectedItemType == LastSelectedItemType.Material)
            {
                lastSelectedTreeViewItem = selectedTreeViewItem;
                lastSelectedItemType     = selectedItemType;
            }

            selectedTreeViewItem = e.OriginalSource as TreeViewItem;
            if (selectedTreeViewItem.Tag is Category <Material> )
            {
                selectedItemType = LastSelectedItemType.CategoryMaterial;
                Category <Material> currentCategory = selectedTreeViewItem.Tag as Category <Material>;
                AddMaterialCategory addCategory     = new AddMaterialCategory(currentCategory.Name, currentCategory, true, false, System.IO.Path.GetFullPath(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"..\..\", iconsMaterialDirectory)));
                Grid grid = new Grid();
                grid.Children.Add(addCategory);
                groupBoxPreviewMaterial.Content = grid;
            }
            else
            {
                if (selectedTreeViewItem.Tag is Material)
                {
                    selectedItemType = LastSelectedItemType.Material;
                    Material       material       = selectedTreeViewItem.Tag as Material;
                    ImportMaterial importMaterial = new ImportMaterial("Material", material, true, false, false);
                    importMaterial.StatusUpdated += importMaterial_StatusUpdated;
                    Grid grid = new Grid();
                    grid.Children.Add(importMaterial);
                    groupBoxPreviewMaterial.Content = grid;
                }
            }
        }
Ejemplo n.º 2
0
        private void extendedMenuItemNew_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            const string iconsCategoryDirectory = @"Icons\IconsCategory";
            const string iconsMaterialDirectory = @"Icons\IconsMaterialCategory";
            TabItem      currentTabItem         = (TabItem)mainTabControl.SelectedItem;

            if (currentTabItem.Header.ToString() == "Categories")
            {
                AddCategory addCategory = new AddCategory("New Category", null, false, false, System.IO.Path.GetFullPath(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"..\..\", iconsCategoryDirectory)));
                addCategory.StatusUpdated += addCategory_StatusUpdated;
                Grid grid = new Grid();
                grid.Children.Add(addCategory);
                groupBoxRightSide.Content = grid;
            }
            else
            {
                AddMaterialCategory addMaterialCategory = new AddMaterialCategory("New Material Category", null, false, false, System.IO.Path.GetFullPath(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"..\..\", iconsMaterialDirectory)));
                addMaterialCategory.StatusUpdated += addMaterialCategory_StatusUpdated;
                Grid grid = new Grid();
                grid.Children.Add(addMaterialCategory);
                groupBoxPreviewMaterial.Content = grid;
            }
        }
Ejemplo n.º 3
0
        private void extendedMenuItemEdit_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            const string iconsMaterialDirectory = @"Icons\IconsMaterialCategory";
            const string iconsCategoryDirectory = @"Icons\IconsCategory";
            TabItem      item = mainTabControl.SelectedItem as TabItem;

            if (item != null)
            {
                if (item.Header.ToString() == "Company")
                {
                    companyInformation.UnsetReadOnlyFields();
                    companyInformation.isEdited = true;
                    return;
                }
            }
            if (selectedItemType == LastSelectedItemType.Category)
            {
                Category <FurnitureObject> currentCategory = selectedTreeViewItem.Tag as Category <FurnitureObject>;
                AddCategory addCategory = new AddCategory("Edit Category", currentCategory, false, true, System.IO.Path.GetFullPath(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"..\..\", iconsCategoryDirectory)));
                addCategory.StatusUpdated += addCategory_StatusUpdated;
                Grid grid = new Grid();
                grid.Children.Add(addCategory);
                groupBoxRightSide.Content = grid;
            }
            else
            {
                if (selectedItemType == LastSelectedItemType.FurnitureObject)
                {
                    //electedItemType = LastSelectedItemType.FurnitureObject;
                    FurnitureObject currentObject  = selectedTreeViewItem.Tag as FurnitureObject;
                    double          tradeAllowance = ((selectedTreeViewItem.Parent as TreeViewItem).Tag as Category <FurnitureObject>).TradeAllowance;
                    ImportObject    importObject   = new ImportObject("Import Object", currentObject, configuration.Materials, false, true, tradeAllowance);
                    importObject.StatusUpdated += importObject_StatusUpdated;
                    importObject.ImportMaterialStatusUpdated += importObject_ImportMaterialStatusUpdated;
                    Grid grid = new Grid();
                    grid.Children.Add(importObject);
                    groupBoxRightSide.Content = grid;
                }
                else
                {
                    if (selectedItemType == LastSelectedItemType.CategoryMaterial)
                    {
                        Category <Material> currentMaterialCategory = selectedTreeViewItem.Tag as Category <Material>;
                        AddMaterialCategory addMaterialCategory     = new AddMaterialCategory("Edit Material Category", currentMaterialCategory, false, true, System.IO.Path.GetFullPath(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"..\..\", iconsMaterialDirectory)));
                        addMaterialCategory.StatusUpdated += addMaterialCategory_StatusUpdated;
                        Grid grid = new Grid();
                        grid.Children.Add(addMaterialCategory);
                        groupBoxPreviewMaterial.Content = grid;
                    }
                    else
                    {
                        Material       currentMaterial = selectedTreeViewItem.Tag as Material;
                        ImportMaterial importMaterial  = new ImportMaterial("Import Material", currentMaterial, false, true, false);
                        importMaterial.StatusUpdated += importMaterial_StatusUpdated;
                        Grid grid = new Grid();
                        grid.Children.Add(importMaterial);
                        groupBoxPreviewMaterial.Content = grid;
                    }
                }
            }
        }