年度变更建库软件5.0版本
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

171 lines
5.4 KiB

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using KGIS.Plugin.LayerProperty.Interface;
using ESRI.ArcGIS.Geodatabase;
using ESRI.ArcGIS.Carto;
namespace KGIS.Plugin.LayerProperty.View.UC_Controls
{
public partial class UCDefinitionQueryProperty : XtraUserControl, IUCPropertyPageEx, IPropertyPage
{
private esriSearchOrder m_SearchOrder;
private string m_DefinitionExpression;
private FormSQLCreator frmSQLCreator;
private IFeatureLayer m_FeatureLayer;
private bool isDirty;
public event System.EventHandler EditorChanged;
public bool IsPageDirty
{
get
{
return this.isDirty;
}
set
{
this.isDirty = value;
}
}
public int Priority
{
get
{
throw new Exception("The method or operation is not implemented.");
}
set
{
throw new Exception("The method or operation is not implemented.");
}
}
public string Title
{
get
{
throw new Exception("The method or operation is not implemented.");
}
set
{
throw new Exception("The method or operation is not implemented.");
}
}
public UCDefinitionQueryProperty()
{
InitializeComponent();
}
private void memDefinitionExpression_EditValueChanged(object sender, System.EventArgs e)
{
try
{
this.m_DefinitionExpression = this.memDefinitionExpression.Text;
this.InvokeEditValueChanged(sender, e);
}
catch (Exception ex)
{
//RdbUtil.AddException(ex);
}
}
private void rdgSearchOrder_SelectedIndexChanged(object sender, System.EventArgs e)
{
try
{
this.m_SearchOrder = (esriSearchOrder)this.rdgSearchOrder.SelectedIndex;
this.InvokeEditValueChanged(sender, e);
}
catch (Exception ex)
{
//RdbUtil.AddException(ex);
}
}
public void InitUC(object layerProperty)
{
try
{
this.m_FeatureLayer = (layerProperty as IFeatureLayer);
IFeatureLayerDefinition2 featureLayerDefinition = this.m_FeatureLayer as IFeatureLayerDefinition2;
if (featureLayerDefinition != null)
{
this.rdgSearchOrder.SelectedIndex = Convert.ToInt32(featureLayerDefinition.SearchOrder);
this.memDefinitionExpression.Text = featureLayerDefinition.DefinitionExpression;
}
}
catch (Exception ex)
{
//RdbUtil.AddException(ex);
}
}
public void Write2Prop()
{
try
{
IFeatureLayerDefinition2 featureLayerDefinition = this.m_FeatureLayer as IFeatureLayerDefinition2;
if (featureLayerDefinition != null)
{
featureLayerDefinition.SearchOrder = (esriSearchOrder)this.rdgSearchOrder.SelectedIndex;
featureLayerDefinition.DefinitionExpression = this.memDefinitionExpression.Text;
}
this.isDirty = false;
}
catch (Exception ex)
{
//RdbUtil.AddException(ex);
}
}
public bool CanWrite2Prop()
{
return this.isDirty;
}
private void InvokeEditValueChanged(object sender, System.EventArgs e)
{
if (this.EditorChanged != null)
{
this.EditorChanged(sender, e);
}
this.isDirty = true;
}
public void SetDefaultValue(object value)
{
}
private void btnCreateQuery_Click(object sender, System.EventArgs e)
{
try
{
if (this.frmSQLCreator == null)
{
this.frmSQLCreator = new FormSQLCreator();
}
if (this.m_FeatureLayer != null)
{
this.frmSQLCreator.InitForm(this.m_FeatureLayer);
this.frmSQLCreator.SQL = this.memDefinitionExpression.Text;
if (this.frmSQLCreator.ShowDialog() == DialogResult.OK)
{
this.memDefinitionExpression.Text = this.frmSQLCreator.SQL;
}
}
}
catch (Exception ex)
{
//RdbUtil.AddException(ex);
}
}
public int Activate()
{
throw new Exception("The method or operation is not implemented.");
}
public void Deactivate()
{
throw new Exception("The method or operation is not implemented.");
}
public void Cancel()
{
throw new Exception("The method or operation is not implemented.");
}
}
}