Hi
With what version of Wisej are you working?
Regards
I thought I’d add my solution to my problem here although the point of the question becomes moot. As a relative nube on WiseJ, an alternative solution resulted from realizing that I’m using WebSocket. The technique to download I was working on relied on HttpRequest which is incompatible when using WebSocket. The solution was to skip providing a FileSavePicker and simplify the process using the Application Download(stream,”FileName.3mf”) method. The stream resulting from the 3D Printing UWP code running in the sub-domain returns a zip file. I simply downloaded it into the Downloads folder on my PC. It works great. I’m still not sure how to implement the FileSavePicker in a sub-domain. My attempt at using Invoke to call the FileSavePicker process also failed to generate a window handle, but it became unnecessary.
Thanks for the assistance.
Gerry
Adding sample project again. I had to clean out the bin folder in the zip since the WiseJ DLLs alone are bigger than the max file size allowed of 3.9 MB
New project -nothing edited – cant view designer – WiseJ3 is installed and the dependencies resolve. See screenshot
Any Ideas ?
Sample project attached. After closing Visual Studio and reopening- now it does not render the designer at all – just shows an error
Hi Edmond,
Unfortunately, I wasn’t able to reproduce this issue.
Can you send us a runnable sample?
Thanks,
Alaa
//
Attached is a screenshot of my package manager URLs. I just installed VS 2022 yesterday so not sure how the nuget urls would be wrong ?
I changed the project file as suggested to “3.0” and re-opened the solution but nothing has changed. See attached screen shot
Hi edmond,
Try to install manually with nuget.
https://www.nuget.org/packages/Wisej-3-MobileIntegration/
https://www.nuget.org/packages/Wisej-3/
I was able to download the installer from wisej.com/builds and installed Wisej-3.
Opened my solution – recompiled – still cant find WiseJ3 – screenshot of Visual Studio 2022 attached. Any ideas ?
That is for a desktop app and uses the process MainWindowHandle.
Wisej doesn’t have a UI thread and doesn’t have a main window handle because it’s not a desktop app. You would be opening a file explorer on a web server!
If you are using the Wisej.Application exe for a standalone app you have to invoke the call on the main UI thread.
Thanks for your reply! I thought I added the handle using the technique from this article: https://stackoverflow.com/questions/57161258/invalid-window-handle-error-when-using-fileopenpicker-from-c-sharp-net-framwo. My vb code is below. I’ve been reading through the variety of related topics but this keeps coming up as the accepted approach. Is there another resource you can point me toward? Thanks again!
Code:
<ComImport>
<Guid(“3E68D4BD-7135-4D10-8018-9FB6D9F33FA1”)>
<InterfaceType(ComInterfaceType.InterfaceIsIUnknown)>
Interface IInitializeWithWindow
Sub Initialize(ByVal hwnd As IntPtr)
End Interface
Private Async Function SaveTo3mf(localPackage As Printing3D3MFPackage) As Task(Of Boolean)
Dim savePicker As FileSavePicker = New FileSavePicker()
savePicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary
savePicker.DefaultFileExtension = “.3mf”
savePicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary
savePicker.FileTypeChoices.Add(“3MF File”, {“.3mf”})
Call CType(CObj(savePicker), IInitializeWithWindow).Initialize(Process.GetCurrentProcess().MainWindowHandle)
Dim storageFile = Await savePicker.PickSaveFileAsync()
If storageFile Is Nothing Then
Return False
End If
Using stream = Await localPackage.SaveAsync()
stream.Seek(0)
Using dataReader = New DataReader(stream)
Await dataReader.LoadAsync(CUInt(stream.Size))
Dim buffer = dataReader.ReadBuffer(CUInt(stream.Size))
Await FileIO.WriteBufferAsync(storageFile, buffer)
End Using
End Using
Return True
End Function
Here is the test 3MFTest project. I had also built a non-WiseJ Forms App and the code works there.
The discussion where is shows the AppDomain switching approach is here: https://stackoverflow.com/questions/40613882/uwp-api-in-asp-net
The discussion where it shows the possible solution to the Handle problem is here: https://stackoverflow.com/questions/57161258/invalid-window-handle-error-when-using-fileopenpicker-from-c-sharp-net-framwo
Thanks very much!
Gerry
Hi Gerald,
Can you please wrap up a small sample that reproduces the issue ?
Best,
Alaa
Hi Jorge,
I’m sorry for this delayed response, the error you’re getting could be a windows related issue, and there’s a simple way to check it out.
You can simply load the Image and save to file using the png format on the server in a .NET app and see if it works. When using the Image property Wisej has to load the image to MemoryStream as png and convert to base64.
And there’s another thing that you can also try, try to use the ImageSource properties instead of ‘Image’, that way the server does nothing and would only serve the file, an example of that would be Control.ImageSource = “Images/image1.png”, and don’t forget to also deploy the images too!
HTH,
Alaa
Hi Neil,
The PdfViewer already uses Mozilla pdfjs,
Here’s a sample: https://drive.google.com/file/d/1ChA0zEi_qFyWNqYmrS2IBQsSYmSo9_OJ/view?usp=sharing
HTH,
Alaa
Hi Birol,
Are you perhaps using the Trial version?
If you are, you can use the community server instead which is limited to 10 concurrent client requests allowing more than 10 concurrent clients.
If that’s not the case, please email us your .LIC file to support AT wisej.com
Best,
Alaa
It worked, Luca! It was the unmanaged app pool configuration.
Thank you very much!
Ulisses, I tried your app with IIS and the web.config we provide and it works without issues and without changes. The web.config we provide is setup to work with the project as-is. Please note that if you have IIS use the same target directory and run the app it will lock the binaries.
<aspNetCore stdoutLogEnabled=”false” hostingModel=”InProcess” processPath=”bin\Debug\net6.0\WisejWebPageApplication1.exe” arguments=”” />
Works.
If you want to use the publishing tool to consolidate the build, all you need to do is change the processPath in web.config. Also the publishing tools has many other options that you have to be aware of regarding the .NET 6 runtime itself. The documentation is all on msdn, it’s messy and unclear but that’s what it is from Microsoft.
Luca, I followed the following steps:
1 – Install ASP.NET Core Hosting Bundle: https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/runtime-aspnetcore-6.0.4-windows-hosting-bundle-installer
2 – Create folder C:\inetpub\wwwroot\wisej3core
3 – Open IIS
4 – Add application ‘wisej3core’
5 – Open attached file (WisejWebPageApplication1.zip)
6 – Publish it
7 – Copy files to C:\inetpub\wwwroot\wisej3core
8 – Uncomment lines in web.config
9 – Open http://127.0.0.1/wisej3core/
