/// <summary> /// 删除回调 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ContextMenuClick_Del(object sender, RoutedEventArgs e) { if (m_catalog.ActiveMapDoc.ActiveLayerIndex < 0) { MessageBox.Show("请激活该编辑的图层", "提示", MessageBoxButton.OK); return; } TabItem item = tabControl1.SelectedItem as TabItem; if (item != null) { DataGrid datagrid = item.Content as DataGrid; if (datagrid != null) { m_lastSelDataGrid = datagrid; int tabIndex = Convert.ToInt32(((System.Windows.FrameworkElement)(((System.Windows.Controls.ContentControl)(tabControl1.SelectedItem)).Content)).Name.ToString().Split('_')[1]); if (tabIndex >= 0 && tabIndex < _lastSelRlt.AttDS[0].attTables.Length) { if (MessageBox.Show("你真的要删除吗?执行后将不能撤消!", "删除确认", MessageBoxButton.OKCancel) == MessageBoxResult.OK) { BindClass bc = datagrid.SelectedItem as BindClass; m_lastSelItem = bc; CGetObjByID getGeo = new CGetObjByID(); getGeo.FeatureID = Convert.ToInt64(bc.key0); getGeo.LayerIndex = tabIndex; COpenMap openmap = new COpenMap(); openmap.MapName = new string[] { m_catalog.ActiveMapDoc.MapDocName }; getGeo.MapName = openmap; m_catalog.ActiveMapDoc.DeleteFeature(getGeo, new UploadStringCompletedEventHandler(OnDeleteFeature)); } } } } }
private DateTime m_timeLastLeftButtonUp = DateTime.Now;//鼠标左键弹起的时间,判断双击用 /// <summary> /// 鼠标在DataGrid弹起事件回调 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DataGrid_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { DateTime b = DateTime.Now; long c = CommFun.TimeDiff(b, m_timeLastLeftButtonUp); m_timeLastLeftButtonUp = b; if (c < 280) {//双击事件 if (m_graphicsLayer != null && m_graphics != null) { m_graphicsLayer.RemoveGraphics(m_graphics); m_graphics = null; } DataGrid grid = sender as DataGrid; if (grid != null && grid.SelectedItem is BindClass && grid.Tag is TmpInfo && m_graphicsLayer != null) { CGetObjByID getGeo = new CGetObjByID(); getGeo.MapDocIndex = 0; getGeo.LayerIndex = (grid.Tag as TmpInfo).LayerIndex; getGeo.FeatureID = Convert.ToInt32((grid.SelectedItem as BindClass).key0); COpenMap openmap = new COpenMap(); openmap.MapName = new string[1] { activeMapDoc.MapDocName }; getGeo.MapName = openmap; activeMapDoc.GetGeomByID(getGeo, new UploadStringCompletedEventHandler(FlashFeature)); } } }
private void EditPoint(object sender, RoutedEventArgs e) { if (GraphicsLayer != null) { if (m_graphics != null) { GraphicsLayer.RemoveGraphics(m_graphics); m_graphics = null; } CGetObjByID getGeo = new CGetObjByID(); getGeo.MapDocIndex = 0; getGeo.LayerIndex = ActiveMapDoc.ActiveLayerIndex; getGeo.FeatureID = m_featureID; COpenMap openmap = new COpenMap(); openmap.MapName = new string[1] { ActiveMapDoc.MapDocName }; getGeo.MapName = openmap; ActiveMapDoc.GetGeomByID(getGeo, new UploadStringCompletedEventHandler(DrawFeature)); } }