コード例 #1
0
        // The value parameter is -1 if we do not use an existing SM Config. Otherwise
        // it is the value of the allocation_quantum in the SM config.
        private void SetUpIncrAllocationNumericUpDown(decimal value)
        {
            Helpers.AllocationBounds allocBounds = Helpers.SRIncrementalAllocationBounds(SRSize);
            if (value != -1)
            {
                allocBounds = new Helpers.AllocationBounds(allocBounds.Min, allocBounds.Max, value);
            }

            incremental_allocation_units.SelectedItem = previousUnitsValueInitAlloc = allocBounds.Unit;
            SetNumUpDownIncrementAndDecimals(allocationQuantumNumericUpDown, allocBounds.Unit);

            allocationQuantumNumericUpDown.Minimum = allocBounds.MinInUnits;
            allocationQuantumNumericUpDown.Maximum = allocBounds.MaxInUnits;
            allocationQuantumNumericUpDown.Value   = allocBounds.DefaultValueInUnits;
        }
コード例 #2
0
        private void SetUpIncrAllocationNumericUpDown(long SRIncrementalAllocation, long SRSize, bool boundsOnly)
        {
            Helpers.AllocationBounds allocBounds = Helpers.VDIIncrementalAllocationBounds(SRSize, SRIncrementalAllocation);

            if (boundsOnly)
            {
                long userValInBytes = (long)(incr_alloc_units.SelectedItem.ToString() == Messages.VAL_GIGB ? allocationQuantumNumericUpDown.Value * Util.BINARY_GIGA
                                                                                                           : allocationQuantumNumericUpDown.Value * Util.BINARY_MEGA);
                allocBounds = new Helpers.AllocationBounds(allocBounds.Min, allocBounds.Max, userValInBytes,
                                                           incr_alloc_units.SelectedItem.ToString());
            }

            incr_alloc_units.SelectedItem = previousUnitsValueIncrAlloc = allocBounds.Unit;

            allocationQuantumNumericUpDown.Minimum = allocBounds.MinInUnits;
            allocationQuantumNumericUpDown.Maximum = allocBounds.MaxInUnits;
            allocationQuantumNumericUpDown.Value   = allocBounds.DefaultValueInUnits;

            SetNumUpDownIncrementAndDecimals(allocationQuantumNumericUpDown, allocBounds.Unit);
        }
コード例 #3
0
        private void SetUpInitAllocationNumericUpDown(long SRInitialAllocation, bool boundsOnly)
        {
            long vdiSizeBytes = (long)(SelectedUnits == DiskSizeUnits.GB ? DiskSizeNumericUpDown.Value * Util.BINARY_GIGA
                                                                          : DiskSizeNumericUpDown.Value * Util.BINARY_MEGA);

            Helpers.AllocationBounds allocBounds = Helpers.VDIInitialAllocationBounds(vdiSizeBytes, SRInitialAllocation);

            if (boundsOnly)
            {
                long userValInBytes = (long)(init_alloc_units.SelectedItem.ToString() == Messages.VAL_GIGB ? initialAllocationNumericUpDown.Value * Util.BINARY_GIGA
                                                                                                           : initialAllocationNumericUpDown.Value * Util.BINARY_MEGA);
                allocBounds = new Helpers.AllocationBounds(allocBounds.Min, allocBounds.Max,
                                                           userValInBytes, init_alloc_units.SelectedItem.ToString());
            }

            init_alloc_units.SelectedItem = previousUnitsValueInitAlloc = allocBounds.Unit;

            initialAllocationNumericUpDown.Minimum = allocBounds.MinInUnits;
            initialAllocationNumericUpDown.Maximum = allocBounds.MaxInUnits;
            initialAllocationNumericUpDown.Value   = allocBounds.DefaultValueInUnits;

            SetNumUpDownIncrementAndDecimals(initialAllocationNumericUpDown, allocBounds.Unit);
        }
