示例#1
0
        protected override void OnClick()
        {
            var bufZonesLayer = new BufZonesLayer {
                IsAVR = m_MapImage.Parent is AvrMapControl
            };

            if (bufZonesLayer.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    var eidssUserBufZoneLayer = UserDbLayersManager.CreateBufZoneLayer(bufZonesLayer.ZoneLayerName,
                                                                                       bufZonesLayer.Description,
                                                                                       bufZonesLayer.PivotalLayer);
                    //MapImage.Map.Layers.Add(eidssUserBufZoneLayer);

                    if (OnCreateBufZone != null)
                    {
                        OnCreateBufZone(new KeyValuePair <Guid, string>(eidssUserBufZoneLayer.LayerDbGuid,
                                                                        eidssUserBufZoneLayer.LayerName));
                    }
                    //MapControl.RefreshContent();
                    MapImage.Refresh();
                    //ZoneLayerStorage.UpdateZoneLayerDict(); //not need more
                }
                catch (Exception ex)
                {
                    ErrorForm.ShowError(ex);
                }
            }
        }
示例#2
0
        private void PropertiesButton_Click(object sender, EventArgs e)
        {
            //get selected layer props
            var             row     = bufLayersGridView.GetDataRow(bufLayersGridView.FocusedRowHandle);
            var             layerId = (Guid)row["ID"];
            UserDbLayerInfo layerInfo;

            try
            {
                layerInfo = UserDbLayersManager.GetLayerMetadata(layerId);
            }
            catch (Exception)
            {
                ErrorForm.ShowError(Resources.DbLayersFormFailedToObtainMetadata);
                return;
            }

            var propForm = new BufZonesLayer();

            propForm.ZoneLayerName     = layerInfo.m_Name;
            propForm.Description       = layerInfo.m_Description;
            propForm.PivotalLayer      = layerInfo.m_PivotalLayer;
            propForm.PivotComboEnabled = false;
            if (propForm.ShowDialog(this) == DialogResult.OK)
            {
                var msgCaption = Resources.DbLayersForm_MsgBoxCaption;
                var msgText    = Resources.DbLayersForm_SaveMetadataMsg;
                if (MessageForm.Show(msgText, msgCaption, MessageBoxButtons.YesNo) == DialogResult.No)
                {
                    return;
                }
                layerInfo.m_Name        = propForm.ZoneLayerName;
                layerInfo.m_Description = propForm.Description;
                try
                {
                    UserDbLayersManager.UpdateUserLayerMetadata(layerInfo);
                }
                catch (Exception)
                {
                    ErrorForm.ShowErrorDirect(Resources.DbLayersForm_FailedToSaveMetadata);
                    return;
                }
                RefreshUserLayers();
            }
        }