aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Touch/Controls/TouchContentControl.cs
blob: c3086e74321422642a4d09a2ffdf66efcfb84171 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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.Media;

namespace Tango.Touch.Controls
{
    public class TouchContentControl : ContentControl
    {
        public CornerRadius CornerRadius
        {
            get { return (CornerRadius)GetValue(CornerRadiusProperty); }
            set { SetValue(CornerRadiusProperty, value); }
        }
        public static readonly DependencyProperty CornerRadiusProperty =
            DependencyProperty.Register("CornerRadius", typeof(CornerRadius), typeof(TouchContentControl), new PropertyMetadata(default(CornerRadius)));
    }
}
t .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
<UserControl x:Class="Tango.FSE.PPCConsole.Views.RemoteDesktopView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:global="clr-namespace:Tango.FSE.PPCConsole"
             xmlns:vm="clr-namespace:Tango.FSE.PPCConsole.ViewModels"
             xmlns:local="clr-namespace:Tango.FSE.PPCConsole.Views"
             xmlns:auth="clr-namespace:Tango.FSE.Common.Authorization;assembly=Tango.FSE.Common"
             xmlns:controls="clr-namespace:Tango.FSE.Common.Controls;assembly=Tango.FSE.Common"
             xmlns:material="http://materialdesigninxaml.net/winfx/xaml/themes"
             xmlns:win="clr-namespace:Tango.FSE.Common.WindowsManager;assembly=Tango.FSE.Common"
             xmlns:localControls="clr-namespace:Tango.FSE.PPCConsole.Controls"
             mc:Ignorable="d" 
             d:DesignHeight="720" d:DesignWidth="1280" d:DataContext="{d:DesignInstance Type=vm:RemoteDesktopViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.RemoteDesktopViewVM}" Foreground="{StaticResource FSE_PrimaryForegroundBrush}" Focusable="False">
    <Grid>
        <DockPanel IsEnabled="{Binding IsFree}">
            <Grid DockPanel.Dock="Right" IsEnabled="{Binding MachineProvider.IsPPCAvailable}">
                <Border>
                    <localControls:RemoteDesktopControl 
                        x:Name="remoteDesktopControl"
                        win:WindowsManagerHelper.MinWidth="400"
                        win:WindowsManagerHelper.MinHeight="640"
                        win:WindowsManagerHelper.StartWidth="400"
                        win:WindowsManagerHelper.StartHeight="640"
                        win:WindowsManagerHelper.LockAspectRatio="True"
                        win:WindowsManagerHelper.WindowTitle="{Binding MachineProvider.Machine.SerialNumber}"
                        win:WindowsManagerHelper.DisableMaximize="True"
                        win:WindowsManagerHelper.PreservePlaceHolder="True"
                        win:WindowsManagerHelper.DisableResolutionServiceInjection="True"/>
                </Border>
            </Grid>

            <Grid>
                <DockPanel>
                    <DockPanel.Style>
                        <Style TargetType="DockPanel">
                            <Setter Property="Margin" Value="0 100 100 50"></Setter>
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding ResolutionService.IsLowResolution}" Value="True">
                                    <Setter Property="Margin" Value="0 20 100 0"></Setter>
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </DockPanel.Style>
                    <StackPanel DockPanel.Dock="Top">
                        <DockPanel>
                            <TextBlock VerticalAlignment="Center" FontStyle="Italic" FontSize="{StaticResource FSE_ModuleHeaderFontSize}">REMOTE DESKTOP</TextBlock>
                            <Viewbox Stretch="Uniform" HorizontalAlignment="Right" Margin="0 0 100 0">
                                <Viewbox.Style>
                                    <Style TargetType="Viewbox">
                                        <Setter Property="Width" Value="100"></Setter>
                                        <Style.Triggers>
                                            <DataTrigger Binding="{Binding ResolutionService.IsLowResolution}" Value="True">
                                                <Setter Property="Width" Value="50"></Setter>
                                            </DataTrigger>
                                        </Style.Triggers>
                                    </Style>
                                </Viewbox.Style>
                                <Grid Width="100" Height="100">
                                    <Image Source="{StaticResource  FSE_Machine_Full}" VerticalAlignment="Top" HorizontalAlignment="Right" RenderOptions.BitmapScalingMode="Fant" Width="90" Stretch="Uniform" />
                                    <Image Source="../Images/desktop.png" Stretch="Uniform" Width="60" HorizontalAlignment="Left" VerticalAlignment="Bottom" />
                                </Grid>
                            </Viewbox>
                        </DockPanel>
                        <Rectangle StrokeThickness="1" Stroke="{StaticResource FSE_BorderBrush}" Height="1" StrokeDashArray="4" Margin="0 20 0 0" />
                    </StackPanel>
                    <Grid>
                        <DockPanel Margin="0 20 0 0">
                            <StackPanel DockPanel.Dock="Top">
                                <TextBlock TextWrapping="Wrap">
                                    <Run>Remote desktop allows you to view and control the currently connected machine tablet PC screen.</Run>
                                    <LineBreak/>
                                    <Run>Press 'start' to start a remote desktop session.</Run>
                                </TextBlock>
                            </StackPanel>
                            <Grid DockPanel.Dock="Bottom">

                                <Grid HorizontalAlignment="Left">
                                    <Grid.Style>
                                        <Style TargetType="Grid">
                                            <Setter Property="Margin" Value="0 0 0 0"></Setter>
                                            <Setter Property="VerticalAlignment" Value="Bottom"></Setter>
                                            <Style.Triggers>
                                                <DataTrigger Binding="{Binding ResolutionService.IsLowResolution}" Value="True">
                                                    <Setter Property="VerticalAlignment" Value="Top"></Setter>
                                                    <Setter Property="Margin" Value="0 -40 0 0"></Setter>
                                                </DataTrigger>
                                            </Style.Triggers>
                                        </Style>
                                    </Grid.Style>

                                    <StackPanel Orientation="Horizontal">
                                        <material:PackIcon>
                                            <material:PackIcon.Style>
                                                <Style TargetType="material:PackIcon">
                                                    <Setter Property="Foreground" Value="{StaticResource FSE_PrimaryBackgroundLighterBrush}"></Setter>
                                                    <Setter Property="Kind" Value="Circle"></Setter>
                                                    <Style.Triggers>
                                                        <DataTrigger Binding="{Binding RemoteDesktopProvider.InSession}" Value="True">
                                                            <Setter Property="Foreground" Value="{StaticResource FSE_SuccessBrush}"></Setter>
                                                        </DataTrigger>
                                                        <DataTrigger Binding="{Binding RemoteDesktopProvider.IsWebRtcActive}" Value="True">
                                                            <Setter Property="Kind" Value="LightningBoltCircle"></Setter>
                                                        </DataTrigger>
                                                    </Style.Triggers>
                                                </Style>
                                            </material:PackIcon.Style>
                                        </material:PackIcon>
                                        <TextBlock Margin="10 0 0 0">
                                            <TextBlock.Style>
                                                <Style TargetType="TextBlock">
                                                    <Setter Property="Text" Value="Remote desktop disabled. No active machine connection."></Setter>
                                                    <Setter Property="Foreground" Value="{StaticResource FSE_BorderBrush}"></Setter>
                                                    <Style.Triggers>
                                                        <DataTrigger Binding="{Binding MachineProvider.IsConnected}" Value="False">
                                                            <Setter Property="Text" Value="Remote desktop disabled. No active machine connection."></Setter>
                                                        </DataTrigger>
                                                        <DataTrigger Binding="{Binding MachineProvider.IsConnected}" Value="True">
                                                            <Setter Property="Text" Value="Remote desktop session is ready to start."></Setter>
                                                        </DataTrigger>
                                                        <DataTrigger Binding="{Binding RemoteDesktopProvider.InSession}" Value="True">
                                                            <Setter Property="Text" Value="Remote desktop session is active."></Setter>
                                                            <Setter Property="Foreground" Value="{StaticResource FSE_PrimaryForegroundBrush}"></Setter>
                                                        </DataTrigger>
                                                        <DataTrigger Binding="{Binding RemoteDesktopProvider.IsWebRtcActive}" Value="True">
                                                            <Setter Property="Text" Value="Remote desktop session is active using a P2P communication channel."></Setter>
                                                        </DataTrigger>
                                                    </Style.Triggers>
                                                </Style>
                                            </TextBlock.Style>
                                        </TextBlock>
                                    </StackPanel>
                                </Grid>

                                <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Height="50">
                                    <controls:TextIconButton material:ButtonAssist.CornerRadius="25" Icon="Stop" Padding="0 12" Width="200" Command="{Binding StopCommand}" IsEnabled="{Binding RemoteDesktopProvider.InSession}" Grid.Column="1" Style="{StaticResource FSE_TextIconButton_Dark}">STOP</controls:TextIconButton>
                                    <controls:TextIconButton material:ButtonAssist.CornerRadius="25" Icon="Play" Padding="0 12" Width="200" Command="{Binding StartCommand}" IsEnabled="{Binding RemoteDesktopProvider.CanStartSession}" Grid.Column="2" Margin="10 0 0 0" Height="Auto">START</controls:TextIconButton>
                                </StackPanel>
                            </Grid>
                            <Grid>
                                <StackPanel Margin="0 40 0 0">
                                    <TextBlock FontStyle="Italic" Foreground="{StaticResource FSE_PrimaryAccentBrush}" FontSize="{StaticResource FSE_LargeFontSize}">Actions</TextBlock>

                                    <UniformGrid Margin="0 10 0 0" HorizontalAlignment="Left">
                                        <UniformGrid.Style>
                                            <Style TargetType="UniformGrid">
                                                <Setter Property="Rows" Value="3"></Setter>
                                                <Setter Property="Columns" Value="1"></Setter>
                                                <Style.Triggers>
                                                    <DataTrigger Binding="{Binding ResolutionService.IsLowResolution}" Value="True">
                                                        <Setter Property="Columns" Value="2"></Setter>
                                                    </DataTrigger>
                                                </Style.Triggers>
                                            </Style>
                                        </UniformGrid.Style>
                                        <Button auth:AuthorizationHelper.Mode="Collapsed" auth:AuthorizationHelper.Permission="FSE_RemoteDesktopControl" IsEnabled="{Binding RemoteDesktopProvider.InSession}" Width="250" Margin="5" Style="{StaticResource FSE_Button_Polygon}" Content="Hide PPC and Open Shell" Command="{Binding HideAndOpenShellCommand}" />

                                        <Button auth:AuthorizationHelper.Mode="Collapsed" auth:AuthorizationHelper.Permission="FSE_RemoteDesktopControl" IsEnabled="{Binding RemoteDesktopProvider.InSession}" Width="250" Margin="5" Style="{StaticResource FSE_Button_Polygon}" Content="Restart application"/>

                                        <Button auth:AuthorizationHelper.Mode="Collapsed" auth:AuthorizationHelper.Permission="FSE_RemoteDesktopControl" IsEnabled="{Binding RemoteDesktopProvider.InSession}" Width="250" Margin="5" Style="{StaticResource FSE_Button_Polygon}" Content="Open Task Manager" Command="{Binding OpenTaskManagerCommand}" />

                                        <CheckBox Margin="5" HorizontalAlignment="Center" IsEnabled="{Binding RemoteDesktopProvider.InSession,Converter={StaticResource BooleanInverseConverter}}" IsChecked="{Binding RemoteDesktopProvider.EnableWebRtc}">Enable P2P communication channel</CheckBox>
                                    </UniformGrid>
                                </StackPanel>
                            </Grid>
                        </DockPanel>
                    </Grid>
                </DockPanel>
            </Grid>
        </DockPanel>
    </Grid>
</UserControl>