diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2018-11-25 10:44:37 +0200 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2018-11-25 10:44:37 +0200 |
| commit | beff6af103bb0ae9b9147a907c6567bdb33abd00 (patch) | |
| tree | 375eefd654c25f3b68c0cf5b3612df844a140d8e /Software/Visual_Studio/PPC/Tango.PPC.UI | |
| parent | 57f20269fbb4c591aa73c9f5e50118310cc4892e (diff) | |
| parent | dff24e56a8906b8c9b355cf407f25f4b793beafe (diff) | |
| download | Tango-beff6af103bb0ae9b9147a907c6567bdb33abd00.tar.gz Tango-beff6af103bb0ae9b9147a907c6567bdb33abd00.zip | |
merge
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI')
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.UI/App.config | 13 | ||||
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.UI/Connectivity/DefaultConnectivityProvider.cs | 6 | ||||
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/ItemBaseConverter.cs (renamed from Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/NotificationItemConverter.cs) | 4 | ||||
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.UI/Images/flash-drive.png | bin | 0 -> 1377 bytes | |||
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs | 36 | ||||
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj | 11 | ||||
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs | 3 | ||||
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs | 13 | ||||
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs | 35 | ||||
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml | 17 | ||||
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml | 40 |
11 files changed, 153 insertions, 25 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/App.config b/Software/Visual_Studio/PPC/Tango.PPC.UI/App.config index a083762dc..b2738c8cf 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/App.config +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/App.config @@ -9,18 +9,7 @@ </startup> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> - <dependentAssembly> - <assemblyIdentity name="System.Reactive.Core" publicKeyToken="94bc3704cddfc263" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-3.0.3000.0" newVersion="3.0.3000.0" /> - </dependentAssembly> - <dependentAssembly> - <assemblyIdentity name="Microsoft.IdentityModel.Clients.ActiveDirectory" publicKeyToken="31bf3856ad364e35" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-3.19.8.16603" newVersion="3.19.8.16603" /> - </dependentAssembly> - <dependentAssembly> - <assemblyIdentity name="Microsoft.IdentityModel.Clients.ActiveDirectory.Platform" publicKeyToken="31bf3856ad364e35" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-3.19.8.16603" newVersion="3.19.8.16603" /> - </dependentAssembly> + </assemblyBinding> </runtime> <entityFramework> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Connectivity/DefaultConnectivityProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Connectivity/DefaultConnectivityProvider.cs index e990b50a1..a3420fb01 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Connectivity/DefaultConnectivityProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Connectivity/DefaultConnectivityProvider.cs @@ -115,7 +115,11 @@ namespace Tango.PPC.UI.Connectivity await RefreshAvailableWiFiNetworks(); var settings = SettingsManager.Default.GetOrCreate<PPCSettings>(); - var auto_connect_network = AvailableWiFiNetworks.ToList().FirstOrDefault(x => x.Name == settings.AutoConnectWiFiName); + var networks = AvailableWiFiNetworks.ToList(); + + var auto_connect_network = networks.FirstOrDefault(x => x.Name == settings.AutoConnectWiFiName); + + IsConnected = networks.Exists(x => x.IsConnected); if (auto_connect_network != null && !auto_connect_network.IsConnected) { diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/NotificationItemConverter.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/ItemBaseConverter.cs index 4e3291b97..cddfea894 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/NotificationItemConverter.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/ItemBaseConverter.cs @@ -11,11 +11,11 @@ using Tango.PPC.Common.Notifications; namespace Tango.PPC.UI.Converters { - public class NotificationItemConverter : IValueConverter + public class ItemBaseConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { - NotificationItem item = value as NotificationItem; + ItemBase item = value as ItemBase; if (item != null) { 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/Notifications/DefaultNotificationProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs index f03d9accd..f68d57805 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs @@ -36,11 +36,17 @@ namespace Tango.PPC.UI.Notifications public ObservableCollection<NotificationItem> NotificationItems { get; private set; } /// <summary> + /// Gets the collection of taskbar items. + /// </summary> + public ObservableCollection<TaskBarItem> TaskBarItems { get; private set; } + + /// <summary> /// Initializes a new instance of the <see cref="DefaultNotificationProvider"/> class. /// </summary> public DefaultNotificationProvider() { NotificationItems = new ObservableCollection<NotificationItem>(); + TaskBarItems = new ObservableCollection<TaskBarItem>(); _pendingMessageBoxes = new ConcurrentQueue<PendingNotification<MessageBoxVM, bool>>(); _pendingDialogs = new ConcurrentQueue<PendingNotification<DialogAndView, DialogViewVM>>(); @@ -441,5 +447,35 @@ namespace Tango.PPC.UI.Notifications LogManager.Log($"Popping out AppBarItem '{appBarItem.GetType().Name}'."); CurrentAppBarItem = null; } + + /// <summary> + /// Pushes the task bar item. + /// </summary> + /// <param name="taskBarItem">The task bar item.</param> + /// <returns></returns> + public TaskBarItem PushTaskBarItem(TaskBarItem taskBarItem) + { + TaskBarItems.Add(taskBarItem); + return taskBarItem; + } + + /// <summary> + /// Handles the Push Task Bar Item event. + /// </summary> + /// <typeparam name="T"></typeparam> + /// <returns></returns> + public TaskBarItem PushTaskBarItem<T>() where T : TaskBarItem + { + return PushTaskBarItem(Activator.CreateInstance<T>()); + } + + /// <summary> + /// Pops the task bar item. + /// </summary> + /// <param name="taskBarItem"></param> + public void PopTaskBarItem(TaskBarItem taskBarItem) + { + TaskBarItems.Remove(taskBarItem); + } } } 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..f615f25e0 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 @@ -118,7 +118,7 @@ </Compile> <Compile Include="Connectivity\WiFiAuthenticationViewVM.cs" /> <Compile Include="Converters\AppBarItemConverter.cs" /> - <Compile Include="Converters\NotificationItemConverter.cs" /> + <Compile Include="Converters\ItemBaseConverter.cs" /> <Compile Include="Modules\DefaultStudioModuleLoader.cs" /> <Compile Include="Navigation\DefaultNavigationManager.cs" /> <Compile Include="Notifications\DefaultNotificationProvider.cs" /> @@ -263,6 +263,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> @@ -315,6 +319,10 @@ <Project>{91b70e9b-66a7-4873-ae10-400e71cf404f}</Project> <Name>Tango.PPC.MachineSettings</Name> </ProjectReference> + <ProjectReference Include="..\Modules\Tango.PPC.Storage\Tango.PPC.Storage.csproj"> + <Project>{04febb02-f782-4b96-b47d-f6902afa43be}</Project> + <Name>Tango.PPC.Storage</Name> + </ProjectReference> <ProjectReference Include="..\Tango.PPC.Common\Tango.PPC.Common.csproj"> <Project>{0be74eee-22cb-4dba-b896-793b9e1a3ac0}</Project> <Name>Tango.PPC.Common</Name> @@ -365,6 +373,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" /> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs index 57fae7791..703a2f6ae 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")); 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 fd36d0d13..76eda9ac0 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows.Threading; using Tango.Core.Commands; using Tango.Core.DI; using Tango.Integration.Operation; @@ -88,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 @@ -108,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/MainViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs index e207c30b3..b01be3734 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows.Threading; using Tango.Core.DI; using Tango.Integration.ExternalBridge; using Tango.PPC.Common; @@ -22,11 +23,45 @@ namespace Tango.PPC.UI.ViewModels /// <seealso cref="Tango.PPC.Common.PPCViewModel" /> public class MainViewVM : PPCViewModel { + private DispatcherTimer _date_timer; + + private DateTime _currentDateTime; + /// <summary> + /// Gets or sets the current date time. + /// </summary> + public DateTime CurrentDateTime + { + get { return _currentDateTime; } + set { _currentDateTime = value; RaisePropertyChangedAuto(); } + } + + public MainViewVM() + { + _date_timer = new DispatcherTimer(); + _date_timer.Interval = TimeSpan.FromSeconds(1); + _date_timer.Tick += _date_timer_Tick; + _date_timer.Start(); + } + /// <summary> /// Called when the application has been started. /// </summary> public override void OnApplicationStarted() { } + + #region Event Handlers + + /// <summary> + /// Handles the Tick event of the _date_timer. + /// </summary> + /// <param name="sender">The source of the event.</param> + /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> + private void _date_timer_Tick(object sender, EventArgs e) + { + CurrentDateTime = DateTime.Now; + } + + #endregion } } 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..076cd09e4 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml @@ -18,7 +18,7 @@ d:DesignHeight="1280" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:LayoutViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.LayoutViewVM}"> <UserControl.Resources> - <localConverters:NotificationItemConverter x:Key="NotificationItemConverter" /> + <localConverters:ItemBaseConverter x:Key="NotificationItemConverter" /> <localConverters:AppBarItemConverter x:Key="AppBarItemConverter" /> </UserControl.Resources> @@ -62,12 +62,15 @@ </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"> + <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 8e54f0990..7eca6dba6 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml @@ -16,7 +16,7 @@ d:DesignHeight="1280" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> <UserControl.Resources> - <localConverters:NotificationItemConverter x:Key="NotificationItemConverter" /> + <localConverters:ItemBaseConverter x:Key="ItemBaseConverter" /> </UserControl.Resources> <Grid> @@ -33,12 +33,48 @@ <touch:TouchButton Style="{StaticResource TangoFlatButton}" Padding="0" Command="{Binding PressedCommand}" components:TransformationHelper.TransformWhenPressed="False"> <DockPanel> <touch:TouchIconButton DockPanel.Dock="Right" Background="Transparent" Padding="20" Style="{StaticResource TangoRoundTouchIconButton}" Command="{Binding CloseCommand}" CommandParameter="{Binding}" HorizontalAlignment="Right" MaxHeight="60" Width="{Binding RelativeSource={RelativeSource Self},Path=ActualHeight}" Icon="Close" Foreground="White" /> - <ContentControl Content="{Binding Converter={StaticResource NotificationItemConverter}}"/> + <ContentControl Content="{Binding Converter={StaticResource ItemBaseConverter}}"/> </DockPanel> </touch:TouchButton> </DataTemplate> </touch:TouchPanel.NotificationTemplate> + <touch:TouchPanel.TaskBarElement> + <Border DockPanel.Dock="Top" Background="Black" Padding="5"> + <DockPanel> + <TextBlock VerticalAlignment="Center" DockPanel.Dock="Right" Text="{Binding CurrentDateTime,StringFormat='g'}" FontSize="16" Foreground="{StaticResource TangoPrimaryBackgroundBrush}"></TextBlock> + <touch:TouchIcon Width="20" Height="20" VerticalAlignment="Center"> + <touch:TouchIcon.Style> + <Style TargetType="touch:TouchIcon" BasedOn="{StaticResource {x:Type touch:TouchIcon}}"> + <Setter Property="Icon" Value="WifiStrengthOff"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoGrayBrush}"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding ConnectivityProvider.IsConnected}" Value="True"> + <Setter Property="Icon" Value="Wifi"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoSuccessBrush}"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </touch:TouchIcon.Style> + </touch:TouchIcon> + + <ItemsControl ItemsSource="{Binding NotificationProvider.TaskBarItems}"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <StackPanel Orientation="Horizontal" /> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemTemplate> + <DataTemplate> + <ContentControl Width="20" Height="20" VerticalAlignment="Center" Margin="10 0 0 0" Content="{Binding Converter={StaticResource ItemBaseConverter}}"/> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + <Grid></Grid> + </DockPanel> + </Border> + </touch:TouchPanel.TaskBarElement> + <controls:NavigationControl TransitionAlwaysFades="True" KeepElementsAttached="True" TransitionType="Zoom" x:Name="NavigationControl" x:FieldModifier="public"> <local:LoadingView></local:LoadingView> <local:LoginView></local:LoginView> |
