About the RSS weather layer Sample
[C#]
RSSLayerProps.cs
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Runtime.InteropServices; namespace RSSWeatherLayer { [Guid("12D0AE46-D542-43f7-8A53-5B7FCA4AA111")] [ComVisible(true)] [ProgId("RSSWeatherLayer.RSSLayerProps")] [ClassInterface(ClassInterfaceType.None)] public partial class RSSLayerProps : PropertyPage { public RSSLayerProps() { InitializeComponent(); } protected override void OnPageApply() { base.OnPageApply(); PropertySheet propSheet = Objects[0] as PropertySheet; RSSWeatherLayerClass layer = propSheet.RSSWatherLayer; if (null == layer) return; } protected override void OnPageActivate(IntPtr hWndParent, Rectangle Rect, bool bModal) { base.OnPageActivate(hWndParent, Rect, bModal); PropertySheet propSheet = Objects[0] as PropertySheet; RSSWeatherLayerClass layer = propSheet.RSSWatherLayer; if (null == layer) return; //get the cityNames from the layer string[] cityNames = layer.GetCityNames(); //clear the listbox listBoxCityNames.Items.Clear(); listBoxCityNames.Items.AddRange(cityNames); } } }
[Visual Basic .NET]
RSSLayerProps.vb
Imports Microsoft.VisualBasic Imports System Imports System.Collections.Generic Imports System.ComponentModel Imports System.Data Imports System.Drawing Imports System.Text Imports System.Windows.Forms Imports System.Runtime.InteropServices <Guid("12D0AE46-D542-43f7-8A53-5B7FCA4AA111"), ComVisible(True), ProgId("RSSLayerProps"), ClassInterface(ClassInterfaceType.None)> _ Public Partial Class RSSLayerProps : Inherits PropertyPage Public Sub New() InitializeComponent() End Sub Protected Overrides Sub OnPageApply() MyBase.OnPageApply() Dim propSheet As PropertySheet = TryCast(Objects(0), PropertySheet) Dim layer As RSSWeatherLayerClass = propSheet.RSSWatherLayer If Nothing Is layer Then Return End If End Sub Protected Overrides Sub OnPageActivate(ByVal hWndParent As IntPtr, ByVal Rect As Rectangle, ByVal bModal As Boolean) MyBase.OnPageActivate(hWndParent, Rect, bModal) Dim propSheet As PropertySheet = TryCast(Objects(0), PropertySheet) Dim layer As RSSWeatherLayerClass = propSheet.RSSWatherLayer If Nothing Is layer Then Return End If 'get the cityNames from the layer Dim cityNames As String() = layer.GetCityNames() 'clear the listbox listBoxCityNames.Items.Clear() listBoxCityNames.Items.AddRange(cityNames) End Sub End Class