Example #1
0
        protected override bool OnSetActive()
        {
            if (!base.OnSetActive())
            {
                return(false);
            }

            log.InfoFormat("进入【存储配置】页面");
            SelectSRInfoLabel.Text = "";

            //ThreadStart threadStart = new ThreadStart(setVmName);
            //Thread thread = new Thread(threadStart);
            //thread.Start();

            string vdiSize = string.Format("{0:0.00}GB", ConnectManager.DiskCapacity / Constants.UINT);

            label1.Text = string.Format("所需磁盘容量为{0}, 请选择可用容量大于{1}的存储池", vdiSize, vdiSize);
            sROper      = new SROper();
            List <SRVo> srList = sROper.getSRByTargetHost();

            ////排序:降序
            //Reverser<SRVo> reverser = new Reverser<SRVo>(new SRVo().GetType(), "AvailableCapacity", ReverserInfo.Direction.DESC);
            //srList.Sort(reverser);
            ////排序
            //srList.Sort(delegate(SRVo x, SRVo y) { return x.AvailableCapacity.CompareTo(y.AvailableCapacity);});
            ////排序,使用Lambda表达式,升序
            //srList.Sort((x, y) => x.AvailableCapacity.CompareTo(y.AvailableCapacity));
            //排序,使用Lambda表达式,降序
            srList.Sort((x, y) => y.AvailableCapacity.CompareTo(x.AvailableCapacity));
            if (srList.Count > 0)
            {
                storageDataGridView.RowCount         = srList.Count;
                storageDataGridView.Rows[0].Selected = true;                //每次默认选中第一行
                for (int i = 0; i < srList.Count; i++)
                {
                    storageDataGridView.Rows[i].Cells["uuidColumn"].Value = srList[i].Uuid;
                    //int index = storageDataGridView.CurrentRow == null ? 0 : storageDataGridView.CurrentRow.Index;
                    int index = 0;
                    if (i == index)
                    {
                        storageDataGridView.Rows[i].Cells["checkBoxColumn"].Value = SelectedStatus.Selected;
                    }
                    else
                    {
                        storageDataGridView.Rows[i].Cells["checkBoxColumn"].Value = SelectedStatus.NoSelected;
                    }

                    storageDataGridView.Rows[i].Cells["nameLabelColumn"].Value         = srList[i].Name;
                    storageDataGridView.Rows[i].Cells["AvailableCapacityColumn"].Value = string.Format("{0:0.00}GB", srList[i].AvailableCapacity / Constants.UINT);
                    storageDataGridView.Rows[i].Cells["physicalSizeColumn"].Value      = string.Format("{0:0.00}GB", srList[i].PhysicalSize / Constants.UINT);
                    storageDataGridView.Rows[i].Cells["TypeColumn"].Value = srList[i].Type;
                    storageDataGridView.Rows[i].Cells["infoColumn"].Value = srList[i].Info;
                }
                //storageDataGridView.Sort(storageDataGridView.Columns["AvailableCapacityColumn"], ListSortDirection.Descending);
                Wizard.SetWizardButtons(WizardButton.Back | WizardButton.Next);
            }
            else
            {
                Wizard.SetWizardButtons(WizardButton.Back);
            }

            return(true);
        }
Example #2
0
 /// <summary>
 /// Constructor requires the  wizard that owns this collection
 /// </summary>
 /// <param name="parent">Wizard</param>
 public PageCollection(Wizard parent) : base()
 {
     vParent = parent;
 }