Exemple #1
0
        /// <summary>
        /// FormNewBox constructor used when defining a new BoxProperties item
        /// </summary>
        /// <param name="document">Document in which the BoxProperties item is to be created</param>
        /// <param name="mode">Mode is either Mode.MODE_CASE or Mode.MODE_BOX</param>
        public FormNewBox(Document document, Mode mode)
        {
            InitializeComponent();
            // set unit labels
            UnitsManager.AdaptUnitLabels(this);
            // save document reference
            _document = document;
            // mode
            _mode = mode;

            switch (_mode)
            {
                case Mode.MODE_CASE:
                    tbName.Text = _document.GetValidNewTypeName(Resources.ID_CASE);
                    nudLength.Value = (decimal)UnitsManager.ConvertLengthFrom(400.0, UnitsManager.UnitSystem.UNIT_METRIC1);
                    nudWidth.Value = (decimal)UnitsManager.ConvertLengthFrom(300.0, UnitsManager.UnitSystem.UNIT_METRIC1);
                    nudHeight.Value = (decimal)UnitsManager.ConvertLengthFrom(200.0, UnitsManager.UnitSystem.UNIT_METRIC1);
                    nudInsideLength.Value = nudLength.Value - (decimal)UnitsManager.ConvertLengthFrom(6.0, UnitsManager.UnitSystem.UNIT_METRIC1);
                    nudInsideWidth.Value = nudWidth.Value - (decimal)UnitsManager.ConvertLengthFrom(6.0, UnitsManager.UnitSystem.UNIT_METRIC1);
                    nudInsideHeight.Value = nudHeight.Value - (decimal)UnitsManager.ConvertLengthFrom(6.0, UnitsManager.UnitSystem.UNIT_METRIC1);
                    nudTapeWidth.Value = (decimal)UnitsManager.ConvertLengthFrom(50, UnitsManager.UnitSystem.UNIT_METRIC1);
                    cbTapeColor.Color = Color.Beige;
                    break;
                case Mode.MODE_BOX:
                    tbName.Text = _document.GetValidNewTypeName(Resources.ID_BOX);
                    nudLength.Value = (decimal)UnitsManager.ConvertLengthFrom(120.0, UnitsManager.UnitSystem.UNIT_METRIC1);
                    nudWidth.Value = (decimal)UnitsManager.ConvertLengthFrom(60.0, UnitsManager.UnitSystem.UNIT_METRIC1);
                    nudHeight.Value = (decimal)UnitsManager.ConvertLengthFrom(30.0, UnitsManager.UnitSystem.UNIT_METRIC1);
                    nudInsideLength.Value = nudLength.Value - (decimal)UnitsManager.ConvertLengthFrom(6.0, UnitsManager.UnitSystem.UNIT_METRIC1);
                    nudInsideWidth.Value = nudWidth.Value - (decimal)UnitsManager.ConvertLengthFrom(6.0, UnitsManager.UnitSystem.UNIT_METRIC1);
                    nudInsideHeight.Value = nudHeight.Value - (decimal)UnitsManager.ConvertLengthFrom(6.0, UnitsManager.UnitSystem.UNIT_METRIC1);
                    break;
                default:
                    break;
            }
            // description (same as name)
            tbDescription.Text = tbName.Text;
            // color : all faces set together / face by face
            chkAllFaces.Checked = false;
            chkAllFaces_CheckedChanged(this, null);
            // set colors
            for (int i=0; i<6; ++i)
                _faceColors[i] = _mode == Mode.MODE_BOX ? Color.Turquoise : Color.Chocolate;
            // set textures
            _textures = new List<Pair<HalfAxis.HAxis, Texture>>();
            // set default face
            cbFace.SelectedIndex = 0;
            // net weight
            NetWeight = new OptDouble(false, UnitsManager.ConvertMassFrom(0.0, UnitsManager.UnitSystem.UNIT_METRIC1));
            // disable Ok button
            UpdateButtonOkStatus();
        }
 /// <summary>
 /// Constructor
 /// </summary>
 public FormNewCaseOfBoxes(Document document, CaseOfBoxesProperties caseOfBoxProperties)
 {
     InitializeComponent();
     // save document reference
     _document = document;
     // name / description
     if (null != caseOfBoxProperties)
     {
         tbName.Text = caseOfBoxProperties.Name;
         tbDescription.Text = caseOfBoxProperties.Description;
     }
     else
     {
         tbName.Text = _document.GetValidNewTypeName(Resources.ID_CASEOFBOXES);
         tbDescription.Text = tbName.Text;
     }
     // save CaseOfBoxesProperties
     _caseOfBoxesProperties = caseOfBoxProperties;
     // color : all faces set together / face by face
     chkAllFaces.Checked = caseOfBoxProperties.UniqueColor;
     chkAllFaces_CheckedChanged(this, null);
     // set colors
     for (int i = 0; i < 6; ++i)
         _faceColors[i] = caseOfBoxProperties.Colors[i];
     // set textures
     _textures = caseOfBoxProperties.TextureList;
     // set default face
     cbFace.SelectedIndex = 0;
     // disable Ok button
     UpdateButtonOkStatus();
 }
 public FormNewInterlayer(Document document)
 {
     InitializeComponent();
     // set unit labels
     UnitsManager.AdaptUnitLabels(this);
     // save document reference
     _document = document;
     // name / description
     tbName.Text = _document.GetValidNewTypeName(Resources.ID_INTERLAYER);
     tbDescription.Text = tbName.Text;
     // initialize value
     InterlayerLength = UnitsManager.ConvertLengthFrom(1200.0, UnitsManager.UnitSystem.UNIT_METRIC1);
     InterlayerWidth = UnitsManager.ConvertLengthFrom(1000.0, UnitsManager.UnitSystem.UNIT_METRIC1);
     Thickness = UnitsManager.ConvertLengthFrom(1.0, UnitsManager.UnitSystem.UNIT_METRIC1);
     // disable Ok button
     UpdateButtonOkStatus();
 }
 public FormNewBundle(Document document)
 {
     InitializeComponent();
     // set unit labels
     UnitsManager.AdaptUnitLabels(this);
     // save document reference
     _document = document;
     // name
     tbName.Text = _document.GetValidNewTypeName(Resources.ID_BUNDLE);
     tbDescription.Text = tbName.Text;
     // initialize value
     BundleLength = UnitsManager.ConvertLengthFrom(400.0, UnitsManager.UnitSystem.UNIT_METRIC1);
     BundleWidth = UnitsManager.ConvertLengthFrom(300.0, UnitsManager.UnitSystem.UNIT_METRIC1);
     UnitThickness = UnitsManager.ConvertLengthFrom(5.0, UnitsManager.UnitSystem.UNIT_METRIC1);
     NoFlats = 10;
     // disable Ok buttons
     UpdateButtonOkStatus();
 }