コード例 #4
0
ファイル: NewDiskDialog.cs プロジェクト: robhoes/xenadmin
        private void SetUpIncrAllocationNumericUpDown(long SRIncrementalAllocation, long SRSize, bool boundsOnly)
        {
            Helpers.AllocationBounds allocBounds = Helpers.VDIIncrementalAllocationBounds(SRSize, SRIncrementalAllocation);

            if (boundsOnly)
            {
                long userValInBytes = (long)(incr_alloc_units.SelectedItem.ToString() == Messages.VAL_GIGB ? allocationQuantumNumericUpDown.Value * Util.BINARY_GIGA
                                                                                                           : allocationQuantumNumericUpDown.Value * Util.BINARY_MEGA);
                allocBounds = new Helpers.AllocationBounds(allocBounds.Min, allocBounds.Max, userValInBytes, 
                                                           incr_alloc_units.SelectedItem.ToString());
            }

            incr_alloc_units.SelectedItem = previousUnitsValueIncrAlloc = allocBounds.Unit;

            allocationQuantumNumericUpDown.Minimum = allocBounds.MinInUnits;
            allocationQuantumNumericUpDown.Maximum = allocBounds.MaxInUnits;
            allocationQuantumNumericUpDown.Value = allocBounds.DefaultValueInUnits;

            SetNumUpDownIncrementAndDecimals(allocationQuantumNumericUpDown, allocBounds.Unit);
        }        
コード例 #5
0
ファイル: NewDiskDialog.cs プロジェクト: robhoes/xenadmin
        private void SetUpInitAllocationNumericUpDown(long SRInitialAllocation, bool boundsOnly)
        {
            long vdiSizeBytes = (long) (SelectedUnits == DiskSizeUnits.GB ? DiskSizeNumericUpDown.Value * Util.BINARY_GIGA 
                                                                          : DiskSizeNumericUpDown.Value * Util.BINARY_MEGA);

            Helpers.AllocationBounds allocBounds = Helpers.VDIInitialAllocationBounds(vdiSizeBytes, SRInitialAllocation);

            if (boundsOnly)
            {
                long userValInBytes = (long)(init_alloc_units.SelectedItem.ToString() == Messages.VAL_GIGB ? initialAllocationNumericUpDown.Value * Util.BINARY_GIGA 
                                                                                                           : initialAllocationNumericUpDown.Value * Util.BINARY_MEGA);
                allocBounds = new Helpers.AllocationBounds(allocBounds.Min, allocBounds.Max, 
                                                           userValInBytes, init_alloc_units.SelectedItem.ToString());
            }

            init_alloc_units.SelectedItem = previousUnitsValueInitAlloc = allocBounds.Unit;

            initialAllocationNumericUpDown.Minimum = allocBounds.MinInUnits;
            initialAllocationNumericUpDown.Maximum = allocBounds.MaxInUnits;
            initialAllocationNumericUpDown.Value = allocBounds.DefaultValueInUnits;

            SetNumUpDownIncrementAndDecimals(initialAllocationNumericUpDown, allocBounds.Unit);
        }
コード例 #6
0
        // The value parameter is -1 if we do not use an existing SM Config. Otherwise  
        // it is the value of the allocation_quantum in the SM config. 
        private void SetUpIncrAllocationNumericUpDown(decimal value)
        {
            Helpers.AllocationBounds allocBounds = Helpers.SRIncrementalAllocationBounds(SRSize);
            if (value != -1)
            {
                allocBounds = new Helpers.AllocationBounds(allocBounds.Min, allocBounds.Max, value);
            }
            
            incremental_allocation_units.SelectedItem = previousUnitsValueInitAlloc = allocBounds.Unit;
            SetNumUpDownIncrementAndDecimals(allocationQuantumNumericUpDown, allocBounds.Unit);

            allocationQuantumNumericUpDown.Minimum = allocBounds.MinInUnits;
            allocationQuantumNumericUpDown.Maximum = allocBounds.MaxInUnits;
            allocationQuantumNumericUpDown.Value = allocBounds.DefaultValueInUnits;
        }