ArcObjects Library Reference  

RSSLayerProps2

About the RSS weather layer Sample

[C#]

RSSLayerProps2.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("AFC53D59-FB35-4531-9B91-DFB36512A784")]
  [ComVisible(true)]
  [ProgId("RSSWeatherLayer.RSSLayerProps2")]
  [ClassInterface(ClassInterfaceType.None)]
  public partial class RSSLayerProps2 : PropertyPage
  {
    private int m_symbolSize;

    public RSSLayerProps2()
    {
      InitializeComponent();
    }

    protected override void OnPageApply()
    {
      base.OnPageApply();

      PropertySheet propSheet = Objects[0] as PropertySheet;

      RSSWeatherLayerClass layer = propSheet.RSSWatherLayer;
      if (null == layer)
        return;

      int symbolSize;
      int.TryParse(txtSymbolSize.Text, out symbolSize);
      if (0 != symbolSize && m_symbolSize != symbolSize)
        layer.SymbolSize = symbolSize;

    }

    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;

      txtSymbolSize.Text = layer.SymbolSize.ToString();

      m_symbolSize = layer.SymbolSize;
    }

    private void txtSymbolSize_TextChanged(object sender, EventArgs e)
    {
      if (!IsPageActivating)
        PageIsDirty = true;
    }
  }
}
[Visual Basic .NET]

RSSLayerProps2.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("AFC53D59-FB35-4531-9B91-DFB36512A784"), ComVisible(True), ProgId("RSSLayerProps2"), ClassInterface(ClassInterfaceType.None)> _
  Public Partial Class RSSLayerProps2 : Inherits PropertyPage
	Private m_symbolSize As Integer

	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

	  Dim symbolSize As Integer
	  Integer.TryParse(txtSymbolSize.Text, symbolSize)
	  If 0 <> symbolSize AndAlso m_symbolSize <> symbolSize Then
			layer.SymbolSize = symbolSize
	  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

	  txtSymbolSize.Text = layer.SymbolSize.ToString()

	  m_symbolSize = layer.SymbolSize
	End Sub

	Private Sub txtSymbolSize_TextChanged(ByVal sender As Object, ByVal e As EventArgs) Handles txtSymbolSize.TextChanged
	  If (Not IsPageActivating) Then
			PageIsDirty = True
	  End If
	End Sub
  End Class