private void menuZoomTo_Click(System.Object sender, System.EventArgs e) { if (null == m_propset) { return; } long zipCode = Convert.ToInt64(m_propset.GetProperty("ZIPCODE")); m_weatherLayer.ZoomTo(zipCode); }
/// <summary> /// ZoomTo menu click event handler /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void menuZoomTo_Click(object sender, System.EventArgs e) { if (null == m_weatherLayer) { return; } //get the selected item string cityName = Convert.ToString(lstWeatherItemNames.SelectedItem); //ask the layer to zoom to that cityname m_weatherLayer.ZoomTo(cityName); }
/// <summary> /// Occurs when this command is clicked /// </summary> public override void OnClick() { try { //get the weather layer IEnumLayer layers = m_scene.get_Layers(null, false); layers.Reset(); ILayer layer = layers.Next(); while (layer != null) { if (layer is RSSWeatherLayer3DClass) { m_weatherLayer = (RSSWeatherLayer3DClass)layer; break; } layer = layers.Next(); } //in case that the layer exists if (null != m_weatherLayer) { //launch the zipCode input dialog ZipCodeDlg dlg = new ZipCodeDlg(); if (DialogResult.OK == dlg.ShowDialog()) { long zipCode = dlg.ZipCode; if (0 != zipCode) { //add the weather item to the layer m_weatherLayer.AddItem(zipCode); //if the user checked the 'ZoomTo' checkbox, zoom to the item if (dlg.ZoomToItem) { m_weatherLayer.ZoomTo(zipCode); } } } } } catch (Exception ex) { System.Diagnostics.Trace.WriteLine(ex.Message); } }