POST
|
Basically, if you ignore the logic Wolf has implemented to check whether to change progress value and text or not, the pattern Wolf is using (in WPF) is the same standard pattern as with old school WinForms for updating the UI from a non-UI thread. Namely: Check if you are on the UI thread, if so, update progress directly. If not, invoke the update on the UI thread first. So the pattern resolves to: private void UpdateProgress ( . . . ) { //whatever "update progress" means - change a counter, text, etc NotifyPropertyChanged ( "ProgressValue" ) ; //Assuming something is bound to this } private void UpdateProgressSafely ( . . . ) { //FrameworkApplication and System.Windows.Application are the same thing if ( FrameworkApplication . Current . Dispatcher . CheckAccess ( ) ) //On the UI - do update directly UpdateProgress ( . . . ) ; else { //We are on a background thread, invoke on the UI FrameworkApplication . Current . Dispatcher . BeginInvoke ( ( Action ) ( ( ) = > UpdateProgress ( . . . ) ) ) ; Which is pretty much copy/paste ready. UpdateProgressSafely() can be called from any thread. The last thing probably worth some explanation is this intuitive piece of syntax: //what is all that "(Action)(() => .....) for? FrameworkApplication . Current . Dispatcher . BeginInvoke ( ( Action ) ( ( ) = > UpdateProgress ( . . . ) ) ) ; Well, let's remove all that "(Action)(.....)" cast reducing the syntax to a more legible: FrameworkApplication . Current . Dispatcher . BeginInvoke ( ( ) = > UpdateProgress ( . . . ) ) ; where "() => ..." is the standard anonymous delegate usage. However, intellisense will complain that: It "Cannot convert lambda expression to type 'Delegate' because it is not a delegate type" and you will get a compiler error. BeginInvoke has numerous overloads and without the "Action" cast the compiler cannot resolve which overload we want it to use. We have to help it by providing an explicit "Action" that wraps the delegate "() => ..." bringing us back full circle to "BeginInvoke( (Action) (() => ....) )". To simplify the syntax, you can also add your own utility method like this in your Module that can be used to call any method safely on the UI: //in your module or some helper class public void RunOnUIThread ( Action action ) { if ( FrameworkApplication . Current . Dispatcher . CheckAccess ( ) ) action ( ) ; else FrameworkApplication . Current . Dispatcher . BeginInvoke ( action ) ; } //usage await QueuedTask . Run ( ( ) = > { //some length process //... Module1 . Current . RunOnUIThread ( ( ) = > UpdateProgess ( 50 , "working..." ) ) ;
... View more
04-23-2020
02:37 PM
|
2
|
0
|
77
|
POST
|
sample: ShowLicense reference: topic8900.html - ArcGIS.Core.Licensing.LicenseInformation
... View more
04-23-2020
08:02 AM
|
0
|
1
|
34
|
POST
|
Hi Simon, Uma and I are looking into this with the development team. There is an internal event that fires when a user signs in or when a user signs out of online or portal. However, if the user toggles between active portals into which he or she is already signed in then, of course, that event does not fire (as the portal _signed on_ status did not change).....but.... the "active portal changed" event does fire because the active portal did change (and this event is already public) even though its signed on status didn't. Therefore, with the addition of this "new" event getting exposed to give you notification of a given portal's sign in/sign out status changing _combined with_ the existing " active portal changed" event giving you notification of the active portal changing - that should give you everything you need. We will get that in for 2.6.
... View more
03-27-2020
03:29 PM
|
0
|
3
|
106
|
POST
|
As Uma stated >> The Pro UI is written using WPF << and the SDK templates automate the generation of most of the possible UI elements that are supported in Pro (buttons, tools, panes, dockpanes, property pages, property sheets, custom controls, and so on). However, you can write any of the UI elements by hand - you would just be responsible for deriving from the correct base classes, adding the requisite overloads and so forth, and adding the necessary Config.daml entries. This can be a tedious business to repeat each time you need to add, say a button or a dockpane. That is where the SDK templates come in - to help automate a lot of these repetitive tasks. However, you don't _have_ to use them. You can do it all by hand as you need (for example - copy/pasting or moving existing classes from one add-in project to another). Also, within WPF, the underlying technology used by the Pro UI, you can host a Winforms control within a WPF user control or window - though this is not a common pattern and is usually done for legacy reasons (eg an old WinForms control provides a specific set of functionality not easily duplicated in WPF or the level of effort is too great to rewrite it). You can read the Microsoft documentation on WindowsFormHost for more information if you are interested.
... View more
03-25-2020
10:16 PM
|
0
|
1
|
53
|
POST
|
Ideally, you want the defaultAssembly and defaultNamespace attributes to _match_ the corresponding properties in your visual studio project (i.e. Application properties tab, Assembly name, Default namespace). If you change the name of your assembly or default namespace in Visual Studio then be sure to update your Config.daml to keep it in sync. Additionally, depending on how you have your project arranged and which project folders you organize your content into, you may also need to change the className attribute on your various DAML entries if you rename classes or move them around. If a given control or dockpane or whatever is _not_ in the default namespace then you must always fully qualify the className attribute. The SDK templates do this for you automatically when they first generate a given DAML entry but if you refactor your add-in content then it is your responsibility to keep your Config.daml up to date. In your example, say you were to refactor your Module cs file to a different namespace (or rename it or....) then you would need to go into the Config.daml and change the "<module className" attribute to match - fully qualifying the className if your "refactored" ModuleMain were to no longer be in the MyCompany.MyDepartment.MyAddin namespace (i.e. your current default).
... View more
03-23-2020
02:08 PM
|
0
|
1
|
46
|
POST
|
This section of the Pro Concepts Framework may help: ProConcepts-Framework#module-plug-in. This is basically what Than is describing. Some debugging tips are here: ProGuide-Diagnosing-ArcGIS-Pro-Add-ins
... View more
03-23-2020
09:16 AM
|
2
|
0
|
46
|
POST
|
I think we have two separate things going on here and please confirm: 1) You originally were asking can you specify a clipping polygon for the map via the API, is that right? The answer is no. You cannot and this will be added for 2.6 2) You are using EditOperation.Clip to "manually" clip features and you have encountered a bug, is that right? So no, my statement regarding 1) , map clipping, is not related. To submit a bug please contact tech support. This post may help: How to report a bug in ArcGIS Pro Note: just looking at your code above, I believe the result you are looking for requires ClipMode.PreserveArea not DiscardArea.
... View more
03-11-2020
10:36 AM
|
0
|
1
|
104
|
POST
|
In general, calling a modal dialog from the queued task should be avoided. protected override void OnClick ( ) { //construct on the UI var dlg = new SaveItemDialog ( ) ; dlg . Title = "On QueuedTask" ; QueuedTask . Run ( ( ) = > { FrameworkApplication . Current . Dispatcher . Invoke ( ( ) = > { var result = dlg . ShowDialog ( ) ; } ) ; } ) ; } . . . .
... View more
03-06-2020
02:47 PM
|
0
|
1
|
13
|
POST
|
Overlays are not persisted which is why you cannot print (or export) them. At 2.6 there will be the concept of a graphics layer. Graphics you add to a graphics layer will be persistable (and so can be printed).
... View more
03-03-2020
02:02 PM
|
2
|
0
|
41
|
POST
|
Jamal, yes, I investigated this and setting clipping on the map is not currently possible via the API. I have passed on the requirement to the mapping team. It will be targeted for release at 2.6
... View more
03-03-2020
09:43 AM
|
0
|
4
|
104
|
Online Status |
Offline
|
Date Last Visited |
Thursday
|