├── screenshot.png ├── .nuget ├── NuGet.exe ├── NuGet.Config └── NuGet.targets ├── embedd-wpf-demo ├── log-config.json ├── Properties │ ├── Settings.settings │ ├── Settings.Designer.cs │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ └── Resources.resx ├── App.xaml ├── rvm.json ├── App.xaml.cs ├── app.config ├── NLog.config ├── PeopleData.cs ├── web-content │ ├── index.html │ └── app.js ├── MainWindow.xaml ├── Person.cs ├── packages.config ├── MainWindow.xaml.cs └── embedd-wpf-demo.csproj ├── embedd-wpf-demo.sln ├── .gitignore └── README.md /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openfin/embedding-wpf-demo/HEAD/screenshot.png -------------------------------------------------------------------------------- /.nuget/NuGet.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openfin/embedding-wpf-demo/HEAD/.nuget/NuGet.exe -------------------------------------------------------------------------------- /embedd-wpf-demo/log-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "targetfile":"log.txt", 3 | "enabled":true, 4 | "minlevel":"trace" 5 | } -------------------------------------------------------------------------------- /.nuget/NuGet.Config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /embedd-wpf-demo/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /embedd-wpf-demo/App.xaml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /embedd-wpf-demo/rvm.json: -------------------------------------------------------------------------------- 1 | { 2 | "dialogSettings" : { 3 | "logo" : "http://img1.wikia.nocookie.net/__cb20100130082645/gtawiki/images/9/9a/PlayStation_1_Logo.png", 4 | "bgColor" : 4163183909, 5 | "textColor" : 4293980400, 6 | "progressBarBgColor" : 4278190080, 7 | "progressBarFillColor" : 4281513430, 8 | "progressBarBorderColor" : 4282137660 9 | } 10 | } -------------------------------------------------------------------------------- /embedd-wpf-demo/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Data; 5 | using System.Linq; 6 | using System.Windows; 7 | 8 | namespace embedd_wpf_demo 9 | { 10 | /// 11 | /// Interaction logic for App.xaml 12 | /// 13 | public partial class App : Application 14 | { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /embedd-wpf-demo/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /embedd-wpf-demo/NLog.config: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /embedd-wpf-demo/PeopleData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.IO; 6 | using System.Linq.Expressions; 7 | using Newtonsoft.Json.Linq; 8 | 9 | namespace embedd_wpf_demo 10 | { 11 | class PeopleData 12 | { 13 | public static List Get() 14 | { 15 | List people; 16 | using (StreamReader sr = new StreamReader("data.json")) 17 | { 18 | 19 | var dataStr = sr.ReadToEnd(); 20 | people = Newtonsoft.Json.JsonConvert.DeserializeObject>(dataStr); 21 | } 22 | 23 | return people; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /embedd-wpf-demo/web-content/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | fin-hypergrid JSON Standalone Demo 6 | 7 | 21 | 22 | 23 |
24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /embedd-wpf-demo/MainWindow.xaml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /embedd-wpf-demo/Person.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace embedd_wpf_demo 7 | { 8 | class Person 9 | { 10 | private const int Precision = 2; 11 | private double _income; 12 | private double _travel; 13 | 14 | public string First { get; set; } 15 | public string Last { get; set; } 16 | public int Pets { get; set; } 17 | public string BirthDate { get; set; } 18 | public string ResidenceState { get; set; } 19 | public string BirthState { get; set; } 20 | public bool Employed { get; set; } 21 | public double Income 22 | { 23 | get { return Math.Round(_income, Precision); } 24 | set { _income = value; } 25 | } 26 | public double Travel 27 | { 28 | get { return Math.Round(_travel, Precision); } 29 | set { _travel = value; } 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /embedd-wpf-demo/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace embedd_wpf_demo.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.5.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /embedd-wpf-demo.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.23107.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "embedd-wpf-demo", "embedd-wpf-demo\embedd-wpf-demo.csproj", "{41682112-AA47-4ECA-B611-56EE889F46C5}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Debug|x64 = Debug|x64 12 | Release|Any CPU = Release|Any CPU 13 | Release|x64 = Release|x64 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {41682112-AA47-4ECA-B611-56EE889F46C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {41682112-AA47-4ECA-B611-56EE889F46C5}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {41682112-AA47-4ECA-B611-56EE889F46C5}.Debug|x64.ActiveCfg = Debug|Any CPU 19 | {41682112-AA47-4ECA-B611-56EE889F46C5}.Release|Any CPU.ActiveCfg = Release|Any CPU 20 | {41682112-AA47-4ECA-B611-56EE889F46C5}.Release|Any CPU.Build.0 = Release|Any CPU 21 | {41682112-AA47-4ECA-B611-56EE889F46C5}.Release|x64.ActiveCfg = Release|Any CPU 22 | EndGlobalSection 23 | GlobalSection(SolutionProperties) = preSolution 24 | HideSolutionNode = FALSE 25 | EndGlobalSection 26 | EndGlobal 27 | -------------------------------------------------------------------------------- /embedd-wpf-demo/web-content/app.js: -------------------------------------------------------------------------------- 1 | var headers = [ 2 | { name: 'last', header: 'Last Name' }, 3 | { name: 'first', header: 'First Name' }, 4 | { name: 'pets', header: 'Pets' }, 5 | { name: 'birth date', header: 'Birth Date' }, 6 | { name: 'birth state', header: 'Birth State' }, 7 | { name: 'residence state', header: 'Residence State' }, 8 | { name: 'employed', header: 'Employed' }, 9 | { name: 'income', header: 'Income' }, 10 | { name: 'travel', header: 'Travel' } 11 | ]; 12 | 13 | var grid = new fin.Hypergrid('#json-example', { 14 | data: [], 15 | schema: headers, 16 | }); 17 | 18 | grid.addProperties({ 19 | showRowNumbers: false, 20 | noDataMessage: "", 21 | columnAutosizing: false, 22 | showFilterRow: false 23 | }); 24 | 25 | fin.desktop.main(async function () { 26 | const channelName = "user-data"; 27 | const dataChangeTopic = "data-updated"; 28 | const selectionChangeTopic = "selection-changed"; 29 | 30 | //fin.InterApplicationBus.subscribe({ uuid: "*" }, 31 | // "user-data", 32 | // function (message, uuid) { 33 | // grid.behavior.setData(message.data); 34 | // }); 35 | 36 | let channelClient = await fin.InterApplicationBus.Channel.connect(channelName); 37 | channelClient.register(dataChangeTopic, data => { 38 | console.log('data received'); 39 | grid.behavior.setData(data); 40 | }); 41 | 42 | 43 | grid.addEventListener('click', (e) => { 44 | let selectedValue = getSelectedValue() || ''; 45 | channelClient.dispatch(selectionChangeTopic, selectedValue); 46 | }); 47 | }); 48 | 49 | function getSelectedValue() { 50 | let selection = grid.getSelection(); 51 | 52 | if (selection.length !== 1) 53 | return; 54 | 55 | let columns = selection[0]; 56 | 57 | if (Object.keys(columns).length !== 1) 58 | return; 59 | 60 | let values = columns[Object.keys(columns)[0]]; 61 | 62 | if (values.length !== 1) 63 | return; 64 | 65 | return values[0]; 66 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Build Folders (you can keep bin if you'd like, to store dlls and pdbs) 2 | [Bb]in/ 3 | [Oo]bj/ 4 | 5 | # mstest test results 6 | TestResults 7 | 8 | ## Ignore Visual Studio temporary files, build results, and 9 | ## files generated by popular Visual Studio add-ons. 10 | 11 | # User-specific files 12 | *.suo 13 | *.user 14 | *.sln.docstates 15 | 16 | # Build results 17 | [Dd]ebug/ 18 | [Rr]elease/ 19 | x64/ 20 | *_i.c 21 | *_p.c 22 | *.ilk 23 | *.meta 24 | *.obj 25 | *.pch 26 | *.pdb 27 | *.pgc 28 | *.pgd 29 | *.rsp 30 | *.sbr 31 | *.tlb 32 | *.tli 33 | *.tlh 34 | *.tmp 35 | *.log 36 | *.vspscc 37 | *.vssscc 38 | .builds 39 | 40 | # Visual C++ cache files 41 | ipch/ 42 | *.aps 43 | *.ncb 44 | *.opensdf 45 | *.sdf 46 | 47 | # Visual Studio profiler 48 | *.psess 49 | *.vsp 50 | *.vspx 51 | 52 | # Guidance Automation Toolkit 53 | *.gpState 54 | 55 | # ReSharper is a .NET coding add-in 56 | _ReSharper* 57 | 58 | # NCrunch 59 | *.ncrunch* 60 | .*crunch*.local.xml 61 | 62 | # Installshield output folder 63 | [Ee]xpress 64 | 65 | # DocProject is a documentation generator add-in 66 | DocProject/buildhelp/ 67 | DocProject/Help/*.HxT 68 | DocProject/Help/*.HxC 69 | DocProject/Help/*.hhc 70 | DocProject/Help/*.hhk 71 | DocProject/Help/*.hhp 72 | DocProject/Help/Html2 73 | DocProject/Help/html 74 | 75 | # Click-Once directory 76 | publish 77 | 78 | # Publish Web Output 79 | *.Publish.xml 80 | 81 | # NuGet Packages Directory 82 | packages 83 | 84 | # Windows Azure Build Output 85 | csx 86 | *.build.csdef 87 | 88 | # Windows Store app package directory 89 | AppPackages/ 90 | 91 | # Others 92 | [Bb]in 93 | [Oo]bj 94 | sql 95 | TestResults 96 | [Tt]est[Rr]esult* 97 | *.Cache 98 | ClientBin 99 | [Ss]tyle[Cc]op.* 100 | ~$* 101 | *.dbmdl 102 | Generated_Code #added for RIA/Silverlight projects 103 | 104 | # Backup & report files from converting an old project file to a newer 105 | # Visual Studio version. Backup files are not needed, because we have git ;-) 106 | _UpgradeReport_Files/ 107 | Backup*/ 108 | UpgradeLog*.XML 109 | 110 | # ReSharper files - let's not open that can of worms just yet 111 | *.DotSettings 112 | ======= 113 | # ignore any generated packages for Chocolatey 114 | *.nupkg 115 | 116 | # OS generated files 117 | Thumbs.db 118 | 119 | .vs/ -------------------------------------------------------------------------------- /embedd-wpf-demo/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /embedd-wpf-demo/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Resources; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | using System.Windows; 6 | 7 | // General Information about an assembly is controlled through the following 8 | // set of attributes. Change these attribute values to modify the information 9 | // associated with an assembly. 10 | [assembly: AssemblyTitle("embedd-wpf-demo")] 11 | [assembly: AssemblyDescription("")] 12 | [assembly: AssemblyConfiguration("")] 13 | [assembly: AssemblyCompany("")] 14 | [assembly: AssemblyProduct("embedd-wpf-demo")] 15 | [assembly: AssemblyCopyright("Copyright © 2015")] 16 | [assembly: AssemblyTrademark("")] 17 | [assembly: AssemblyCulture("")] 18 | 19 | // Setting ComVisible to false makes the types in this assembly not visible 20 | // to COM components. If you need to access a type in this assembly from 21 | // COM, set the ComVisible attribute to true on that type. 22 | [assembly: ComVisible(false)] 23 | 24 | //In order to begin building localizable applications, set 25 | //CultureYouAreCodingWith in your .csproj file 26 | //inside a . For example, if you are using US english 27 | //in your source files, set the to en-US. Then uncomment 28 | //the NeutralResourceLanguage attribute below. Update the "en-US" in 29 | //the line below to match the UICulture setting in the project file. 30 | 31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] 32 | 33 | 34 | [assembly: ThemeInfo( 35 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 36 | //(used if a resource is not found in the page, 37 | // or application resource dictionaries) 38 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 39 | //(used if a resource is not found in the page, 40 | // app, or any theme specific resource dictionaries) 41 | )] 42 | 43 | 44 | // Version information for an assembly consists of the following four values: 45 | // 46 | // Major Version 47 | // Minor Version 48 | // Build Number 49 | // Revision 50 | // 51 | // You can specify all the values or you can default the Build and Revision Numbers 52 | // by using the '*' as shown below: 53 | // [assembly: AssemblyVersion("1.0.*")] 54 | [assembly: AssemblyVersion("1.0.0.0")] 55 | [assembly: AssemblyFileVersion("1.0.0.0")] 56 | -------------------------------------------------------------------------------- /embedd-wpf-demo/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace embedd_wpf_demo.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("embedd_wpf_demo.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /embedd-wpf-demo/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Windows; 5 | using System.Windows.Controls; 6 | using Newtonsoft.Json.Linq; 7 | using Openfin.Desktop.Messaging; 8 | using Fin = Openfin.Desktop; 9 | 10 | 11 | namespace embedd_wpf_demo 12 | { 13 | /// 14 | /// Interaction logic for MainWindow.xaml 15 | /// 16 | public partial class MainWindow : Window 17 | { 18 | const string RuntimeVersion = "19.89.57.15"; 19 | const string AppUuid = "hyper-grid-uuid"; 20 | const string AppName = "hyper-grid"; 21 | const string ChannelName = "user-data"; 22 | const string DataChangeTopic = "data-updated"; 23 | const string SelectionChangeTopic = "selection-changed"; 24 | 25 | List peopleData; 26 | 27 | Fin.Messaging.ChannelClient channelClient; 28 | 29 | public MainWindow() 30 | { 31 | InitializeComponent(); 32 | //Runtime options is how we set up the OpenFin Runtime environment 33 | peopleData = PeopleData.Get(); 34 | 35 | var runtimeOptions = new Fin.RuntimeOptions 36 | { 37 | Version = RuntimeVersion, 38 | EnableRemoteDevTools = true, 39 | RuntimeConnectTimeout = 20000 40 | }; 41 | 42 | var fin = Fin.Runtime.GetRuntimeInstance(runtimeOptions); 43 | 44 | fin.Error += (sender, e) => 45 | { 46 | Console.Write(e); 47 | }; 48 | 49 | fin.Connect(() => 50 | { 51 | // Initialize the communication channel after the runtime has connected 52 | // but before launching any applications or EmbeddedViews 53 | 54 | var channelProvider = fin.InterApplicationBus.Channel.CreateProvider(ChannelName); 55 | channelProvider.RegisterTopic(SelectionChangeTopic, OnSelectionChanged); 56 | channelProvider.ClientConnected += ChannelProvider_ClientConnected; 57 | channelProvider.OpenAsync().Wait(); 58 | }); 59 | 60 | //Initialize the grid view by passing the runtime Options and the ApplicationOptions 61 | var fileUri = new Uri(System.IO.Path.GetFullPath(@"..\..\web-content\index.html")).ToString(); 62 | OpenFinEmbeddedView.Initialize(runtimeOptions, new Fin.ApplicationOptions(AppName, AppUuid, fileUri)); 63 | 64 | //Once the grid is ready get the data and populate the list box. 65 | OpenFinEmbeddedView.Ready += (sender, e) => 66 | { 67 | //set up the data 68 | var peopleInStates = (from person in peopleData 69 | group person by person.BirthState into stateGroup 70 | select new 71 | { 72 | StateName = stateGroup.First().BirthState, 73 | People = stateGroup 74 | }) 75 | .OrderBy(p => p.StateName) 76 | .ToList(); 77 | 78 | //Any Interactions with the UI must be done in the right thread. 79 | Dispatcher.Invoke(new Action(() => 80 | { 81 | peopleInStates.ForEach(state => StatesBox.Items.Add(state.StateName)); 82 | }), null); 83 | }; 84 | } 85 | 86 | private void ChannelProvider_ClientConnected(object sender, ChannelConnectedEventArgs e) 87 | { 88 | channelClient = e.Client; 89 | 90 | // There is currently a bug that requires this task to occur on a different 91 | // thread than the connected event. Fixed in later versions. 92 | System.Threading.ThreadPool.QueueUserWorkItem(o => 93 | { 94 | channelClient?.DispatchAsync(DataChangeTopic, peopleData); 95 | }); 96 | } 97 | 98 | private bool OnSelectionChanged(string selection) 99 | { 100 | Dispatcher.Invoke(new Action(() => { SelectedValue.Text = selection; })); 101 | return true; 102 | } 103 | 104 | private void States_SelectionChanged(object sender, SelectionChangedEventArgs e) 105 | { 106 | //On State selection we will send the data to the grid. 107 | var data = (from person in peopleData 108 | where StatesBox.SelectedItems.Contains(person.BirthState) 109 | select person).ToList(); 110 | 111 | channelClient?.DispatchAsync(DataChangeTopic, data); 112 | } 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # embedding-wpf-demo 2 | This is a demo WPF application that embeds an HTML 5 application and shares data over the OpenFin Runtime Inter Application Bus. The demo leverages the OpenFin Runtime, the Openfin.WPF EmbeddedView control and [Hypergrid](https://github.com/openfin/fin-hypergrid) 3 | 4 | ![embed](screenshot.png) 5 | 6 | # Getting started with Openfin.WPF 7 | * Follow the [NuGet](https://www.nuget.org/packages/OpenFin.WPF/) install instructions. 8 | 9 | * Add this XmlNamespace attribute to the root element of the markup file where it is to be used: 10 | ```js 11 | xmlns:OpenFin="clr-namespace:Openfin.WPF;assembly=Openfin.WPF" 12 | ``` 13 | 14 | ### EmbeddedView 15 | Once installed and added to the XmlNamespace, place an EmbeddedView control in the screen and give it a name: 16 | 17 | ```html 18 | 19 | ``` 20 | 21 | ### Runtime Options 22 | The Runtime Options object specifies the OpenFin Runtime being used, options include: target runtime (alpha, beta, 32/64 bits...etc), the ability to use remote debugging or specifiying the RVM location, you can read more about options in our [Docs](https://openfin.co/developers/application-config/): 23 | ```js 24 | var runtimeOptions = new Openfin.Desktop.RuntimeOptions 25 | { 26 | Version = "alpha", 27 | EnableRemoteDevTools = true, 28 | RemoteDevToolsPort = 9090 29 | }; 30 | ``` 31 | 32 | ### Application Options 33 | The Application Options object allows you to configure the OpenFin Application being embedded, options include: name, URL, icon and window options, you can read more about options in our [Docs](https://openfin.co/developers/application-config/): 34 | ```js 35 | var appOptions = new Openfin.Desktop.ApplicationOptions("of-chart", 36 | "of-chart-uuid", "http://cdn.openfin.co/embed-web/chart.html"); 37 | ``` 38 | 39 | ### Initialize 40 | The EmbeddedView needs to be initialized with both the RuntimeOptions object and the ApplicationOptions object: 41 | ```js 42 | OpenFinEmbeddedView.Initialize(runtimeOptions, appOptions); 43 | ``` 44 | 45 | ### Ready 46 | To programmatically react to when the EmbeddedView has loaded its content, initialized and is ready to be displayed you can subscribe to the Ready event: 47 | ```js 48 | OpenFinEmbeddedView.Ready += (sender, e) => 49 | { 50 | //Any Interactions with the UI must be done in the right thread. 51 | Utils.InvokeOnUiThreadIfRequired(this, () => 52 | textBlockReady.Text = "OpenFinEmbeddedView is ready"); 53 | } 54 | ``` 55 | 56 | ### Embedding Child Windows 57 | The OpenFinEmbeddedView allows you to embed web applicatons, these have their own render process and sandbox, but it also allows you to embed child windows that can share the same render process and sandbox, adding the risk of one window crashing the other but using less resources. 58 | ```js 59 | OpenFinEmbeddedView.Ready += (sender, e) => 60 | { 61 | //We need to create our WindowOptions Object 62 | var windowOptions = new WindowOptions("jsdocs", "http://cdn.openfin.co/jsdocs/3.0.1.5/"); 63 | 64 | //Assuming we have added a second EmbeddedView called OpenFinEmbeddedViewChild we initialize it. 65 | OpenFinEmbeddedViewChild.Initialize(runtimeOptions, OpenFinEmbeddedView.OpenfinApplication, windowOptions) 66 | } 67 | ``` 68 | 69 | ### Runtime Object 70 | Every EmbeddedView control that shares a RuntimeOptions object will share a connection to the OpenFin Runtime. You can obtain this singleton object via the Runtime.GetRuntimeInstance function. It allows you to publish and subscribe to Inter Application Bus messages, react to disconnect events, and initiate connect calls (this is optional and unnecessary in the case where one or more EmbeddedView control has been initialized). 71 | ```js 72 | var openFinRuntime = Runtime.GetRuntimeInstance(runtimeOptions); 73 | openFinRuntime.Connect(() => 74 | { 75 | //Any Interactions with the UI must be done in the right thread. 76 | Utils.InvokeOnUiThreadIfRequired(this, () => 77 | textBlockConnected.Text = "OpenFin Runtime is connected"); 78 | 79 | //subscribe to hello-from-bus messages from any application 80 | openFinRuntime.InterApplicationBus.subscribe("*", "hello-from-bus", (senderUuid, topic, data) => 81 | { 82 | var dataAsJObject = JObject.FromObject(data); 83 | Utils.InvokeOnUiThreadIfRequired(this, () => 84 | textBlockMessage.Text = dataAsJObject.GetValue("message")); 85 | }); 86 | }); 87 | ``` 88 | 89 | ## License 90 | MIT 91 | 92 | The code in this repository is covered by the included license. 93 | 94 | However, if you run this code, it may call on the OpenFin RVM or OpenFin Runtime, which are covered by OpenFin’s Developer, Community, and Enterprise licenses. You can learn more about OpenFin licensing at the links listed below or just email us at support@openfin.co with questions. 95 | 96 | https://openfin.co/developer-agreement/
97 | https://openfin.co/licensing/ 98 | 99 | ## Support 100 | Please enter an issue in the repo for any questions or problems. Alternatively, please contact us at support@openfin.co 101 | -------------------------------------------------------------------------------- /embedd-wpf-demo/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /.nuget/NuGet.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $(MSBuildProjectDirectory)\..\ 5 | 6 | 7 | false 8 | 9 | 10 | false 11 | 12 | 13 | true 14 | 15 | 16 | false 17 | 18 | 19 | 20 | 21 | 22 | 26 | 27 | 28 | 29 | 30 | $([System.IO.Path]::Combine($(SolutionDir), ".nuget")) 31 | 32 | 33 | 34 | 35 | $(SolutionDir).nuget 36 | 37 | 38 | 39 | $(MSBuildProjectDirectory)\packages.$(MSBuildProjectName.Replace(' ', '_')).config 40 | $(MSBuildProjectDirectory)\packages.$(MSBuildProjectName).config 41 | 42 | 43 | 44 | $(MSBuildProjectDirectory)\packages.config 45 | $(PackagesProjectConfig) 46 | 47 | 48 | 49 | 50 | $(NuGetToolsPath)\NuGet.exe 51 | @(PackageSource) 52 | 53 | "$(NuGetExePath)" 54 | mono --runtime=v4.0.30319 "$(NuGetExePath)" 55 | 56 | $(TargetDir.Trim('\\')) 57 | 58 | -RequireConsent 59 | -NonInteractive 60 | 61 | "$(SolutionDir) " 62 | "$(SolutionDir)" 63 | 64 | 65 | $(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir $(PaddedSolutionDir) 66 | $(NuGetCommand) pack "$(ProjectPath)" -Properties "Configuration=$(Configuration);Platform=$(Platform)" $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -symbols 67 | 68 | 69 | 70 | RestorePackages; 71 | $(BuildDependsOn); 72 | 73 | 74 | 75 | 76 | $(BuildDependsOn); 77 | BuildPackage; 78 | 79 | 80 | 81 | 82 | 83 | 84 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 99 | 100 | 103 | 104 | 105 | 106 | 108 | 109 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 141 | 142 | 143 | 144 | 145 | -------------------------------------------------------------------------------- /embedd-wpf-demo/embedd-wpf-demo.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {41682112-AA47-4ECA-B611-56EE889F46C5} 8 | WinExe 9 | Properties 10 | embedd_wpf_demo 11 | embedd-wpf-demo 12 | v4.7.2 13 | 512 14 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 15 | 4 16 | ..\ 17 | true 18 | 19 | 20 | 21 | AnyCPU 22 | true 23 | full 24 | false 25 | bin\Debug\ 26 | DEBUG;TRACE 27 | prompt 28 | 4 29 | false 30 | 31 | 32 | AnyCPU 33 | pdbonly 34 | true 35 | bin\Release\ 36 | TRACE 37 | prompt 38 | 4 39 | false 40 | 41 | 42 | 43 | ..\packages\DotNetZip.1.16.0\lib\net40\DotNetZip.dll 44 | 45 | 46 | ..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll 47 | 48 | 49 | ..\packages\Openfin.Winform.17.4.0\lib\net452\Openfin.WinForm.dll 50 | 51 | 52 | ..\packages\Openfin.WPF.17.4.0\lib\net452\Openfin.WPF.dll 53 | 54 | 55 | ..\packages\OpenfinDesktop.17.4.0\lib\net452\OpenfinDesktop.dll 56 | 57 | 58 | ..\packages\SuperSocket.ClientEngine.0.10.0\lib\net45\SuperSocket.ClientEngine.dll 59 | 60 | 61 | 62 | ..\packages\System.Collections.Specialized.4.3.0\lib\net46\System.Collections.Specialized.dll 63 | 64 | 65 | 66 | 67 | 68 | ..\packages\System.IO.4.3.0\lib\net462\System.IO.dll 69 | True 70 | True 71 | 72 | 73 | ..\packages\System.IO.Compression.4.3.0\lib\net46\System.IO.Compression.dll 74 | 75 | 76 | ..\packages\System.Net.NameResolution.4.3.0\lib\net46\System.Net.NameResolution.dll 77 | 78 | 79 | ..\packages\System.Net.Security.4.3.2\lib\net46\System.Net.Security.dll 80 | 81 | 82 | ..\packages\System.Net.Sockets.4.3.0\lib\net46\System.Net.Sockets.dll 83 | 84 | 85 | ..\packages\System.Runtime.4.3.1\lib\net462\System.Runtime.dll 86 | True 87 | True 88 | 89 | 90 | 91 | ..\packages\System.Security.Cryptography.Algorithms.4.3.1\lib\net46\System.Security.Cryptography.Algorithms.dll 92 | 93 | 94 | ..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll 95 | 96 | 97 | ..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll 98 | 99 | 100 | ..\packages\System.Security.Cryptography.X509Certificates.4.3.2\lib\net46\System.Security.Cryptography.X509Certificates.dll 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 4.0 110 | 111 | 112 | 113 | ..\packages\WebSocket4Net.0.15.2\lib\net45\WebSocket4Net.dll 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | MSBuild:Compile 123 | Designer 124 | 125 | 126 | MSBuild:Compile 127 | Designer 128 | 129 | 130 | App.xaml 131 | Code 132 | 133 | 134 | MainWindow.xaml 135 | Code 136 | 137 | 138 | 139 | 140 | 141 | 142 | Code 143 | 144 | 145 | True 146 | True 147 | Resources.resx 148 | 149 | 150 | True 151 | Settings.settings 152 | True 153 | 154 | 155 | Always 156 | 157 | 158 | Always 159 | 160 | 161 | 162 | ResXFileCodeGenerator 163 | Resources.Designer.cs 164 | 165 | 166 | PreserveNewest 167 | 168 | 169 | 170 | Always 171 | 172 | 173 | 174 | SettingsSingleFileGenerator 175 | Settings.Designer.cs 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. 184 | 185 | 186 | 187 | 194 | --------------------------------------------------------------------------------