protected override bool Initialize() { if (MilitaryOverlaySchema == null) { MilitaryOverlaySchema = new MilitaryOverlayDataModel(); } return(base.Initialize()); }
protected override bool Initialize() { if (MilitaryOverlaySchema == null) { MilitaryOverlaySchema = new MilitaryOverlayDataModel(); } //Add project opened listener ArcGIS.Desktop.Core.Events.ProjectOpenedEvent.Subscribe(async (args) => { Task<bool> isEnabledMethod = MilitaryOverlaySchema.ShouldAddInBeEnabledAsync(); bool enabled = await isEnabledMethod; }); return base.Initialize(); }
// Method commented out until we figure out if we can open Pro Projects outside of Pro // [TestMethod] public async Task Test_Task() { // NOT WORKING: // We thought we might be able to test SDK code with Pro Project dependencies // with this code, but the call throws exceptions in other threads and never returns await QueuedTask.Run(async () => { string aprx = @"C:\Projects\MySymbolEditorTest\MySymbolEditorTest.aprx"; string version; ArcGIS.Desktop.Core.Project.CanOpen(aprx, out version); await ArcGIS.Desktop.Core.Project.OpenAsync(aprx); }); // Never gets here: // Now project is loaded, we can test VM objects with Pro dependencies MilitaryOverlayDataModel modm = new MilitaryOverlayDataModel(); Task<bool> isEnabledMethod = modm.ShouldAddInBeEnabledAsync(); bool enabled = await isEnabledMethod; Assert.IsTrue(enabled); }