public IGPMessage ValidateValue(IGPValue Value, IGPDomain Domain) { IGPMessage validateValueMessage = new GPMessageClass(); IGPUtilities3 gpUtilities = new GPUtilitiesClass(); IHttpBasicGPValue targetValue = gpUtilities.UnpackGPValue(Value) as IHttpBasicGPValue; if (targetValue == null) { IGPString targetValueString = gpUtilities.UnpackGPValue(Value) as IGPString; if (targetValueString != null) { return(validateValueMessage); } } if (targetValue == null) { validateValueMessage.Type = esriGPMessageType.esriGPMessageTypeError; validateValueMessage.ErrorCode = 502; validateValueMessage.Description = resourceManager.GetString("GPTools_Authentication_HttpBasicDataType_valuevalidation"); } if (Domain != null) { validateValueMessage = Domain.MemberOf((IGPValue)targetValue); } return(validateValueMessage); }
/// <summary>Resets the previous UI message</summary> private void EndTaskMessage() { if (_taskMessages.Count > 0) { _taskMessages.RemoveAt(_taskMessages.Count - 1); } if (_trackCancel.Progressor != null) { if (_taskMessages.Count > 0) { _trackCancel.Progressor.Message = _taskMessages[_taskMessages.Count - 1]; } else { _trackCancel.Progressor.Message = string.Empty; } } IGPMessage msg = new GPMessageClass(); msg.Description = string.Empty; msg.Type = esriGPMessageType.esriGPMessageTypeProcessStop; _messages.Add(msg); }
public void UpdateMessages(ESRI.ArcGIS.esriSystem.IArray paramvalues, ESRI.ArcGIS.Geoprocessing.IGPEnvironmentManager pEnvMgr, ESRI.ArcGIS.Geodatabase.IGPMessages Messages) { IGPUtilities3 gpUtilities3 = new GPUtilitiesClass(); for (int i = 0; i < Messages.Count; i++) { IGPMessage blah = Messages.GetMessage(i); if (blah.IsError()) { IGPMessage something = new GPMessageClass(); something.Description = String.Empty; something.Type = esriGPMessageType.esriGPMessageTypeInformative; something.ErrorCode = 0; Messages.Replace(i, something); } } IGPParameter inputOSMParameter = paramvalues.get_Element(in_osmFeatureClassNumber) as IGPParameter; IGPValue inputOSMGPValue = gpUtilities3.UnpackGPValue(inputOSMParameter); if (inputOSMGPValue.IsEmpty() == false) { IFeatureClass osmFeatureClass = null; ITable osmInputTable = null; IQueryFilter osmQueryFilter = null; try { gpUtilities3.DecodeFeatureLayer(inputOSMGPValue, out osmFeatureClass, out osmQueryFilter); osmInputTable = osmFeatureClass as ITable; } catch { } try { if (osmInputTable == null) { gpUtilities3.DecodeTableView(inputOSMGPValue, out osmInputTable, out osmQueryFilter); } } catch { } if (osmInputTable == null) { return; } // find the field that holds tag binary/xml field int osmTagCollectionFieldIndex = osmInputTable.FindField("osmTags"); if (osmTagCollectionFieldIndex == -1) { Messages.ReplaceAbort(in_osmFeatureClassNumber, resourceManager.GetString("GPTools_OSMGPCombineAttributes_inputlayer_missingtagfield")); return; } } }
/// <summary> /// Validates the type of the data. /// </summary> /// <param name="type">The type.</param> /// <returns></returns> public IGPMessage ValidateDataType(IGPDataType type) { IGPMessage message = new GPMessageClass(); IGPAutoValueType targetType = type as IGPAutoValueType; if (targetType == null) { message.ErrorCode = 501; message.Type = esriGPMessageType.esriGPMessageTypeError; message.Description = @"The value is not an auto value."; } return(message); }
/// <summary> /// Validates the value. /// </summary> /// <param name="value">The value.</param> /// <param name="domain">The domain.</param> /// <returns></returns> public IGPMessage ValidateValue(IGPValue value, IGPDomain domain) { IGPMessage message = new GPMessageClass(); IGPUtilities3 utilities = new GPUtilitiesClass(); IGPAutoValue autoValue = utilities.UnpackGPValue(value) as IGPAutoValue; if (autoValue == null) { message.Type = esriGPMessageType.esriGPMessageTypeError; message.ErrorCode = 502; message.Description = @"The value is not an auto value."; } return(message); }
/// <summary> /// Display analysis results in the list box /// </summary> private void DisplayOutput() { ITable table = m_NAContext.NAClasses.get_ItemByName("SAPolygons") as ITable; if (table.RowCount(null) > 0) { IGPMessage gpMessage = new GPMessageClass(); lstOutput.Items.Add("FacilityID, FromBreak, ToBreak"); ICursor cursor = table.Search(null, true); IRow row = cursor.NextRow(); while (row != null) { int facilityID = (int)row.get_Value(table.FindField("FacilityID")); double fromBreak = (double)row.get_Value(table.FindField("FromBreak")); double toBreak = (double)row.get_Value(table.FindField("ToBreak")); lstOutput.Items.Add(facilityID.ToString() + ", " + fromBreak.ToString("#####0.00") + ", " + toBreak.ToString("#####0.00")); row = cursor.NextRow(); } } }
private void LoadListboxAfterSuccessfulSolve() { ITable table = m_naContext.NAClasses.get_ItemByName("SAPolygons") as ITable; if (table.RowCount(null) > 0) { IGPMessage gpMessage = new GPMessageClass(); lbOutput.Items.Add("FacilityID \t FromBreak \t ToBreak"); ICursor cursor = table.Search(null, true); IRow row = cursor.NextRow(); while (row != null) { int facilityID = (int)row.get_Value(table.FindField("FacilityID")); double fromBreak = (double)row.get_Value(table.FindField("FromBreak")); double toBreak = (double)row.get_Value(table.FindField("ToBreak")); lbOutput.Items.Add(facilityID.ToString() + "\t " + fromBreak.ToString("#####0.00") + "\t " + toBreak.ToString("#####0.00")); row = cursor.NextRow(); } } }
/// <summary>Sets a UI message for the current process</summary> private void StartTaskMessage(string message) { if (_trackCancel.Progressor != null) { _trackCancel.Progressor.Message = message; } IGPMessage msg = new GPMessageClass(); msg.Description = string.Empty; msg.Type = esriGPMessageType.esriGPMessageTypeProcessDefinition; _messages.Add(msg); IGPMessage msgStart = new GPMessageClass(); msgStart.Description = message; msgStart.Type = esriGPMessageType.esriGPMessageTypeProcessStart; _messages.Add(msgStart); _taskMessages.Add(message); }
public IGPMessage SetAsText(string text) { IGPMessage valueSetMessage = new GPMessageClass(); try { DecodeUserNamePassword(text); } catch (ArgumentNullException ex) { // pass } catch { valueSetMessage.Type = esriGPMessageType.esriGPMessageTypeError; valueSetMessage.Description = resourceManager.GetString("GPTools_Authentication_GPValue_UnableParseAuthentication"); valueSetMessage.ErrorCode = 500; } return(valueSetMessage); }
/// <summary> /// Provides the value of the value object with the given string value. /// </summary> /// <param name="text"></param> /// <returns></returns> /// <exception cref="NotImplementedException"></exception> public IGPMessage SetAsText(string text) { IGPMessage message = new GPMessageClass(); try { this.UID = new UIDClass() { Value = text }; this.Value = this.UID.Create <TValue>(); } catch (Exception e) { message.Type = esriGPMessageType.esriGPMessageTypeError; message.Description = e.Message; message.ErrorCode = 500; } return(message); }
public IGPMessage ValidateDataType(IGPDataType Type) { IGPMessage validateDataTypeMessage = new GPMessageClass(); IHttpBasicDataType targetType = Type as IHttpBasicDataType; if (targetType == null) { IGPStringType targetTypeString = Type as IGPStringType; if (targetTypeString != null) { return(validateDataTypeMessage); } } if (targetType == null) { validateDataTypeMessage.ErrorCode = 501; validateDataTypeMessage.Type = esriGPMessageType.esriGPMessageTypeError; validateDataTypeMessage.Description = resourceManager.GetString("GPTools_Authentication_HttpBasicDataType_typevalidation"); } return(validateDataTypeMessage); }
public IGPMessage ValidateValue(IGPValue Value, IGPDomain Domain) { IGPMessage validateValueMessage = new GPMessageClass(); IGPUtilities3 gpUtilities = new GPUtilitiesClass(); IHttpBasicGPValue targetValue = gpUtilities.UnpackGPValue(Value) as IHttpBasicGPValue; if ( targetValue == null ) { IGPString targetValueString = gpUtilities.UnpackGPValue(Value) as IGPString; if ( targetValueString != null ) return validateValueMessage; } if (targetValue == null) { validateValueMessage.Type = esriGPMessageType.esriGPMessageTypeError; validateValueMessage.ErrorCode = 502; validateValueMessage.Description = resourceManager.GetString("GPTools_Authentication_HttpBasicDataType_valuevalidation"); } if (Domain != null) { validateValueMessage = Domain.MemberOf((IGPValue)targetValue); } return validateValueMessage; }
public IGPMessage ValidateDataType(IGPDataType Type) { IGPMessage validateDataTypeMessage = new GPMessageClass(); IHttpBasicDataType targetType = Type as IHttpBasicDataType; if (targetType == null) { IGPStringType targetTypeString = Type as IGPStringType; if (targetTypeString != null) return validateDataTypeMessage; } if (targetType == null) { validateDataTypeMessage.ErrorCode = 501; validateDataTypeMessage.Type = esriGPMessageType.esriGPMessageTypeError; validateDataTypeMessage.Description = resourceManager.GetString("GPTools_Authentication_HttpBasicDataType_typevalidation"); } return validateDataTypeMessage; }
/// <summary>Resets the previous UI message</summary> private void EndTaskMessage() { if (_taskMessages.Count > 0) _taskMessages.RemoveAt(_taskMessages.Count - 1); if (_trackCancel.Progressor != null) { if (_taskMessages.Count > 0) _trackCancel.Progressor.Message = _taskMessages[_taskMessages.Count - 1]; else _trackCancel.Progressor.Message = string.Empty; } IGPMessage msg = new GPMessageClass(); msg.Description = string.Empty; msg.Type = esriGPMessageType.esriGPMessageTypeProcessStop; _messages.Add(msg); }
/// <summary>Sets a UI message for the current process</summary> private void StartTaskMessage(string message) { if (_trackCancel.Progressor != null) _trackCancel.Progressor.Message = message; IGPMessage msg = new GPMessageClass(); msg.Description = string.Empty; msg.Type = esriGPMessageType.esriGPMessageTypeProcessDefinition; _messages.Add(msg); IGPMessage msgStart = new GPMessageClass(); msgStart.Description = message; msgStart.Type = esriGPMessageType.esriGPMessageTypeProcessStart; _messages.Add(msgStart); _taskMessages.Add(message); }
public IGPMessage SetAsText(string text) { IGPMessage valueSetMessage = new GPMessageClass(); try { DecodeUserNamePassword(text); } catch (ArgumentNullException ex) { // pass } catch { valueSetMessage.Type = esriGPMessageType.esriGPMessageTypeError; valueSetMessage.Description = resourceManager.GetString("GPTools_Authentication_GPValue_UnableParseAuthentication"); valueSetMessage.ErrorCode = 500; } return valueSetMessage; }
/// <summary> /// Display analysis results in the list box /// </summary> private void DisplayOutput() { ITable table = m_NAContext.NAClasses.get_ItemByName("SAPolygons") as ITable; if (table.RowCount(null) > 0) { IGPMessage gpMessage = new GPMessageClass(); lstOutput.Items.Add("FacilityID, FromBreak, ToBreak"); ICursor cursor = table.Search(null, true); IRow row = cursor.NextRow(); while (row != null) { int facilityID = (int)row.get_Value(table.FindField("FacilityID")); double fromBreak = (double)row.get_Value(table.FindField("FromBreak")); double toBreak = (double)row.get_Value(table.FindField("ToBreak")); lstOutput.Items.Add(facilityID.ToString() + ", " + fromBreak.ToString("#####0.00") + ", " + toBreak.ToString("#####0.00")); row = cursor.NextRow(); } } }
public void UpdateMessages(ESRI.ArcGIS.esriSystem.IArray paramvalues, ESRI.ArcGIS.Geoprocessing.IGPEnvironmentManager pEnvMgr, ESRI.ArcGIS.Geodatabase.IGPMessages Messages) { IGPUtilities3 gpUtilities3 = new GPUtilitiesClass(); for (int i = 0; i < Messages.Count; i++) { IGPMessage blah = Messages.GetMessage(i); if (blah.IsError()) { IGPMessage something = new GPMessageClass(); something.Description = String.Empty; something.Type = esriGPMessageType.esriGPMessageTypeInformative; something.ErrorCode = 0; Messages.Replace(i, something); } } IGPParameter inputOSMParameter = paramvalues.get_Element(in_osmFeatureClassNumber) as IGPParameter; IGPValue inputOSMGPValue = gpUtilities3.UnpackGPValue(inputOSMParameter); if (inputOSMGPValue.IsEmpty() == false) { IFeatureClass osmFeatureClass = null; ITable osmInputTable = null; IQueryFilter osmQueryFilter = null; try { gpUtilities3.DecodeFeatureLayer(inputOSMGPValue, out osmFeatureClass, out osmQueryFilter); osmInputTable = osmFeatureClass as ITable; } catch { } try { if (osmInputTable == null) { gpUtilities3.DecodeTableView(inputOSMGPValue, out osmInputTable, out osmQueryFilter); } } catch { } if (osmInputTable == null) { return; } // find the field that holds tag binary/xml field int osmTagCollectionFieldIndex = osmInputTable.FindField("osmTags"); if (osmTagCollectionFieldIndex == -1) { Messages.ReplaceAbort(in_osmFeatureClassNumber, resourceManager.GetString("GPTools_OSMGPCombineAttributes_inputlayer_missingtagfield")); return; } } }