Skip to content

Instantly share code, notes, and snippets.

@dvhthomas
dvhthomas / StructureMapServiceLocator.cs
Created October 5, 2009 01:34
StructureMap ServiceLocation
using System;
using System.Collections.Generic;
using Microsoft.Practices.ServiceLocation;
using StructureMap;
namespace GisQueryDirectHost
{
public class StructureMapServiceLocator : IServiceLocator
{
#region IServiceLocator Members
@dvhthomas
dvhthomas / gui.js
Created October 5, 2009 02:02
Date picker for all date fields
$(document).ready(function() {
$('.datePick').datepicker();
});
// Attach calendar functionality to any element
// with a CSS class of datePick. This is safe
// if the page has multiple calendars.
$(document).ready(function() {
$('.datePick').datepicker($.extend({},
$.datepicker.regional['en'], {
onSelect: function() { }
}));
});
<asp:ScriptManager ID="smMaster" runat="server">
<Scripts>
<asp:ScriptReference Path="~/scripts/jquery.js" />
<asp:ScriptReference Path="~/scripts/jquery-ui.js" />
<asp:ScriptReference Path="~/scripts/gui.js" />
</Scripts>
</asp:ScriptManager>
<label for="txtEffectiveDate">Date To Process</label>
<asp:TextBox ID="txtEffectiveDate" runat="server"
CssClass="inputWide datePick hilite" />
<asp:RequiredFieldValidator ID="valEffDateNotEmpty" runat="server"
ControlToValidate="txtEffectiveDate"
ErrorMessage="Date to Process date is required"
Display="none"
ValidationGroup="Workflow"
SetFocusOnError="true" />
private IEditEvents_Event _editEvents;
private IEditEvents2_Event _editEvents2;...
/// <summary>
/// Wire up the extension to editing events.
/// </summary>
/// <param name="editor">The current editor</param>
private void AttachEditingEvents(IEditor2 editor)
{
if (editor != null)
private bool _isSavedAction;...
/// <summary>
/// Only handle this so that a field can be set. This is to avoid
/// the issue where ArcMap fires OnSaveEdits AND OnStopEditing events
/// when the user clicks the Save Edits button. The boolean value
/// is set back to false when the OnStopEditing event is called.
/// </summary>
private void OnSaveEdits()
{
/// <summary>
/// Clean up the workflow environment. The Workflow Manager is listening
/// for changes in this property and will perform all the necessary
/// activities to reset the editing environment.
/// </summary>
private void OnStopEditing(bool saveChanges)
{
if (!_isSavedAction)
{
ActiveWorkflow = null;
IWorkspaceEditControl editControl = _mapHelper
.Editor()
.EditWorkspace as IWorkspaceEditControl;
editControl.SetStoreEventsRequired();
@dvhthomas
dvhthomas / GetCenter.cs
Created October 5, 2009 15:43
Get center of NTS feature
/// <summary>
/// Finds the center of points and polygons, or the mid point
/// of a line.
/// </summary>
/// <param name="feature">ESRI feature</param>
/// <returns>x,y coordinates of centroid/mid point</returns>
private double[] DetermineCenter(IFeature feature)
{
double x = 0;
double y = 0;