I need to create a Web-based Dashboard tool for a LOB application. Essentially users need to be able to log in to a web-site which will allow them to view stats for various bits of data, as well as see any notifications that pertain to them. Our primary application is built for the desktop using WPF. We also need to provide an identical dashboard that will be hosted in our WPF app. The main difference being that in the WPF version they will have buttons that will open up other parts of the application to make changes to the data, or perform whatever actions are necessary.
The main issue is that management only wants to write 1 version that can be used both on the web and in the WPF shell. They don't want to write to different version of the UI. So the solution would be to write the dashboard for the web, but host it inside our desktop application for local users, and in the browser for remote users.
So here's my questions:
I realize this idea is probably bad so don't flame me for it. I'm simply trying to supply management with the right approach. All suggestions are welcome.
Thanks!
To package content for navigation, WPF provides the Page class. You can navigate from one Page to another declaratively, by using a Hyperlink, or programmatically, by using the NavigationService. WPF uses the journal to remember pages that have been navigated from and to navigate back to them.
All replies. WPF only runs on windows. You can make a type of wpf application called xbap which runs in a browser.
Step 1: Create an empty WPF using Visual Studio, enter the name for the application and click on OK. Step 2: Create a button using the following code or drag and drop a button from the ToolBox of Visual Studio 2013.
NavigationService is for browser navigation within WPF. What you are trying to do is change to a different window TrainingFrm . To go to a different window, you should do this: private void conditioningBtn_Click(object sender, RoutedEventArgs e) { var newForm = new TrainingFrm(); //create your new form.
You can host a web page in a WPF application using the WebBrowser controls that was added in .NET 3.5 SP1:
<Grid> <WebBrowser Name="browser" /> </Grid>
And in the code-behind you have to set the Uri to your page and an object (which should be com-visible) that is to be called from the java script:
public partial class Window1 : Window { public Window1() { InitializeComponent(); string uri = AppDomain.CurrentDomain.BaseDirectory + "TestPage.html"; this.browser.Navigate(new Uri(uri, UriKind.Absolute)); this.browser.ObjectForScripting = new ScriptingHelper(); } [ComVisible(true)] public class ScriptingHelper { public void ShowMessage(string message) { MessageBox.Show(message); } } }
And finally in your page you must call the code using window.external like below:
<head> <title></title> <script type="text/javascript"> function OnClick() { var message = "Hello!"; window.external.ShowMessage(message); } </script> </head> <body> <a href="#" onclick="OnClick()">Click me</a> </body>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With