private string getCommitComment() { FormInsert dialog = new FormInsert(); dialog.QAChecks = this.ext.QAManager.TestStatus; System.IntPtr myIntPtr = new IntPtr(app.hWnd); Utils.Win32WindowWrapper wrapper = new Utils.Win32WindowWrapper(myIntPtr); dialog.ShowDialog((IWin32Window) wrapper); DialogResult dr = dialog.State; if(DialogResult.Cancel.Equals(dr)) { throw new CancelException("Operation Canceled"); } return dialog.Comment; }
// can be called from tool when activated void finishTransaction() { startHourGlass("Update Spatial Edit Extent"); // cleanup visuals if(featureClass != null) { SEEUserInterfaceUtils.removeSEELayer(featureClass,ext); // TEST Apr 3, 2008 // Setting featureclass to null is causing an exception // when the user clicks on the expands the see and manually draws a larger SEE area // featureClass = null; } if (see == null) { endHourGlass(); return; // cancelled } else { try { // open the SEE pgdb IFeatureClass fc = null; string path = ext.get_SystemValue(DAOUtils.ISDUT_SEE_TEMP); IWorkspaceFactory workspaceFactory = new ESRI.ArcGIS.DataSourcesGDB.FileGDBWorkspaceFactoryClass(); IFeatureWorkspace workspace = (IFeatureWorkspace)workspaceFactory.OpenFromFile(path, 0); fc = workspace.OpenFeatureClass(SEEDAO.OSDB_SEE_NAME); see.Project(fc); } finally { endHourGlass(); } } System.IntPtr myIntPtr = new IntPtr(app.hWnd); Utils.Win32WindowWrapper wrapper = new Utils.Win32WindowWrapper(myIntPtr); try { checkUTM(see); startHourGlass("Expanding Transaction"); try { // fetch the original transaction string sourcePath = RestTransactionManager.Instance.BaseTransactionManager.Current().PGDB.FullName; string sourceMxdPath = RestTransactionManager.Instance.BaseTransactionManager.Current().MXD.FullName; IWorkspace sourceWorkspace = RestTransactionManager.Instance.BaseTransactionManager.Current().PGDBConnection; string sourceSeeID = RestTransactionManager.Instance.BaseTransactionManager.Current().SeeID; // Create a new transaction from the expanded SEE area BusinessArea ba = BusinessArea.Null; // (BusinessArea)metadata[BUSINESS_AREA_KEY]; string filePath = this.ext.TransactionManager.Current().PGDB.Directory.FullName; string name = this.ext.TransactionManager.Current().PGDB.Name.TrimEnd(".gdb".ToCharArray()) + "_Expanded"; string description = this.ext.TransactionManager.Current().Description; string userName = this.ext.TransactionManager.Current().UserName; bool generated = false; RestTransactionManager.Instance.CreateTransaction(name, description, filePath, userName, see, generated); // merge the old PGDB with the new PGDB IWorkspace destinationeWorkspace = RestTransactionManager.Instance.BaseTransactionManager.Current().PGDBConnection; string destinationSeeID = RestTransactionManager.Instance.BaseTransactionManager.Current().SeeID; // do the merge here startHourGlass("Merging transaction states"); MergeTransactions(sourceWorkspace, destinationeWorkspace); // delete the old PGDB Marshal.ReleaseComObject(sourceWorkspace); sourceWorkspace = null; File.Delete(sourcePath); File.Delete(sourceMxdPath); RestTransactionManager.Instance.SetTransactionStatus("CANCELLED", "AOI was expanded. Old transaction cancelled", sourceSeeID); //this.ext.TransactionManager.Current().Expand(see); } catch (Exception e) { } finally { endHourGlass(); } //FormSEEConflicts form = new FormSEEConflicts(); //SEEConflictDAO dao2 = new SEEConflictDAO(this.ext); //ArrayList l = null; //startHourGlass("Checking for SEE Conflicts"); //try //{ // l = dao2.getConflicts(this.ext.TransactionManager.Current().TxId, see.Shape, this.ext.TransactionManager.Current().OperationalDatasetName); //} //finally //{ // endHourGlass(); //} //form.Conflicts = l; //if (l != null && l.Count > 0) //{ // form.ShowDialog((IWin32Window)wrapper); //} } catch (Exception e) { // log stack trace and re-throw Logger.Warn(e); throw e; } finally { app.CurrentTool = null; } }
public void Login(int hWnd) { AuthenticationBrowser ab = new AuthenticationBrowser(Consumer, Secret, BaseAuthenticationUrl, AuthenticateUrl, TokenUrl, TokenCheckUrl, RedirectUrl, Scope); System.IntPtr myIntPtr = new IntPtr(hWnd); Utils.Win32WindowWrapper wrapper = new Utils.Win32WindowWrapper(myIntPtr); ab.ShowDialog((IWin32Window)wrapper); }
// can be called from tool when activated void finishCreatingTransaction() { System.IntPtr myIntPtr = new IntPtr(app.hWnd); Utils.Win32WindowWrapper wrapper = new Utils.Win32WindowWrapper(myIntPtr); bool deac = false; try { // cleanup visuals SEEUserInterfaceUtils.removeSEELayer(featureClass,ext); featureClass = null; if (see == null) { return; // cancelled } else { // open the SEE pgdb IFeatureClass fc = null; string path = ext.get_SystemValue(DAOUtils.ISDUT_SEE_TEMP); IWorkspaceFactory workspaceFactory = new ESRI.ArcGIS.DataSourcesGDB.FileGDBWorkspaceFactoryClass(); IFeatureWorkspace workspace = (IFeatureWorkspace)workspaceFactory.OpenFromFile(path, 0); fc = workspace.OpenFeatureClass(SEEDAO.OSDB_SEE_NAME); see.Project(fc); // This code stores the data to the database and grabs the feature class. We don't want to do this anymore // write to the ISDUT pdgb instead? /*string prefix = ext.get_SystemValue(DAOUtils.ISDUT_SCHEMA_KEY); if (prefix != null && !prefix.Equals("") && !prefix.EndsWith(".")) { prefix = prefix + "."; } IFeatureClass fc = null; try { fc = ((IFeatureWorkspace)ext.TransactionManager.ConnectionManager.Isdut) .OpenFeatureClass(prefix + SEEDAO.OSDB_SEE_NAME); } catch (Exception e) { MessageBox.Show("OSDB Feature Class " + prefix + SEEDAO.OSDB_SEE_NAME + " Not Found in Isdut", "EXCEPTION", MessageBoxButtons.OK, MessageBoxIcon.Error); throw new HandledException(e); } see.Project(fc);*/ } // get metadata -- including transaction type Hashtable metadata = getMetadata(wrapper); BusinessArea ba = BusinessArea.Null;// (BusinessArea)metadata[BUSINESS_AREA_KEY]; string filePath = (string)metadata[FILE_PATH_KEY]; string name = (string)metadata[FILE_NAME_KEY]; string description = (string)metadata[DESCRIPTION_KEY]; string userName = (string)metadata[USERNAME_KEY]; bool generated = (bool)metadata[FILE_PATH_GENERATED_KEY]; RestTransactionManager.Instance.CreateTransaction(name, description, filePath, userName, see, generated); // REPLACE THIS METHOD WITH REST SERVICE METHOD // create transaction -- involved //this.ext.TransactionManager.Create(filePath, generated, ba, see, // (string)metadata[DESCRIPTION_KEY], (string)metadata[USERNAME_KEY]); //FormSEEConflicts form = new FormSEEConflicts(); //SEEConflictDAO dao = new SEEConflictDAO(this.ext); //ArrayList l = null; //startHourGlass("Checking for SEE Conflicts"); //try //{ // l = dao.getConflicts(this.ext.TransactionManager.Current().TxId, see.Shape, this.ext.TransactionManager.Current().OperationalDatasetName); //} //finally //{ // endHourGlass(); //} //form.Conflicts = l; //if (l != null && l.Count > 0) //{ // form.ShowDialog((IWin32Window)wrapper); //} //deac = true; //app.CurrentTool = null; //this.ext.TransactionManager.initMap(BusinessArea.Tantalis, (string)metadata[DESCRIPTION_KEY], (string)metadata[USERNAME_KEY]); } catch (Exception e) { // log stack trace and re-throw Logger.Warn(e); Logger.DeactivateLogger(); throw e; } finally { //if(!deac) //app.CurrentTool = null; } }