private void buttonX1_Click(object sender, EventArgs e) { //提交注释: if (this.textBoxX1.Text.Trim() == "") { return; } string textinput = this.textBoxX1.Text; //根据当前所选要素进行更新注释; IFeatureLayer iCheckLayer = m_MapCtrls.Map.get_Layer(0) as IFeatureLayer; IFeatureSelection iCheckSelection = iCheckLayer as IFeatureSelection; int CheckFeatureOID = 0; if (iCheckSelection.SelectionSet.Count == 1) { CheckFeatureOID = iCheckSelection.SelectionSet.IDs.Next(); } if (CheckFeatureOID > 0) { IVersionedWorkspace3 versionWorkspace = m_GlobalWorkspace as IVersionedWorkspace3; IFeatureWorkspace checkWorkspace = versionWorkspace as IFeatureWorkspace; IFeatureClass checkFeatureClass = checkWorkspace.OpenFeatureClass("CheckArea"); if (checkFeatureClass != null) { if (!(m_EditWorkspace.IsBeingEdited())) { m_EditWorkspace.StartEditing(false); } m_EditWorkspace.StartEditOperation(); int res = CheckFeatueEditor.UpdateComment(CheckFeatureOID, checkFeatureClass, textinput); m_EditWorkspace.StopEditOperation(); if (res > 0) { MessageBox.Show("提交成功!"); m_MapCtrls.ActiveView.Refresh(); } else { MessageBox.Show("提交失败!"); } } } }
/// <summary> /// Builds a domain of the version names for a workspace /// </summary> /// <param name="wmxDb">A reference to the active Workflow Manager database</param> /// <param name="workspaceName">The human-readable name of the workspace whose versions to look up</param> /// <param name="extraValues">An array of string values to be added to the list</param> /// <returns>A coded value domain of strings</returns> public static IGPDomain BuildVersionsDomain(IJTXDatabase3 wmxDb, string workspaceName, string[] extraValues) { IGPCodedValueDomain domain = new GPCodedValueDomainClass(); try { // Get all of the public versions connected to this workspace string workspaceId = Common.WmauHelperFunctions.LookupWorkspaceId(wmxDb, workspaceName); IWorkspace workspace = wmxDb.GetDataWorkspace(workspaceId, null); IVersionedWorkspace3 versionedWorkspace = workspace as IVersionedWorkspace3; IEnumVersionInfo allValues = versionedWorkspace.Versions; // Sort the types first SortedList <string, string> sortedValues = new SortedList <string, string>(); IVersionInfo version; while ((version = allValues.Next()) != null) { sortedValues.Add(version.VersionName, null); } // Add the extra values, if any if (extraValues != null) { foreach (string s in extraValues) { sortedValues.Add(s, null); } } // Add the sorted types to the domain foreach (string value in sortedValues.Keys) { IGPValue tempGpVal = new GPStringClass(); tempGpVal.SetAsText(value); domain.AddCode(tempGpVal, value); } } catch (System.Runtime.InteropServices.COMException comEx) { // If we run into an exception, send word up the chain throw new WmauException(WmauErrorCodes.C_VERSION_LOOKUP_ERROR, comEx); } return(domain as IGPDomain); }
public static ArrayList getVerionNameList(IWorkspace pWorkspace) { if (pWorkspace == null) { return(null); } IFeatureWorkspace FeatureWorkspace = pWorkspace as IFeatureWorkspace; IVersionedWorkspace3 VersionedWorkspace = FeatureWorkspace as IVersionedWorkspace3; ArrayList VersionNames = new ArrayList(); IEnumVersionInfo MulVersionInfo = VersionedWorkspace.Versions; IVersionInfo SiglVersionInfo = MulVersionInfo.Next(); while (SiglVersionInfo != null) { VersionNames.Add(SiglVersionInfo.VersionName); SiglVersionInfo = MulVersionInfo.Next(); } return(VersionNames); }