From a898decf18c4c0ed56d020dc09df55df1ca0263a Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 9 Apr 2018 18:30:58 +0300 Subject: Lots of changes :/ --- .../Html/DefaultHtmlPresenter.cs | 25 +++++++++++ .../Tango.MachineStudio.UI/Html/HtmlWindow.xaml | 37 +++++++++++++++++ .../Tango.MachineStudio.UI/Html/HtmlWindow.xaml.cs | 48 ++++++++++++++++++++++ 3 files changed, 110 insertions(+) create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Html/DefaultHtmlPresenter.cs create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Html/HtmlWindow.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Html/HtmlWindow.xaml.cs (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Html') diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Html/DefaultHtmlPresenter.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Html/DefaultHtmlPresenter.cs new file mode 100644 index 000000000..eff8c98a0 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Html/DefaultHtmlPresenter.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using Tango.BL.Entities; +using Tango.MachineStudio.Common.Html; +using Tango.MachineStudio.UI.Windows; + +namespace Tango.MachineStudio.UI.Html +{ + public class DefaultHtmlPresenter : IHtmlPresenter + { + public bool DisplayHtml(HtmlPage html) + { + HtmlWindow dialog = new HtmlWindow(html); + dialog.Owner = Application.Current.MainWindow; + MainWindow.Instance.shadowGrid.Visibility = Visibility.Visible; + var result = dialog.ShowDialog(); + MainWindow.Instance.shadowGrid.Visibility = Visibility.Hidden; + return result.Value; + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Html/HtmlWindow.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Html/HtmlWindow.xaml new file mode 100644 index 000000000..654d2d0eb --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Html/HtmlWindow.xaml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Html/HtmlWindow.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Html/HtmlWindow.xaml.cs new file mode 100644 index 000000000..9f37eba06 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Html/HtmlWindow.xaml.cs @@ -0,0 +1,48 @@ +using MahApps.Metro.Controls; +using MaterialDesignThemes.Wpf; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; +using Tango.BL.Entities; +using Tango.Core.Commands; + +namespace Tango.MachineStudio.UI.Html +{ + /// + /// Interaction logic for DialogWindow.xaml + /// + public partial class HtmlWindow : Window + { + public HtmlWindow(HtmlPage html) + { + InitializeComponent(); + + webBrowser.Loaded += (_, __) => + { + webBrowser.NavigateToString(html.Html); + }; + } + + private void OKClicked(object sender, RoutedEventArgs e) + { + DialogResult = true; + Close(); + } + + private void CloseClicked(object sender, RoutedEventArgs e) + { + DialogResult = false; + Close(); + } + } +} -- cgit v1.3.1