コード例 #1
0
ファイル: AttachDiskDialog.cs プロジェクト: ywwseu/xenadmin
 protected override int SameLevelSortOrder(CustomTreeNode other)
 {
     DiskListSrItem otherItem = other as DiskListSrItem;
     if (otherItem == null) //shouldnt ever happen!!!
         return -1;
     int rank = this.SrRank() - otherItem.SrRank();
     if (rank == 0)
         return base.SameLevelSortOrder(other);
     else
         return rank;
 }
コード例 #2
0
        private void BuildList()
        {
            Program.AssertOnEventThread();

            DiskListVdiItem lastSelected = DiskListTreeView.SelectedItem as DiskListVdiItem;

            String oldRef = "";

            if (lastSelected != null)
            {
                oldRef = lastSelected.TheVDI.opaque_ref;
            }

            DiskListTreeView.BeginUpdate();
            try
            {
                DiskListTreeView.ClearAllNodes();

                foreach (SR sr in connection.Cache.SRs)
                {
                    DiskListSrItem item = new DiskListSrItem(sr, TheVM);
                    if (item.Show)
                    {
                        DiskListTreeView.AddNode(item);
                        foreach (VDI TheVDI in sr.Connection.ResolveAllShownXenModelObjects(sr.VDIs, Properties.Settings.Default.ShowHiddenVMs))
                        {
                            DiskListVdiItem VDIitem = new DiskListVdiItem(TheVDI);
                            if (VDIitem.Show)
                            {
                                DiskListTreeView.AddChildNode(item, VDIitem);
                            }
                            TheVDI.PropertyChanged -= new PropertyChangedEventHandler(Server_Changed);
                            TheVDI.PropertyChanged += new PropertyChangedEventHandler(Server_Changed);
                        }
                    }
                    sr.PropertyChanged -= new PropertyChangedEventHandler(Server_Changed);
                    sr.PropertyChanged += new PropertyChangedEventHandler(Server_Changed);
                }
            }
            finally
            {
                DiskListTreeView.EndUpdate();
                DiskListTreeView.SelectedItem = SelectByRef(oldRef);
            }
        }
コード例 #3
0
        protected override int SameLevelSortOrder(CustomTreeNode other)
        {
            DiskListSrItem otherItem = other as DiskListSrItem;

            if (otherItem == null) //shouldnt ever happen!!!
            {
                return(-1);
            }
            int rank = this.SrRank() - otherItem.SrRank();

            if (rank == 0)
            {
                return(base.SameLevelSortOrder(other));
            }
            else
            {
                return(rank);
            }
        }