@@ -27,6 +27,14 @@ public WidgetsVM()
2727 {
2828 try
2929 {
30+ var packages = Packaging . FileSystem . LoadWidgets ( ) ;
31+ AvailableWidgets = new List < WidgetItem > ( ) ;
32+ foreach ( var pk in packages )
33+ {
34+ AvailableWidgets . Add ( new WidgetItem { Id = pk . Id , Title = pk . Title , ShowTitle = false } ) ;
35+ }
36+
37+
3038 WidgetZones = new List < WidgetZone > ( ) ;
3139 WebClient client = new WebClient ( ) ;
3240 var html = client . DownloadString ( Utils . AbsoluteWebRoot ) ;
@@ -45,26 +53,23 @@ public WidgetsVM()
4553 zone . Id = zoneId ;
4654
4755 //var ws = new WidgetSettings(zoneId);
48-
4956 //var abc = ws.GetSettings();
50-
5157 // var x = (StringDictionary)ws.GetSettings();
5258
53-
5459 var xml = RetrieveXml ( zoneId ) ;
5560 var wd = new WidgetData { Settings = xml . InnerXml } ;
5661
5762 //------------------------------
5863 var widgets = xml . SelectSingleNode ( "widgets" ) ;
64+ zone . Widgets = new List < WidgetItem > ( ) ;
5965 if ( widgets != null )
6066 {
61- zone . Widgets = new List < WidgetItem > ( ) ;
6267 foreach ( XmlNode node in widgets . ChildNodes )
6368 {
6469 if ( node != null && node . Attributes != null )
6570 {
6671 var item = new WidgetItem ( ) ;
67- item . Id = new Guid ( node . Attributes [ "id" ] . InnerText ) ;
72+ item . Id = node . Attributes [ "id" ] . InnerText ;
6873 item . Title = node . Attributes [ "title" ] . InnerText ;
6974 item . ShowTitle = bool . Parse ( node . Attributes [ "showTitle" ] . InnerText ) ;
7075 zone . Widgets . Add ( item ) ;
@@ -81,11 +86,12 @@ public WidgetsVM()
8186 }
8287 catch ( Exception ) { }
8388 }
89+
90+ public List < WidgetItem > AvailableWidgets { get ; set ; }
8491 /// <summary>
8592 /// Widget zones
8693 /// </summary>
8794 public List < WidgetZone > WidgetZones { get ; set ; }
88-
8995 private static XmlDocument RetrieveXml ( string zoneName )
9096 {
9197 var ws = new WidgetSettings ( zoneName ) { SettingsBehavior = new XmlDocumentBehavior ( ) } ;
@@ -111,7 +117,7 @@ public class WidgetZone
111117
112118 public class WidgetItem
113119 {
114- public Guid Id { get ; set ; }
120+ public string Id { get ; set ; }
115121 public string Title { get ; set ; }
116122 public bool ShowTitle { get ; set ; }
117123 }
0 commit comments