本文整理汇总了C#中TransactionManager.Current方法的典型用法代码示例。如果您正苦于以下问题:C# TransactionManager.Current方法的具体用法?C# TransactionManager.Current怎么用?C# TransactionManager.Current使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TransactionManager
的用法示例。
在下文中一共展示了TransactionManager.Current方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HasEdits
public static bool HasEdits(IApplication app, TransactionManager tm)
{
try
{
IWorkspaceEdit workspace = (IWorkspaceEdit)tm.Current().PGDBConnection;
bool processQA = false;
bool hasEdits = false;
workspace.HasEdits(ref hasEdits);
UID pUID = new UIDClass();
pUID.Value = "esriEditor.Editor";
IEditor editor = (IEditor)app.FindExtensionByCLSID(pUID);
IEditTask task = editor.CurrentTask;
IEditTask resetTask = editor.get_Task(0);
editor.CurrentTask = resetTask;
editor.CurrentTask = task;
IEditor2 editor2 = (IEditor2)app.FindExtensionByCLSID(pUID);
bool hasCachedEdits = editor2.HasEdits();
return hasCachedEdits || hasEdits;
}
catch (Exception e)
{
Logger.Write("Error testing if transaction has edits: " + e.Message + " : " + e.StackTrace, Logger.LogLevel.Debug);
throw new Exception("Error", e);
}
}
示例2: SaveEdits
public static bool SaveEdits(IApplication app, TransactionManager tm)
{
bool result = false;
try
{
if (HasEdits(app, tm))
{
UID pUID = new UIDClass();
pUID.Value = "esriEditor.Editor";
IWorkspaceEdit workspace = (IWorkspaceEdit)tm.Current().PGDBConnection;
IEditor2 editor2 = (IEditor2)app.FindExtensionByCLSID(pUID);
editor2.StopEditing(true);
editor2.StartEditing((IWorkspace)workspace);
workspace.StopEditing(true);
workspace.StartEditing(false);
}
result = true;
}
catch (Exception e)
{
Logger.Write("Error saving edits to PGDB", Logger.LogLevel.Debug);
MessageBox.Show("An error occured while attempting to save current edits.");
result = false;
}
return result;
}
示例3: TransactionSpatialReference
public static ISpatialReference TransactionSpatialReference(TransactionManager tm, ISDUTExtension ext)
{
IMxDocument pMxDoc = RestTransactionManager.Instance.BaseTransactionManager.app.Document as IMxDocument;
IMap pMap = pMxDoc.FocusMap;
IEnumLayer enm = pMap.Layers;
enm.Reset();
IFeatureLayer fl = enm.Next() as IFeatureLayer;
while (fl != null)
{
try
{
IFeatureWorkspace thePgdbWorkspace = (IFeatureWorkspace)tm.Current().PGDBConnection;
IFeatureClass theTransFC = thePgdbWorkspace.OpenFeatureClass(fl.Name);
ISpatialReference sr = ((IGeoDataset)theTransFC).SpatialReference;
if (sr != null) return sr;
}
catch (Exception e)
{
//ignore
}
fl = enm.Next() as IFeatureLayer;
}
return null;
}
示例4: RunTestsForm
public RunTestsForm(ref dao.QATestCollection tests, IMap map, TransactionManager tm, QAManager qa)
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
if (tests == null)
throw new ArgumentNullException("tests", "Must pass collection of QA tests to RunTestsForm");
if (tests.Count == 0)
throw new ArgumentException("No QA tests passed to RunTestsForm", "tests");
if (map == null)
throw new ArgumentNullException("map", "Must pass the focus map to RunTestsForm");
this._tests = tests;
this._tm = tm;
this._qa = qa;
this._map = map;
this._defaults = new util.SystemDefaults();
// Throw TM stuff at the QA tests and see if it sticks
if (tm.Current() != null)
{
object[] theArgs = new object[2] {
new ISDUTLib.tm.dao.EditsDAO((IFeatureWorkspace)tm.Current().PGDBConnection, tm.transactionConfig()),
tm.transactionConfig()
};
for (int i = 0; i < this._tests.Count; i++)
{
this._tests.get_Test(i).Test.UserData = theArgs;
}
}
}