Exemple #5
0
        /// <summary>
        /// Constructor (new truck properties)
        /// </summary>
        /// <param name="document">Document to which the new item will belong</param>
        public FormNewTruck(Document document)
        {
            InitializeComponent();
            // set unit labels
            UnitsManager.AdaptUnitLabels(this);
            // save document reference
            _document = document;

            // initialize data
            tbName.Text = _document.GetValidNewTypeName(Resources.ID_TRUCK);
            TruckLength = UnitsManager.ConvertLengthFrom(13600, UnitsManager.UnitSystem.UNIT_METRIC1);
            TruckWidth = UnitsManager.ConvertLengthFrom(2450, UnitsManager.UnitSystem.UNIT_METRIC1);
            TruckHeight = UnitsManager.ConvertLengthFrom(2700, UnitsManager.UnitSystem.UNIT_METRIC1);
            TruckAdmissibleLoadWeight = UnitsManager.ConvertMassFrom(38000, UnitsManager.UnitSystem.UNIT_METRIC1);
            TruckColor = Color.LightBlue;
            // description
            tbDescription.Text = tbName.Text;
            // disable Ok button
            UpdateButtonOkStatus();
        }
 public FormNewCylinder(Document document)
 {
     InitializeComponent();
     // set unit labels
     UnitsManager.AdaptUnitLabels(this);
     // save document reference
     _document = document;
     // name / description
     tbName.Text = _document.GetValidNewTypeName(Resources.ID_CYLINDER);
     tbDescription.Text = tbName.Text;
     // properties
     nudDiameterOuter.Value = (decimal)UnitsManager.ConvertLengthFrom(2.0*75.0, UnitsManager.UnitSystem.UNIT_METRIC1);
     nudDiameterInner.Value = (decimal)UnitsManager.ConvertLengthFrom(0.0, UnitsManager.UnitSystem.UNIT_METRIC1);
     nudHeight.Value = (decimal)UnitsManager.ConvertLengthFrom(150.0, UnitsManager.UnitSystem.UNIT_METRIC1);
     nudWeight.Value = (decimal)UnitsManager.ConvertMassFrom(1.0, UnitsManager.UnitSystem.UNIT_METRIC1);
     cbColorWallOuter.Color = System.Drawing.Color.LightSkyBlue;
     cbColorWallInner.Color = System.Drawing.Color.Chocolate;
     cbColorTop.Color = System.Drawing.Color.Gray;
     // disable Ok button
     UpdateButtonOkStatus();
 }