can we inject flex/air based component in winform application? - winforms

I am starting to write a flex based data visualization application. I would like to consider the possibility of injecting this as a component in an existing MDI winforms application.
Is there a way to server this integration by deploying my flex app as a AIR based application and somehow integrate it in a MDI winform application as a child window ?
I highly doubt this is possible but would like to know if someone made an attempt to do this sort of integration successfully.

If you can integrate a IE instance in WinForm then you should be able to run the flex from there.
Communication could then be established between winform and flex via ExternalInterface in Flex (which talks to javascript in the IE instance).

Related

WinForms WebBrowser control's JavaScript execution context

I am using the WinForms WebBrowser control in my C# application and I can interact with the JS code on the web page by setting a COM class in the ObjectForScripting property of the control.
Is it possible to get the JavaScriptContext object from the web browser control that I can use with the ChakraCore API?
No sir, ChakraCore is part of the Microsoft Edge JavaScript engine. It is literally a separate engine. The web browser control uses IE's engine. Although admittedly it doesn't help that the dev team at MS called The MS Edge Engine Chakra when they were calling the engine from IE 9 forward as Chakra also.
Anyway if you want to use/embed the ChakraCore engine from C# they did create a getting started page. I will link it here.
The API for the winforms Webbrowser control Engine is here. The is a wrapper around the COM API. If you need to get to the COM api to do advanced things, you will need MSHTML, which you add as a COM reference to Microsoft Html Object library. The reference for MSHTML is here.

How to cast from Windows.UI.Xaml.UIElement to System.Windows.Controls.UIElement

I'm trying to create a new UI for an app I developed for the Windows Store using the Windows Runtime API. This new client is going to be a WPF Desktop App. I'm trying to reuse as much code as I can but I'm facing several issues.
Fortunately there's a way to use WinRT in a WPF Desktop app (see this and this)
Now I'm blocked by the following issue:
The MediaCapture class has a method to start the preview of a device, after I've started the preview I can create a CaptureElement to display the preview.
CaptureElement is part of Windows.UI.Xaml.Controls and cannot be used in containers from System.Windows.Controls in which the WPF UI is built.
Am I going anywhere with this approach? what would you recommend? How can I display the preview of a device in the WPF app?
Thanks in advance
CaptureElement can't be used in desktop applications - the documentation says "[Windows Store apps only]". In general - the UI controls from WPF and WinRT/XAML can't be used outside of their respective domains (desktop/immersive UI). In a WPF app you need to use WPF controls - e.g. DirectShow for camera capture,

How do I embed nancy in a WPF application

I need to host an embedded HTTP server within a WPF application and I was thinking of using Nancy. However I'm having trouble getting started. My requirements are quite modest all I want to do is serve up some HTML and JavaScript and display it in a WebBrowser control.
How would I configure Nancy to do this?
Just use the self host the same way as the sample app ( https://github.com/NancyFx/Nancy/tree/master/src/Nancy.Demo.Hosting.Self ) - you may need to spin it up in a different thread though in WPF.

Recording Screen Interactions using UI Automation for Silverlight controls

I am trying to use UI Automation to record screen interactions in my Silverlight app. I have the Automation Peers for my control setup but am not able to figure out how to track these controls.
For my WPF app I would get hold of AutomationElement.RootElement and then navigate down to my App and setup Automation event Handlers on the controls I am interested in.
How would I do the same for Silverlight app? I want the screen recorder to start automatically whenever my app runs. The screen recorder has to sit within my App. But the System.Windows.Automation silverlight namespace doesn't have a AutomationElement class. So how would I do this in Silverlight?
Thanks
Shivaprasad
As you observed, the AutomationElement class doesn't exist in Silverlight: the UIAutomation API is available only in the full .Net framework. Silverlight is only supported as an UI Automation provider - that is, Silverlight applications can be controlled by UI Automation, but they are not able to control other applications.
For this reason, I don't think you're going to be able to create your screen recorder within the Silverlight application - unless you are prepared to resort to some nasty hacks.
Such hacks might include:
Using Silverlight COM Automation to call the new UIAutomation COM API. Users would be required to have the COM API installed on their machines in addition to Silverlight.
Create a "server" application in .Net that you can run on the target machine that does the actual UIAutomation work, then communicate with this from your Silverlight application using WCF.

Using ActiveX with Silverlight

I would really like to use Silverlight for a project I'm working on but I will need to interact with an application running on the user's desktop. Is it possible to do this with Silverlight, or am I stuck with ASP.NET + ActiveX?
You can use Silverlight as an ActiveX component in a standard windows application... See alternate hosting: http://code.msdn.microsoft.com/silverlightalthost
If you have to do this via a Web application, you could write a custom signed ActiveX component and interact with it from Silverlight (via JS bridge)
Silverlight applications run in a sandbox on the client and cannot communicate outside except through sockets or ports. You'll probably have to go ActiveX.

Resources