ComboBox Walkthrough
ComboBoxWalkthrough.cs
// Copyright 2011 ESRI
// 
// All rights reserved under the copyright laws of the United States
// and applicable international laws, treaties, and conventions.
// 
// You may freely redistribute and use this sample code, with or
// without modification, provided you include the original copyright
// notice and use restrictions.
// 
// See the use restrictions.
// 

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;

using ESRI.ArcGISExplorer;
using ESRI.ArcGISExplorer.Application;
using ESRI.ArcGISExplorer.Mapping;
using ESRI.ArcGISExplorer.Geometry;
using ESRI.ArcGISExplorer.Data;
using ESRI.ArcGISExplorer.Threading;

namespace ComboBoxWalkthroughCS
{
  public class ComboBoxWalkthrough : ESRI.ArcGISExplorer.Application.ComboBox
  {
    public ComboBoxWalkthrough()
    {
      //add rotation options
      ComboItem itm = new ComboItem("45");
      itm = new ComboItem("45");
      itm.Tag = 45;
      this.Items.Add(itm);
      itm = new ComboItem("90");
      itm.Tag = 90;
      this.Items.Add(itm);
      itm = new ComboItem("135");
      itm.Tag = 135;
      this.Items.Add(itm);
      itm = new ComboItem("180");
      itm.Tag = 180;
      this.Items.Add(itm);
      itm = new ComboItem("225");
      itm.Tag = 225;
      this.Items.Add(itm);
      itm = new ComboItem("270");
      itm.Tag = 270;
      this.Items.Add(itm);
      itm = new ComboItem("315");
      itm.Tag = 315;
      this.Items.Add(itm);
    }

    public override void OnSelectionChange(ComboItem item)
    {
      if (this.SelectedItem != null)
      {
        double degrees = Convert.ToDouble(item.Tag);

        // grab the selected note
        SelectedItemsCollection selItems = ESRI.ArcGISExplorer.Application.Application.SelectedItems;
        if ((selItems.Count == 1) && (selItems[0] is Note))
        {
          Note selected = selItems[0] as Note;

          // Rotate the geometry
          Geometry rotated = GeometryOperations.Rotate(selected.Graphic.Geometry, (degrees * -1), Unit.Angular.Degrees);

          // Update the geometry of the graphic.
          selected.Graphic.Geometry = rotated;

          this.SelectedItem = null;
        }
      }
    }

  }
}