diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-11-21 16:24:37 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-11-21 16:24:37 +0200 |
| commit | a9c3aaed4d5c007f138bfc16f05aecdee73f1268 (patch) | |
| tree | bc41f31dec6a0f96e4c6e16372f8884053c7c17f /Software/Visual_Studio/PPC/Tango.PPC.UI | |
| parent | 9ee373ebf7518c96fdf685da792568680dd7f135 (diff) | |
| download | Tango-a9c3aaed4d5c007f138bfc16f05aecdee73f1268.tar.gz Tango-a9c3aaed4d5c007f138bfc16f05aecdee73f1268.zip | |
Working on PPC Storage Provider !!!
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI')
9 files changed, 227 insertions, 7 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/flash-drive.png b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/flash-drive.png Binary files differnew file mode 100644 index 000000000..252e42e38 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/flash-drive.png diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj index 5e5d5aac2..466ff0587 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj @@ -135,6 +135,7 @@ <Compile Include="ViewModels\MachineSetupViewVM.cs" /> <Compile Include="ViewModels\MainViewVM.cs" /> <Compile Include="ViewModels\MachineUpdateViewVM.cs" /> + <Compile Include="ViewModels\StorageViewVM.cs" /> <Compile Include="ViewsContracts\ILayoutView.cs" /> <Compile Include="ViewsContracts\IMachineSetupView.cs" /> <Compile Include="ViewsContracts\IMachineUpdateView.cs" /> @@ -159,6 +160,9 @@ <Compile Include="Views\MachineUpdateView.xaml.cs"> <DependentUpon>MachineUpdateView.xaml</DependentUpon> </Compile> + <Compile Include="Views\StorageView.xaml.cs"> + <DependentUpon>StorageView.xaml</DependentUpon> + </Compile> <Page Include="Connectivity\WiFiAuthenticationView.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> @@ -215,6 +219,10 @@ <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> + <Page Include="Views\StorageView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> </ItemGroup> <ItemGroup> <Compile Include="Properties\AssemblyInfo.cs"> @@ -263,6 +271,10 @@ <Project>{b112d89a-a106-41ae-a0c1-4abc84c477f5}</Project> <Name>Tango.DragAndDrop</Name> </ProjectReference> + <ProjectReference Include="..\..\Tango.Explorer\Tango.Explorer.csproj"> + <Project>{4399af76-db52-4cfb-8020-6f85bdb29fd5}</Project> + <Name>Tango.Explorer</Name> + </ProjectReference> <ProjectReference Include="..\..\Tango.Integration\Tango.Integration.csproj"> <Project>{4206ac58-3b57-4699-8835-90bf6db01a61}</Project> <Name>Tango.Integration</Name> @@ -365,6 +377,7 @@ <Link>Tango.ColorLib.dll</Link> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </Content> + <Resource Include="Images\flash-drive.png" /> <Resource Include="Images\right-arrow-64.png" /> <Resource Include="Images\machine-update.png" /> <Resource Include="Images\home.png" /> @@ -432,7 +445,7 @@ copy /Y "$(SolutionDir)Referenced Assemblies\vcruntime140d.dll" "$(TargetDir)"</ </PropertyGroup> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> + <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs index 57fae7791..47f4409f5 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs @@ -16,6 +16,7 @@ using Tango.PPC.Common.Modules; using Tango.PPC.Common.Navigation; using Tango.PPC.Common.Notifications; using Tango.PPC.Common.Printing; +using Tango.PPC.Common.Storage; using Tango.PPC.Common.Threading; using Tango.PPC.UI.Authentication; using Tango.PPC.UI.Connectivity; @@ -59,6 +60,7 @@ namespace Tango.PPC.UI TangoIOC.Default.Unregister<IMachineUpdateManager>(); TangoIOC.Default.Unregister<IPrintingManager>(); TangoIOC.Default.Unregister<IConnectivityProvider>(); + TangoIOC.Default.Unregister<IStorageProvider>(); TangoIOC.Default.Register<IDispatcherProvider, DefaultDispatcherProvider>(new DefaultDispatcherProvider(Application.Current.Dispatcher)); TangoIOC.Default.Register<INotificationProvider, DefaultNotificationProvider>(); @@ -75,6 +77,7 @@ namespace Tango.PPC.UI TangoIOC.Default.Register<IMachineUpdateManager, MachineUpdateManager>(); TangoIOC.Default.Register<IPrintingManager, DefaultPrintingManager>(); TangoIOC.Default.Register<IConnectivityProvider, DefaultConnectivityProvider>(); + TangoIOC.Default.Register<IStorageProvider, DefaultStorageProvider>(); //TangoIOC.Default.Register<TeamFoundationServiceExtendedClient>(new TeamFoundationServiceExtendedClient("https://twinetfs.visualstudio.com", String.Empty, "szzfokrceo4rhd4eqi5qpmxn3pa5iwl3q7tlqd36l2m7smz2ynoa")); @@ -85,6 +88,7 @@ namespace Tango.PPC.UI TangoIOC.Default.Register<ExternalBridgeViewVM>(); TangoIOC.Default.Register<MachineSetupViewVM>(); TangoIOC.Default.Register<MachineUpdateViewVM>(); + TangoIOC.Default.Register<StorageViewVM>(); TangoIOC.Default.GetInstance<IPPCApplicationManager>().ContentRendered += (_, __) => @@ -158,5 +162,13 @@ namespace Tango.PPC.UI return TangoIOC.Default.GetInstance<MachineUpdateViewVM>(); } } + + public static StorageViewVM StorageViewVM + { + get + { + return TangoIOC.Default.GetInstance<StorageViewVM>(); + } + } } }
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs index 7ac7db47d..76eda9ac0 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs @@ -89,6 +89,11 @@ namespace Tango.PPC.UI.ViewModels /// Gets or sets the update command. /// </summary> public RelayCommand UpdateCommand { get; set; } + + /// <summary> + /// Gets or sets the storage command. + /// </summary> + public RelayCommand StorageCommand { get; set; } #endregion #region Constructors @@ -109,6 +114,13 @@ namespace Tango.PPC.UI.ViewModels { NavigationManager.NavigateTo(NavigationView.MachineUpdateView); TangoIOC.Default.GetInstance<MachineUpdateViewVM>().CheckForUpdates(); + IsMenuOpened = false; + }); + + StorageCommand = new RelayCommand(() => + { + NavigationManager.NavigateTo(NavigationView.StorageView); + IsMenuOpened = false; }); } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/StorageViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/StorageViewVM.cs new file mode 100644 index 000000000..5b5167393 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/StorageViewVM.cs @@ -0,0 +1,97 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.Commands; +using Tango.Explorer; +using Tango.PPC.Common; + +namespace Tango.PPC.UI.ViewModels +{ + public class StorageViewVM : PPCViewModel + { + private String _currentPath; + public String CurrentPath + { + get { return _currentPath; } + set { _currentPath = value; RaisePropertyChangedAuto(); } + } + + public RelayCommand CloseCommand { get; set; } + + public RelayCommand<ExplorerFileItem> FileSelectedCommand { get; set; } + + public StorageViewVM() + { + CloseCommand = new RelayCommand(Close); + FileSelectedCommand = new RelayCommand<ExplorerFileItem>(OnFileSelected); + } + + public override void OnApplicationStarted() + { + + } + + public override void OnApplicationReady() + { + base.OnApplicationReady(); + + StorageProvider.StorageConnected += StorageProvider_StorageConnected; + StorageProvider.StorageDisconnected += StorageProvider_StorageDisconnected; + } + + public override void OnNavigatedTo() + { + base.OnNavigatedTo(); + + if (StorageProvider.Drive != null) + { + CurrentPath = StorageProvider.Drive.RootDirectory.FullName; + } + } + + private async void Close() + { + await NavigationManager.NavigateTo(Common.Navigation.NavigationView.LayoutView); + } + + /// <summary> + /// Handles the storage connected event. + /// </summary> + /// <param name="sender">The sender.</param> + /// <param name="e">The drive info.</param> + private void StorageProvider_StorageConnected(object sender, System.IO.DriveInfo e) + { + InvokeUI(async () => + { + if (await NotificationProvider.ShowQuestion("Disk Inserted. Do you want to browse?")) + { + await NavigationManager.NavigateTo(Common.Navigation.NavigationView.StorageView); + } + }); + } + + /// <summary> + /// Handles the storage disconnected event. + /// </summary> + /// <param name="sender">The sender.</param> + /// <param name="e">The drive info.</param> + private void StorageProvider_StorageDisconnected(object sender, System.IO.DriveInfo e) + { + InvokeUI(async () => + { + if (IsVisible) + { + await NavigationManager.NavigateTo(Common.Navigation.NavigationView.LayoutView); + } + }); + } + + private async void OnFileSelected(ExplorerFileItem fileItem) + { + await NavigationManager.NavigateTo(Common.Navigation.NavigationView.LayoutView); + await NotificationProvider.ShowInfo($"File Selected: {fileItem.Name}"); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml index 2db5f12b6..44a66d7f0 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml @@ -62,12 +62,24 @@ </ItemsControl> <StackPanel Margin="0 5 0 0"> - <touch:TouchButton Style="{StaticResource TangoFlatButton}" Padding="30" Foreground="{StaticResource TangoDarkForegroundBrush}" Command="{Binding UpdateCommand}" FontSize="{StaticResource TangoHeaderFontSize}"> - <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"> - <Image Source="/Images/right-arrow-64.png" VerticalAlignment="Center" Width="48" Height="48"></Image> - <TextBlock VerticalAlignment="Center" Margin="20 0 0 0">Update</TextBlock> - </StackPanel> - </touch:TouchButton> + + <Border BorderBrush="{StaticResource TangoDividerBrush}" BorderThickness="0 1 0 0" Visibility="{Binding StorageProvider.IsConnected,Converter={StaticResource BooleanToVisibilityConverter}}"> + <touch:TouchButton Style="{StaticResource TangoFlatButton}" Padding="30" Foreground="{StaticResource TangoDarkForegroundBrush}" Command="{Binding StorageCommand}" FontSize="{StaticResource TangoHeaderFontSize}"> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"> + <Image Source="/Images/flash-drive.png" VerticalAlignment="Center" Width="48" Height="48"></Image> + <TextBlock VerticalAlignment="Center" Margin="20 0 0 0">Storage</TextBlock> + </StackPanel> + </touch:TouchButton> + </Border> + + <Border BorderBrush="{StaticResource TangoDividerBrush}" BorderThickness="0 1 0 0"> + <touch:TouchButton Style="{StaticResource TangoFlatButton}" Padding="30" Foreground="{StaticResource TangoDarkForegroundBrush}" Command="{Binding UpdateCommand}" FontSize="{StaticResource TangoHeaderFontSize}"> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"> + <Image Source="/Images/right-arrow-64.png" VerticalAlignment="Center" Width="48" Height="48"></Image> + <TextBlock VerticalAlignment="Center" Margin="20 0 0 0">Update</TextBlock> + </StackPanel> + </touch:TouchButton> + </Border> </StackPanel> </StackPanel> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml index 4c3d38811..690022e64 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml @@ -57,6 +57,18 @@ </Style> </touch:TouchIcon.Style> </touch:TouchIcon> + <touch:TouchIcon Width="20" Height="20" VerticalAlignment="Center" Margin="10 0 0 0" Icon="HddSolid"> + <touch:TouchIcon.Style> + <Style TargetType="touch:TouchIcon" BasedOn="{StaticResource {x:Type touch:TouchIcon}}"> + <Setter Property="Foreground" Value="{StaticResource TangoGrayBrush}"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding StorageProvider.IsConnected}" Value="True"> + <Setter Property="Foreground" Value="{StaticResource TangoSuccessBrush}"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </touch:TouchIcon.Style> + </touch:TouchIcon> <Grid></Grid> </DockPanel> </Border> @@ -69,6 +81,7 @@ <local:ExternalBridgeView></local:ExternalBridgeView> <local:MachineSetupView></local:MachineSetupView> <local:MachineUpdateView></local:MachineUpdateView> + <local:StorageView></local:StorageView> </controls:NavigationControl> </touch:TouchPanel> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/StorageView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/StorageView.xaml new file mode 100644 index 000000000..aa7bdcf7d --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/StorageView.xaml @@ -0,0 +1,33 @@ +<UserControl x:Class="Tango.PPC.UI.Views.StorageView" + 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.PPC.UI" + xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:vm="clr-namespace:Tango.PPC.UI.ViewModels" + xmlns:local="clr-namespace:Tango.PPC.UI.Views" + xmlns:explorer="clr-namespace:Tango.Explorer;assembly=Tango.Explorer" + mc:Ignorable="d" + d:DesignHeight="1280" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:StorageViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.StorageViewVM}" Background="{StaticResource TangoPrimaryBackgroundBrush}"> + <DockPanel> + + <Border DockPanel.Dock="Top" Background="{StaticResource TangoMidBackgroundBrush}" BorderBrush="{StaticResource TangoDividerBrush}" BorderThickness="0 0 0 1"> + <Border.Effect> + <DropShadowEffect BlurRadius="15" Color="{StaticResource TangoDropShadowColor}" /> + </Border.Effect> + <DockPanel Margin="10" Height="80" LastChildFill="False"> + <touch:TouchIconButton Style="{StaticResource TangoRoundTouchIconButton}" Padding="20" Margin="5" Icon="ArrowLeftBold" Command="{Binding ElementName=explorer,Path=BackCommand}"> + + </touch:TouchIconButton> + + <touch:TouchIconButton Icon="Close" Style="{StaticResource TangoRoundTouchIconButton}" Padding="20" Margin="5" DockPanel.Dock="Right" Command="{Binding CloseCommand}"></touch:TouchIconButton> + </DockPanel> + </Border> + + <Grid Margin="10"> + <explorer:ExplorerControl x:Name="explorer" CurrentPath="{Binding CurrentPath,Mode=TwoWay}" FileSelectedCommand="{Binding FileSelectedCommand}" /> + </Grid> + + </DockPanel> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/StorageView.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/StorageView.xaml.cs new file mode 100644 index 000000000..d558d08bf --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/StorageView.xaml.cs @@ -0,0 +1,28 @@ +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.Navigation; +using System.Windows.Shapes; + +namespace Tango.PPC.UI.Views +{ + /// <summary> + /// Interaction logic for StorageView.xaml + /// </summary> + public partial class StorageView : UserControl + { + public StorageView() + { + InitializeComponent(); + } + } +} |
