diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-04-09 18:30:58 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-04-09 18:30:58 +0300 |
| commit | a898decf18c4c0ed56d020dc09df55df1ca0263a (patch) | |
| tree | 66140670047d9ec9d7a0bbeb2851a84868b9515c /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Html | |
| parent | 4cd266e13bdb3e27ca77eba3b47278b57a0dcd8d (diff) | |
| download | Tango-a898decf18c4c0ed56d020dc09df55df1ca0263a.tar.gz Tango-a898decf18c4c0ed56d020dc09df55df1ca0263a.zip | |
Lots of changes :/
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Html')
3 files changed, 110 insertions, 0 deletions
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 @@ +<Window x:Class="Tango.MachineStudio.UI.Html.HtmlWindow" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:local="clr-namespace:Tango.MachineStudio.UI.Windows" + mc:Ignorable="d" + Title="Machine Studio" Height="500" Width="800" WindowStyle="None" ResizeMode="NoResize" WindowStartupLocation="CenterOwner" Background="Transparent"> + <Grid> + <Grid> + <Border Background="White" Padding="10" BorderThickness="1" BorderBrush="{StaticResource AccentColorBrush}"> + <Border.Effect> + <DropShadowEffect ShadowDepth="0" BlurRadius="10"></DropShadowEffect> + </Border.Effect> + + <Grid> + <DockPanel Margin="10"> + <Grid DockPanel.Dock="Bottom"> + <Button Margin="10 10 0 0" Width="140" HorizontalAlignment="Right" Click="OKClicked">OK</Button> + </Grid> + <WebBrowser x:Name="webBrowser" + OverridesDefaultStyle="False" + ScrollViewer.CanContentScroll="False" + ScrollViewer.HorizontalScrollBarVisibility="Hidden" + ScrollViewer.VerticalScrollBarVisibility="Hidden"></WebBrowser> + </DockPanel> + + <Button Click="CloseClicked" HorizontalAlignment="Right" VerticalAlignment="Top" Width="20" Height="20" Margin="0 -6 -4 0" Padding="0" Style="{StaticResource MaterialDesignFlatButton}" Foreground="Black"> + <materialDesign:PackIcon Kind="Close" Width="16" Height="16"></materialDesign:PackIcon> + </Button> + </Grid> + </Border> + </Grid> + </Grid> +</Window> 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 +{ + /// <summary> + /// Interaction logic for DialogWindow.xaml + /// </summary> + 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(); + } + } +} |
