private void LoadItemsFromRegistry() { ArrayList items = new ArrayList(); using(RegistryKey key = Registry.CurrentUser.CreateSubKey(registryLocation)) { string[] favourites = key.GetSubKeyNames(); foreach(string favourite in favourites) { using(RegistryKey subkey = key.OpenSubKey(favourite)) { Proxy.NavigatorRef.Item navItem = new Workshare.Connect.SharePoint.Proxy.NavigatorRef.Item(); navItem.Title = ( string )subkey.GetValue( "name" ); navItem.Url = ( string )subkey.GetValue( "url" ); navItem.Kind = GetKind( ( string )subkey.GetValue( "kind" ) ); ListViewItem item = new ListViewItem( navItem.Title ); item.SubItems.Add( navItem.Url ); item.SubItems.Add( navItem.Kind.ToString() ); item.ImageIndex = (int)subkey.GetValue("image"); item.Tag = navItem; items.Add(item); } } } InnerList.Clear(); InnerList.AddRange(items); }
private Proxy.NavigatorRef.Item CreateNavItem( string title, string url, string kind ) { Proxy.NavigatorRef.ItemKind navKind = Workshare.Connect.SharePoint.Proxy.NavigatorRef.ItemKind.File; switch( kind.ToLower( ) ) { case "website": navKind = Workshare.Connect.SharePoint.Proxy.NavigatorRef.ItemKind.WebSite; break; case "documentlibrary": navKind = Workshare.Connect.SharePoint.Proxy.NavigatorRef.ItemKind.DocumentLibrary; break; case "folder": navKind = Workshare.Connect.SharePoint.Proxy.NavigatorRef.ItemKind.Folder; break; case "view": navKind = Workshare.Connect.SharePoint.Proxy.NavigatorRef.ItemKind.View; break; } Proxy.NavigatorRef.Item item = new Workshare.Connect.SharePoint.Proxy.NavigatorRef.Item( ); item.Title = title; item.Url = url; item.Kind = navKind; item.Guid = ""; item.VersionLabel = ""; return item; }