当前位置: 首页>>代码示例>>C#>>正文


C# Utils.StartEditing方法代码示例

本文整理汇总了C#中System.Utils.StartEditing方法的典型用法代码示例。如果您正苦于以下问题:C# Utils.StartEditing方法的具体用法?C# Utils.StartEditing怎么用?C# Utils.StartEditing使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Utils的用法示例。


在下文中一共展示了Utils.StartEditing方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnClick

        protected override void OnClick()
        {
            m_pApp = (IApplication)ArcMap.Application;
              if (m_pApp == null)
            //if the app is null then could be running from ArcCatalog
            m_pApp = (IApplication)ArcCatalog.Application;

              if (m_pApp == null)
              {
            MessageBox.Show("Could not access the application.", "No Application found");
            return;
              }
              IGxApplication pGXApp = (IGxApplication)m_pApp;
              stdole.IUnknown pUnk = null;
              try
              {
            pUnk = (stdole.IUnknown)pGXApp.SelectedObject.InternalObjectName.Open();
              }
              catch (COMException ex)
              {
            if (ex.ErrorCode == (int)fdoError.FDO_E_DATASET_TYPE_NOT_SUPPORTED_IN_RELEASE ||
            ex.ErrorCode == -2147220944)
              MessageBox.Show("The dataset is not supported in this release.", "Could not open the dataset");
            else
              MessageBox.Show(ex.ErrorCode.ToString(), "Could not open the dataset");
            return;
              }

              if (pUnk is ICadastralFabric)
            m_pCadaFab = (ICadastralFabric)pUnk;
              else
              {
            MessageBox.Show("Please select a parcel fabric and try again.", "Not a parcel fabric");
            return;
              }

              IMouseCursor pMouseCursor = new MouseCursorClass();
              pMouseCursor.SetCursor(2);

              Utils FabricUTILS = new Utils();

              ITable pTable = m_pCadaFab.get_CadastralTable(esriCadastralFabricTable.esriCFTParcels);
              IDataset pDS = (IDataset)pTable;
              IWorkspace pWS = pDS.Workspace;
              bool bIsFileBasedGDB = true;
              bool bIsUnVersioned = true;

              FabricUTILS.GetFabricPlatform(pWS, m_pCadaFab, out bIsFileBasedGDB,
            out bIsUnVersioned);

              //Do a Start and Stop editing to make sure we're not running in an edit session
              if (!FabricUTILS.StartEditing(pWS, true))
              {//if start editing fails then bail
            if (pUnk != null)
              Marshal.ReleaseComObject(pUnk);
            Cleanup(pMouseCursor, null, pTable, null, pWS, null, true);
            FabricUTILS = null;
            return;
              }
              FabricUTILS.StopEditing(pWS);

              ITable pPlansTable = m_pCadaFab.get_CadastralTable(esriCadastralFabricTable.esriCFTPlans);
              ITable pParcelsTable = m_pCadaFab.get_CadastralTable(esriCadastralFabricTable.esriCFTParcels);

              m_pProgressorDialogFact = new ProgressDialogFactoryClass();
              m_pTrackCancel = new CancelTrackerClass();
              m_pStepProgressor = m_pProgressorDialogFact.Create(m_pTrackCancel, m_pApp.hWnd);
              IProgressDialog2 pProgressorDialog = (IProgressDialog2)m_pStepProgressor;
              int iRowCount = pPlansTable.RowCount(null);
              int iRowCount2 = pParcelsTable.RowCount(null);
              m_pStepProgressor.MinRange = 1;
              m_pStepProgressor.MaxRange =iRowCount  + iRowCount2;
              m_pStepProgressor.StepValue = 1;
              pProgressorDialog.Animation = ESRI.ArcGIS.Framework.esriProgressAnimationTypes.esriProgressSpiral;
              pProgressorDialog.ShowDialog();
              m_pStepProgressor.Message = "Searching " + iRowCount2.ToString() + " parcel records...";

              int iFixCnt = 0;
              //load all the plan names into a string array

              ArrayList NoPlanParcels = new ArrayList();
              ArrayList NoPlanParcelsGrouped = new ArrayList();
              ArrayList PlansList = new ArrayList();
              Dictionary<int, int> ParcelLookup = new Dictionary<int, int>();

              if (!FindNoPlanParcels(pPlansTable, pParcelsTable, ref PlansList, ref NoPlanParcels,
            ref NoPlanParcelsGrouped, ref ParcelLookup, out iFixCnt))
              {
            pProgressorDialog.HideDialog();
            if (iFixCnt > 0)
              MessageBox.Show("Canceled searching for parcels with no plan.", "Fix Parcels With No Name");

            NoPlanParcels = null;

            Cleanup(pMouseCursor, null, pTable, pPlansTable, pWS, pProgressorDialog, true);
            return;
              }

              m_pStepProgressor.Message = "Search complete.";

//.........这里部分代码省略.........
开发者ID:Esri,项目名称:parcel-fabric-desktop-addins,代码行数:101,代码来源:FixParcelsWithNoPlan.cs

示例2: OnClick

        protected override void OnClick()
        {
            m_pApp = (IApplication)ArcMap.Application;
              if (m_pApp == null)
            //if the app is null then could be running from ArcCatalog
            m_pApp = (IApplication)ArcCatalog.Application;

              if (m_pApp == null)
              {
            MessageBox.Show("Could not access the application.", "No Application found");
            return;
              }
              IGxApplication pGXApp = (IGxApplication)m_pApp;
              stdole.IUnknown pUnk = null;
              try
              {
            pUnk = (stdole.IUnknown)pGXApp.SelectedObject.InternalObjectName.Open();
              }
              catch (COMException ex)
              {
            if (ex.ErrorCode == (int)fdoError.FDO_E_DATASET_TYPE_NOT_SUPPORTED_IN_RELEASE ||
            ex.ErrorCode == -2147220944)
              MessageBox.Show("The dataset is not supported in this release.", "Could not open the dataset");
            else
              MessageBox.Show(ex.ErrorCode.ToString(), "Could not open the dataset");
            return;
              }

              if (pUnk is ICadastralFabric)
            m_pCadaFab = (ICadastralFabric)pUnk;
              else
              {
            MessageBox.Show("Please select a parcel fabric and try again.", "Not a parcel fabric");
            return;
              }

              IMouseCursor pMouseCursor = new MouseCursorClass();
              pMouseCursor.SetCursor(2);

              Utils FabricUTILS = new Utils();

              ITable pTable = m_pCadaFab.get_CadastralTable(esriCadastralFabricTable.esriCFTParcels);
              IDataset pDS = (IDataset)pTable;
              IWorkspace pWS = pDS.Workspace;
              bool bIsFileBasedGDB = true;
              bool bIsUnVersioned = true;

              FabricUTILS.GetFabricPlatform(pWS, m_pCadaFab, out bIsFileBasedGDB,
            out bIsUnVersioned);

              //Do a Start and Stop editing to make sure we're not running in an edit session
              if (!FabricUTILS.StartEditing(pWS, true))
              {//if start editing fails then bail
            if (pUnk != null)
              Marshal.ReleaseComObject(pUnk);
            Cleanup(pMouseCursor, null, pTable, null, pWS, null);
            FabricUTILS = null;
            return;
              }
              FabricUTILS.StopEditing(pWS);
              IFIDSet pPlansToDelete = null;

              try
              {
            string[] SummaryNames = new string[0]; //define as dynamic array
            string[] RepeatPlans = new string[0]; //define as dynamic array
            ITable pPlansTable = m_pCadaFab.get_CadastralTable(esriCadastralFabricTable.esriCFTPlans);
            //load all the plan names into a string array
            m_pProgressorDialogFact = new ProgressDialogFactoryClass();
            m_pTrackCancel = new CancelTrackerClass();
            m_pStepProgressor = m_pProgressorDialogFact.Create(m_pTrackCancel, m_pApp.hWnd);
            IProgressDialog2 pProgressorDialog = (IProgressDialog2)m_pStepProgressor;
            int iRowCount = pPlansTable.RowCount(null);
            m_pStepProgressor.MinRange = 1;
            m_pStepProgressor.MaxRange = iRowCount * 2;
            m_pStepProgressor.StepValue = 1;
            pProgressorDialog.Animation = ESRI.ArcGIS.Framework.esriProgressAnimationTypes.esriProgressSpiral;
            pProgressorDialog.ShowDialog();
            m_pStepProgressor.Message = "Finding same-name plans to merge...";

            int iRepeatCnt = 0;

            if (!FindRepeatPlans(pPlansTable, out RepeatPlans, out SummaryNames, out iRepeatCnt))
            {
              pProgressorDialog.HideDialog();
              if (iRepeatCnt == 0)
              {
            MessageBox.Show("All plans in the fabric have unique names." +
               Environment.NewLine + "There are no plans to merge.", "Merge plans by name");
              }
              else
              {
            MessageBox.Show("There was a problem searching for repeat plans.", "Merge plans by name");
              }
              SummaryNames = null;
              RepeatPlans = null;
              Cleanup(pMouseCursor, null, pTable, pPlansTable, pWS, pProgressorDialog);
              return;
            }

//.........这里部分代码省略.........
开发者ID:Esri,项目名称:parcel-fabric-desktop-addins,代码行数:101,代码来源:MergeSameNameFabricPlans.cs


注:本文中的System.Utils.StartEditing方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。