Inheritance: System.Windows.Forms.Form
        protected override void OnClick()
        {
            IMxDocument pMxDoc = ArcMap.Document;

            if (pMxDoc.SelectedLayer == null)
            {
                MessageBox.Show("There is no layer selected.  First select a time-aware layer.");
                return;
            }

            IFeatureLayer pFLyr     = pMxDoc.SelectedLayer as IFeatureLayer;
            ITimeData     pTimeData = pFLyr as ITimeData;

            if (!pTimeData.SupportsTime)
            {
                MessageBox.Show("Select a time-aware layer first.");
                return;
            }
            m_myLayerTimeExtent = pTimeData.GetFullTimeExtent();

            ITimeDataDisplay pTimeDataDisplayProperties = pFLyr as ITimeDataDisplay;
            esriTimeUnits    LayerIntervalUnits         = pTimeDataDisplayProperties.TimeIntervalUnits;
            double           LayerInterval = pTimeDataDisplayProperties.TimeInterval;
            ITime            startTime     = m_myLayerTimeExtent.StartTime;
            ITime            endTime       = (ITime)((IClone)startTime).Clone();

            switch (LayerIntervalUnits)
            {
            case esriTimeUnits.esriTimeUnitsYears:
                ((ITimeOffsetOperator)endTime).AddYears(LayerInterval, false, true);
                break;

            case esriTimeUnits.esriTimeUnitsMonths:
                ((ITimeOffsetOperator)endTime).AddMonths(LayerInterval, false, true);
                break;

            case esriTimeUnits.esriTimeUnitsDays:
                ((ITimeOffsetOperator)endTime).AddDays(LayerInterval);
                break;

            case esriTimeUnits.esriTimeUnitsHours:
                ((ITimeOffsetOperator)endTime).AddHours(LayerInterval);
                break;

            case esriTimeUnits.esriTimeUnitsMinutes:
                ((ITimeOffsetOperator)endTime).AddMinutes(LayerInterval);
                break;

            case esriTimeUnits.esriTimeUnitsSeconds:
                ((ITimeOffsetOperator)endTime).AddSeconds(LayerInterval);
                break;
            }

            ITimeExtent pTimeExt = new TimeExtentClass();

            pTimeExt.SetExtent(startTime, endTime);
            m_layerInterval = pTimeExt.QueryTimeDuration();


            m_sliderDlg = new TimeSliderDialog(this);
            m_sliderDlg.Show();
        }
    protected override void OnClick()
    {
      IMxDocument pMxDoc = ArcMap.Document;
      if (pMxDoc.SelectedLayer == null)
      {
        MessageBox.Show("There is no layer selected.  First select a time-aware layer.");
        return;
      }

      IFeatureLayer pFLyr = pMxDoc.SelectedLayer as IFeatureLayer;
      ITimeData pTimeData = pFLyr as ITimeData;
      if (!pTimeData.SupportsTime)
      {
        MessageBox.Show("Select a time-aware layer first.");
        return;
      }
      m_myLayerTimeExtent = pTimeData.GetFullTimeExtent();

      ITimeDataDisplay pTimeDataDisplayProperties = pFLyr as ITimeDataDisplay;
      esriTimeUnits LayerIntervalUnits = pTimeDataDisplayProperties.TimeIntervalUnits;
      double LayerInterval = pTimeDataDisplayProperties.TimeInterval;
      ITime startTime = m_myLayerTimeExtent.StartTime;
      ITime endTime = (ITime)((IClone)startTime).Clone();

      switch (LayerIntervalUnits)
      {
        case esriTimeUnits.esriTimeUnitsYears:
          ((ITimeOffsetOperator)endTime).AddYears(LayerInterval, false, true);
          break;
        case esriTimeUnits.esriTimeUnitsMonths:
          ((ITimeOffsetOperator)endTime).AddMonths(LayerInterval, false, true);
          break;
        case esriTimeUnits.esriTimeUnitsDays:
          ((ITimeOffsetOperator)endTime).AddDays(LayerInterval);
          break;
        case esriTimeUnits.esriTimeUnitsHours:
          ((ITimeOffsetOperator)endTime).AddHours(LayerInterval);
          break;
        case esriTimeUnits.esriTimeUnitsMinutes:
          ((ITimeOffsetOperator)endTime).AddMinutes(LayerInterval);
          break;
        case esriTimeUnits.esriTimeUnitsSeconds:
          ((ITimeOffsetOperator)endTime).AddSeconds(LayerInterval);
          break;
      }

      ITimeExtent pTimeExt = new TimeExtentClass();
      pTimeExt.SetExtent(startTime, endTime);
      m_layerInterval = pTimeExt.QueryTimeDuration();


      m_sliderDlg = new TimeSliderDialog(this);
      m_sliderDlg.Show();
    }