I have MyDotNet4.dll that user installs as application on machine. In my case this is components that will take care of interfacing with TWAIN scanner.
I also have my Silverlight application with elevated permissions (SL4 OOB or SL5 in/out of browser)
I want to somehow invoke methods of MyDotNet4.dll using Silverlight code. Is that possible? How? Any pointers or sample code?
My idea is to have Silverlight app and if user needs scanning - I will let him download and install real windows app and than I would like to somehow talk to this app from Silverlight.
It may not work, but have a look at this blog, http://netfxharmonics.com/2008/12/Reusing-NET-Assemblies-in-Silverlight, see The Assembly-Level Technique section if (as your question suggests) you do not have the source code for the dll in question. I have faint recollection that I used that method as a test a long while back, but since I had the source I ended up going with the file level approach to share common code between a dll referenced by my Silverlight project and my console app project
Silverlight does have local messaging but that works only between two silverlight apps. See the following for LocalMessaging
Msdn page.
Silverlight OOB and mutiple windows - LocalMessaging
From this similar SO post: Communicating with a Silverlight 4 LocalMessageReceiver from a Desktop Application and this other thread here on the silverlight forums seems you're out of luck and you will have to implement your own communication scheme.
I'm assuming your SL app needs to invoke the scanning app and get the image. You could run your scanning app like this and then have the app drop the picture in a know directory which your SL app can then pick.
Related
Does anybody of you guys have experiences with including a C#-based Console Application in a C#-based Universal Windows App?
The reason why I'm asking: I've an already exsisting Console Application developed by another developer. This Application includes a database with all the queries which I need for my App.
The problem: When I try to include the CA in my UWA project many commands like
private global::System.Runtime.InteropServices.HandleRef
throw new global::System.ApplicationException
don't get identified by VS2015.
Is there a way to let the UWA project identify CA commands? For example with adding an external CA-library or something like that.
Thank you!
You can't combine full .NET (console, winforms, WPF) assemblies with an UWP app, as they're different .NET frameworks. For more details, please read this reply. Part of the code is shareable in a Portable Class Library (PCL), but most likely not all of the code you've written.
Possible solutions:
Create an API (yourself or with the other developer) to expose the functionality needed over a (preferably) REST api.
Find a way to cheat the system. Example: launch a file (associated to the console application) with the Launcher api and output the results to a text file on disk, which you then read from your UWP app.
The first one is guaranteed to work. You might find a way to cheat the system for the second 'solution', but there's no guarantee that it won't break in the future when Windows 10 gets updated (experienced that myself for another 'hack' on the upgrade between Windows 8 and 8.1).
I am going to start a new (Right-To-Left) WPF project and the Main reason is to provide a single UI for the application in Windows and Web.
What Should I consider?
Which WPF Controls should/shouln't (can/can't) I use?
Do I Have to Use Silverlight? (I'm not interest)
Should I use XBAP project orWindows Project with Page base modules?
TIA
Your choices are indeed XBAP (WPF Browser App) and SilverLight.
You can easily google to find lots of comparisons, here is a short and simple one.
You main decision factor is your target audience. Do you want to support the Apple platform and maybe even Linux? Then use SilverLight.
If you're sure you only have Windows clients (Web and Desktop) you could use the more powerful WPF. But do write the WBA first so you don't run into permission issues later.
I hope you can help!
In brief, what I need is something like a cross platform web browser, with little or no chrome, that is easily distributable and allows the (local and remote) HTML pages running in it to receive messages (JavaScript?) when system global hotkeys are pressed.
I'm developing a desktop application which will utilise an existing web-based REST API. I would like this app to be cross-platform (Windows, Mac OS and Linux) and have a consistent interface across all platforms. The app runs in the system tray and uses global hotkeys for convenient access to a lot of it's functions without having to open the main UI window.
I have already written a rough initial version of the app using C#/Windows Forms, but there are a few issues. It currently uses unmanaged Win32 code to provide support for global hotkeys, which is not cross-platform even if I ported it to Mono. Plus, it's really not very pretty...
Ideally, I'd like to build the UI using traditional web technologies like XHTML/CSS and use JavaScript/AJAX to communicate with the remote API, which is why I thought Adobe AIR would be a good solution—but unfortunately it still doesn't support global hotkeys. I've also looked at XULRunner but I'm not sure I properly understand what that's intended for.
So the basic requirements for whichever combination of tools I will use are:
Allow me to create the user interface in XHTML/CSS/JavaScript
JavaScript to remotely communicate with the web API via AJAX
Allow the app to show—and be accessible via—a tray icon (in whatever OS it's running on)
Allow the app to respond to global hotkeys (again, in whatever OS it's running on)
Does anyone have any advice for me on this? I'm open to any suggestions and examples, no matter the language or tool.
Edit: I just stumbled across Nokia's Qt Toolkit, does anyone have any experience with this?
I think AIR application is a good solution. For the global hotkeys there are some "alternatives" Can I assign a global hotkey to an Adobe AIR app?
Today we have a windows application that, using an OCX, creates a web page (visible by a WebBrowser control in a small .NET WinForm application) and communicates through COM to the main application/client. (not relevant but this is Pascal)
I'm currently responsible to re create this application in a web environment so we can have the same functionality shared through Web as the user can see the same in a Web Browser.
The Windows application has almost 4 years on it and I need to re create everything from scratch, and all the bugs/features find in the future in the Windows Application I have to re create them again in the Web...
Ohh well, you can see where this will end.
I was thinking... is there any way I can create a Wrapper, even using 3rd party commercial objects, to:
Communicate with the COM Object
Can expose the content of the OCX
(this in my most confortable language, ASP.NET C#, but other are welcome)
I was thinking out loud, can this be accomplish with a Java Applet? Silverlight 4?
Any ideas or any point to the right road will be appreciated.
You may want to consider using Silverlight 4. Although it's not fully baked (Microsoft announced it as Release Candidate status yesterday or today) it has COM support but will run in a web enabled way.
The fact that your previous application is Windows/OCX tells me that the chief weakness of this approach, which would be platform neutrality, is less of an issue.
I am considering porting a WPF application to Silverlight. However, the WPF application uses Watin to spawn IE processes and automate certain tasks.
My question is if there is a way to automate tasks in Silverlight by spawning popups and performing tasks in them similar to how you would with Watin.
I haven't tried this tool yet, but it is the closest I've found to Watin for Silverlight. It is WebAii from Telerik and it is a free download. I ran across it the other day and plan to try it soon.
WebAii Testing Framework plugs
directly into the Silverlight
application it automates and has
access to every single element/object
in the entire Silverlight application.
Beside the ability to perform basic
automation actions like clicking,
moving and setting text, the tool
gives you access to complex properties
on UI elements such as brushes,
borders and even transform matrices.
What’s best is that you can set most
of these properties, which is crucial
for test verifications and
synchronizations.
As far as I know WatiN is a web application test framework, but your question seems to indicate that you are using WatiN to automate tasks in your application. In that context I will try to answer your question.
A Silverlight application is executed in a sandboxed environment and is unable to start new processes on the local computer. However, a Silverlight application can interact with the browser object model that is used to host the Silverlight application. This allows for some interaction with the local environment. If you can fit your use of WatiN into this model you are able to do it from Silverlight but in general you should consider a Silverlight application to live in a sandboxed environment.
Have you had a look at the Silverlight Automation Peer?
http://msdn.microsoft.com/en-us/library/cc645045(VS.95).aspx