-1

I have gone to License your app and there is only code for C#. I am wondering where to place the license information in my F# WPF application. Does it go in the app.fs file or a different one.

Thanks

Aaron M
  • 326
  • 2
  • 13
  • 1
    you could frame it though in a more general way, like how would you write this C# code in F#. – s952163 Jun 16 '16 at 23:34

1 Answers1

1

I'm not familiar with this SDK but it should go into the assembly (so exe or dll) file that uses it. It would've been helpful to show the C# code, and not just the link:

Esri.ArcGISRuntime.ArcGISRuntimeEnvironment.ClientId = "mYcLieNTid";

try
{
    Esri.ArcGISRuntime.ArcGISRuntimeEnvironment.Initialize();
}
catch (Exception ex)
{
    Console.WriteLine("Unable to initialize the ArcGIS Runtime with the client ID provided: " + ex.Message);

}

From the recently much improved F# docs Try/With is the equivalent exception handling mechanism in F#:

Esri.ArcGISRuntime.ArcGISRuntimeEnvironment.ClientId <- "mYcLieNTid";

try
    Esri.ArcGISRuntime.ArcGISRuntimeEnvironment.Initialize()
with
    | ex -> printfn "Unable to initialize the ArcGIS Runtime with the client ID provided: %A" ex.Message 

Additional Info: If you have time please take a look at F# for fun and also Modules and Classes, you can also search these topics on SO. Here are some comments:

  1. F# is sensitive to the file order in the project, please make sure that you put your module above the file that is open-ing it
  2. you generally #load *.fsx scripts, you can but you don't need to do this for *.fs files, as those assumed to be built into an assembly. You can just say open File1 assuming you have a File1.fs and inside it a module File1, then if inside the File1 module you have let let x = 5, you can say File1.x to access it
  3. You don't need to put a module into a separate file. You can just place it ino the namespace you have your SDK in (maybe App.fs).
  4. Easiest would be to actually put this code inside your main function, in the [<EntryPoint>]
s952163
  • 6,276
  • 4
  • 23
  • 47
  • thanks for your input on showing the C# code as a baseline example. I will be working on this issue this weekend and will reply back to see how the F# code works. – Aaron M Jun 18 '16 at 04:46
  • I copied the code directly in both the MainWindow and App files and got this Error: Namespaces cannot contain values. Consider using a module to hold your value declarations. So I created the module ApKey.fs and add open ApKey to either MainWindow or App files and now getting this Error The namespace or module 'Apkey' is not defined. I referenced #load "ApKey.fs" and still getting the error. – Aaron M Jun 20 '16 at 21:21
  • Well, that's really another question. Please see the *Additional Info* in my answer above. – s952163 Jun 20 '16 at 23:36
  • Added the code above the [] [] and now the Developer Use tag is remove. Thanks alot – Aaron M Jun 21 '16 at 01:12