コード例 #1
0
        private void btnCreateProject_Click(object sender, RoutedEventArgs e)
        {
            if (currentHousePlan != null)
            {
                if (currentHousePlan.GetWalls().Count == 0)
                {
                    HousePlanControl currentHousePlanControl = listViewHousePlans.SelectedItem as HousePlanControl;
                    if (currentHousePlanControl == null)
                    {
                        MessageBox.Show("Select a house plan!");
                        return;
                    }

                    currentHousePlan = currentHousePlanControl.GetCurrentHousePlan();
                }

                if (projectProperties.CheckEmptyFields() == true)
                {
                    MessageBox.Show("Complete mandatory fields!");
                    return;
                }

                if (projectProperties.CheckValidFields() == false)
                {
                    return;
                }

                List <Wall> walls = currentHousePlan.GetWalls();
                Project.UnitOfMeasurement measurementUnit = Project.UnitOfMeasurement.mm;
                float wallsHeight = Convert.ToSingle(projectProperties.textBoxWallsHeight.Text);

                if (projectProperties.comboBoxMeasurementUnits.Text == Project.UnitOfMeasurement.m.ToString())
                {
                    wallsHeight    *= 1000;
                    measurementUnit = Project.UnitOfMeasurement.m;
                }
                if (projectProperties.comboBoxMeasurementUnits.Text == Project.UnitOfMeasurement.cm.ToString())
                {
                    wallsHeight    *= 10;
                    measurementUnit = Project.UnitOfMeasurement.cm;
                }
                Client client = new Client(projectProperties.textBoxClientName.Text, Convert.ToInt64(projectProperties.textBoxTelephoneNumber.Text),
                                           projectProperties.textBoxEmailAddress.Text);
                Decimal budget = Convert.ToDecimal(projectProperties.textBoxBudget.Text);
                String  notes  = projectProperties.textBoxNotes.Text;
                Scene   scene  = new Scene();
                scene.MainCamera.Translate = new Point3d(0, 500, 0);
                scene.MainCamera.Rotate    = new Point3d(-90, 180, 0);
                for (int i = 0; i < walls.Count; i++)
                {
                    WallObject wall = new WallObject(walls[i], wallsHeight);
                    scene.AddWall(wall);
                }
                currentProject = new Project(client, scene, configuration, CurrencyHelper.GetProjectCurrency(), wallsHeight, budget,
                                             notes, measurementUnit);

                this.Close();
            }
        }
コード例 #2
0
        public EditObject(WorldObject currentObject, List <Category <Material> > materials, float sceneHeight,
                          Decimal actualPrice, Decimal projectBudget, Project.UnitOfMeasurement measurementUnit, HouseDesign.Classes.Scene scene)
        {
            InitializeComponent();
            this.currentObject = currentObject.Clone();
            this.scene         = scene;

            this.currentObject.Translate = new Point3d(0, 0, 0);
            this.currentObject.Scale     = new Point3d(1, 1, 1);
            this.oldObject                = currentObject;
            selectedObjectMaterials       = new List <WorldObjectMaterial>();
            this.materials                = materials;
            ChosenHeight                  = 0;
            this.sceneHeight              = sceneHeight * 0.0025f;
            this.actualPrice              = actualPrice;
            this.projectBudget            = projectBudget;
            this.measurementUnit          = measurementUnit;
            textBlockMeasurementUnit.Text = measurementUnit.ToString();

            currentTradeAllowance = GetTradeAllowance(currentObject);

            selectedObjectMaterials.AddRange(currentObject.GetMaterials());
            InitializeScaleFactors();
            if (currentObject != null)
            {
                groupBoxPrices.Visibility = Visibility.Visible;
                InitializeMaterials();
                InitializePrices();
                InitializeDimensions();
            }

            if (currentObject.IsSuspendable)
            {
                checkBoxIsSuspendable_Checked(this, new RoutedEventArgs());
                checkBoxIsSuspendable.IsChecked = true;
                textBoxChosenHeight.Text        = (currentObject.Translate.Y / (realHeightScaleFactor * 50)).ToString();
            }

            WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
        }
コード例 #3
0
        public GenericCategory(Category <FurnitureObject> category, List <Category <Material> > materials, float sceneHeight,
                               Decimal actualPrice, Decimal projectBudget, Project.UnitOfMeasurement measurementUnit)
        {
            InitializeComponent();
            this.category           = category;
            this.materials          = materials;
            addPermission           = true;
            selectedObjectMaterials = new List <WorldObjectMaterial>();
            TreeViewItem mainTreeViewItem = new TreeViewItem();

            mainTreeViewItem.IsExpanded   = true;
            this.measurementUnit          = measurementUnit;
            textBlockMeasurementUnit.Text = measurementUnit.ToString();
            InitializeScaleFactors();
            treeViewCategory.Items.Add(mainTreeViewItem);
            PopulateTreeView(category, mainTreeViewItem);
            ChosenHeight          = 0;
            this.sceneHeight      = sceneHeight * 0.0025f;
            WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
            this.Title            = category.Name;
            currentTradeAllowance = Convert.ToDecimal(category.TradeAllowance);
            this.actualPrice      = actualPrice;
            this.projectBudget    = projectBudget;
        }