Is it possible to embed a Mathematica window into a .NET application? I mean not just the interop, but actually making the notebook editor window part of a .NET form. Is this possible?
-
$\begingroup$ I'm curious about a related question using .NET technology: can the latest version of Microsoft's RichEdit control be embedded inside a Mathematica notebook? This would enable one to import verbatim snippets of mathematical text from Microsoft Office 2010 while retaining its original appearance and the ability to edit the imported text from within a Mathematica notebook. Such a feature would also facilitate sharing content between Office 2010 and CDF documents. $\endgroup$– StackExchangerCommented May 6, 2012 at 4:46
-
$\begingroup$ The word "editor" may be confusing. You may consider a FrontEnd window as an editor, though it's more than that. There's also the editor in Mathematica Workbench. That's more like the usual concept of an editor. $\endgroup$– Sjoerd C. de VriesCommented May 6, 2012 at 8:32
-
4$\begingroup$ If you mean the Front End, i.e. the GUI you see when you start Mathematica, I strongly suspect the answer is no. I think most of us wouldn't dare to say no categorically (we've been surprised too many times before), but I've never seen anything like this before on MathGroup or here. $\endgroup$– SzabolcsCommented May 6, 2012 at 12:35
-
$\begingroup$ Yes, I meant the front end. $\endgroup$– Dmitri NesterukCommented May 6, 2012 at 16:31
-
$\begingroup$ This seems like something you would need to license from Wolfram. You're asking for full fledged MMA functionality, but not in MMA.... $\endgroup$– tkottCommented May 7, 2012 at 2:10
2 Answers
Here is an idea - it's by no means perfect, but then again, the comments indicate that there won't be a perfect solution:
- In your .NET application, create a web view (I don't know the details for this, but that would go beyond the scope of this forum anyway - I've done similar things in Cocoa on Mac, so you should be able to find analogous libraries for .NET)
- As the URL for the web view, give the address of an HTML page with an embedded Mathematica
CDF
notebook. This could mean simply using an<embed>
tag, as described on Wolfram's web site. Here I'm talking about a HTML file stored locally with your .NET bundle. - Make sure you use the non-free version of a
CDF
(the one you get viaSave As...
). It should allow you to edit inside of it. - Of course the next question is how to exchange data. That depends on what data you need. But basically, you can try to do it with
Export
(orImport
) from theCDF
. This is where the "deployed" freeCDF
will not work, but the non-free ones (requiring Mathematica to be installed) will, at least according to what I'm seeing on my machine. Then the .NET application would have to be notified when an exported file is ready to be passed to it. TheCDF
could accomplish that on its own, or you could have the .NET application monitor a certain data file (used by theCDF
) for changes.
Regarding the data exchange problem, see also this CDF related post.
-
1$\begingroup$ This would be limited to CDF functionality and sandboxed. Being able to embed a full Mathematica notebook as a .NET window would be ideal. $\endgroup$ Commented May 6, 2012 at 22:37
-
1$\begingroup$ @ChrisDegnen Yes, so this may or may not be enough. Beyond this, one may be better off trying to re-implement a sort of notebook interface in the external application and linking to the Kernel from that. They have such an interface for Mathematica in Sage. $\endgroup$– JensCommented May 7, 2012 at 1:55
-
1$\begingroup$ I guess this will have to do for now. Thanks for the idea! $\endgroup$ Commented May 7, 2012 at 18:50
The next best thing would be to use NET/Link to open Mathematica notebooks, see:
How to output from a .NET console app to an existing Notebook in Mathematica?
Of course, this would require that Mathematica is installed on the target system, but for debugging uses it would be simply perfect.
-
$\begingroup$ Here is a way to create a notebook window with content from .NET: stackoverflow.com/a/8039266/879601 $\endgroup$ Commented Feb 7, 2013 at 8:56