private void importFromData() { try { if (!VTSCore.Common.WindowStateDetect.ShowWindow(_importAreaByStringClient)) { _importAreaByStringClient = new ImportAreaByStringClient(); _importAreaByStringClient.Show(); System.Windows.Interop.HwndSource winformWindow = (System.Windows.Interop.HwndSource.FromDependencyObject(this) as System.Windows.Interop.HwndSource); if (winformWindow != null) { new System.Windows.Interop.WindowInteropHelper(_importAreaByStringClient) { Owner = winformWindow.Handle } } ; _importAreaByStringClient.OnSaving += OnSavingByString; } } catch (Exception ex) { MessageBox.Show("请输入需要导入的数据,并用','号隔开!!(区域名称,经度,纬度,经度,纬度,…)" + Environment.NewLine + ex.Message); } }
private void OnSavingByString() { if (_importAreaByStringClient != null) { RadarRegion region = new RadarRegion() { Name = _importAreaByStringClient.Heading, Polygon = _importAreaByStringClient.Polygon, IsMask = true }; importNewRadarArea(region); initListView(); SelectedIndex(radarAreasListView.Items.Count - 1); centeredRadarArea(); _importAreaByStringClient.OnSaving -= OnSavingByString; _importAreaByStringClient.Close(); _importAreaByStringClient = null; } }