Ejemplo n.º 1
0
        private void UpdateDiskSize()
        {
            // Don't use DiskSizeNumericUpDown.Value here, as it will fire the NumericUpDown built-in validation. Use Text property instead. (CA-46028)
            decimal newValue;

            if (decimal.TryParse(DiskSizeNumericUpDown.Text.Trim(), out newValue))
            {
                try
                {
                    SrListBox.DiskSize = (long)(Math.Round(newValue * GetUnits()));

                    if (IsSelectedSRThinProvisioned && userChangedInitialAllocationValue)
                    {
                        SrListBox.OverridenInitialAllocationRate = (long)(init_alloc_units.SelectedItem.ToString() == Messages.VAL_MEGB ? initialAllocationNumericUpDown.Value * Util.BINARY_MEGA
                                                                                                                                        : initialAllocationNumericUpDown.Value * Util.BINARY_GIGA);
                    }
                }
                catch (OverflowException)
                {
                    //CA-71312
                    SrListBox.DiskSize = newValue < 0 ? long.MinValue : long.MaxValue;
                }
                SrListBox.UpdateDiskSize();
                if (IsSelectedSRThinProvisioned)
                {
                    DefaultToSRsConfig(userChangedInitialAllocationValue);
                }
            }
            RefreshMinSize();
            updateErrorsAndButtons();
        }
Ejemplo n.º 2
0
        private void UpdateDiskSize()
        {
            // Don't use DiskSizeNumericUpDown.Value here, as it will fire the NumericUpDown built-in validation. Use Text property instead. (CA-46028)
            decimal newValue;

            if (decimal.TryParse(DiskSizeNumericUpDown.Text.Trim(), out newValue))
            {
                try
                {
                    SrListBox.DiskSize = (long)(Math.Round(newValue * GetUnits()));
                }
                catch (OverflowException)
                {
                    //CA-71312
                    SrListBox.DiskSize = newValue < 0 ? long.MinValue : long.MaxValue;
                }
                SrListBox.UpdateDiskSize();
            }
            RefreshMinSize();
            updateErrorsAndButtons();
        }
Ejemplo n.º 3
0
        private void UpdateErrorsAndButtons()
        {
            // Ordering is important here, we want to show the most relevant message
            // The error should be shown only for size errors

            if (!diskSpinner1.IsSizeValid)
            {
                OkButton.Enabled = false;
                return;
            }

            SrListBox.DiskSize = diskSpinner1.SelectedSize;
            SrListBox.UpdateDiskSize();

            if (!SrListBox.ValidSelectionExists)//all SRs disabled
            {
                OkButton.Enabled = false;
                diskSpinner1.SetError(Messages.NO_VALID_DISK_LOCATION);
                return;
            }

            if (SrListBox.SR == null) //enabled SR exists but the user selects a disabled one
            {
                OkButton.Enabled = false;
                diskSpinner1.SetError(null);
                return;
            }

            if (string.IsNullOrEmpty(NameTextBox.Text.Trim()))
            {
                OkButton.Enabled = false;
                diskSpinner1.SetError(null);
                return;
            }

            OkButton.Enabled = true;
            diskSpinner1.SetError(null);
        }