Win UI 3 Update and Enhanced Navigation (#169)

* working navbar on windows desktop

* updated windows target and updated ui components

* moved app controls to top right and changed tab behavior of navigation bar

* removed extraneous code

* readme refers to build 19041 as target version
This commit is contained in:
nick5616 2021-07-15 15:17:32 -07:00 коммит произвёл GitHub
Родитель 6756a38717
Коммит 0740b499d4
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
12 изменённых файлов: 148 добавлений и 118 удалений

Просмотреть файл

@ -64,9 +64,9 @@ FactoryOrchestrator
## Prerequisites to build source code
### Install dependencies
Building Factory Orchestrator source requires the [NET 5.0 SDK](https://dotnet.microsoft.com/download/dotnet/5.0), the [NET Core 3.1 runtime.](https://dotnet.microsoft.com/download/dotnet/3.1/runtime/), and [PowerShell 7+](https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell) (or Windows PowerShell). If you wish to build the app as well, you also need the Universal Windows Platform Development (10.0.17763.0) SDK.
Building Factory Orchestrator source requires the [NET 5.0 SDK](https://dotnet.microsoft.com/download/dotnet/5.0), the [NET Core 3.1 runtime.](https://dotnet.microsoft.com/download/dotnet/3.1/runtime/), and [PowerShell 7+](https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell) (or Windows PowerShell). If you wish to build the app as well, you also need the Universal Windows Platform Development (10.0.19041.0) SDK.
The easiest way to prepare to build the solutions is using any variation of [Visual Studio 2019+ (Enterprise, Community)](https://visualstudio.microsoft.com/vs/). In the installer, make sure you click the checkboxes for .NET Core cross-platform Development, and Universal Windows Platform Development (10.0.17763.0).
The easiest way to prepare to build the solutions is using any variation of [Visual Studio 2019+ (Enterprise, Community)](https://visualstudio.microsoft.com/vs/). In the installer, make sure you click the checkboxes for .NET Core cross-platform Development, and Universal Windows Platform Development (10.0.19041.0).
You can also use [Visual Studio Code](https://code.visualstudio.com/), or any whatever editor you prefer. Visual Studio provides a sleek [command-line installer](https://docs.microsoft.com/en-us/visualstudio/install/use-command-line-parameters-to-install-visual-studio) that can be used to just deploy the necessary dependencies using their [workload component id](https://docs.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-community).

Просмотреть файл

@ -6,7 +6,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
>
<ScrollViewer IsVerticalScrollChainingEnabled="True" VerticalScrollBarVisibility="Visible">
<Grid>

Просмотреть файл

@ -3,5 +3,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Microsoft.FactoryOrchestrator.UWP">
<Application.Resources>
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
</Application.Resources>
</Application>

Просмотреть файл

@ -6,7 +6,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
>
<Grid x:Name="AppsGrid">
<Grid.RowDefinitions>

Просмотреть файл

@ -5,7 +5,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
>
<Grid>
<Grid.RowDefinitions>

Просмотреть файл

@ -6,7 +6,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
>
<Page.Resources>
<Flyout x:Name="ConfirmTransferFlyout" x:Key="ConfirmTransferFlyout">
<StackPanel>

Просмотреть файл

@ -7,6 +7,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid>
@ -15,40 +16,58 @@
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left">
<TextBlock x:Name="OSVersionHeader" VerticalAlignment="Center" HorizontalAlignment="Left" Style="{StaticResource CaptionTextBlockStyle}" IsTextSelectionEnabled="True"/>
<TextBlock x:Name="OEMVersionHeader" VerticalAlignment="Center" HorizontalAlignment="Left" Style="{StaticResource CaptionTextBlockStyle}" IsTextSelectionEnabled="True"/>
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Top" HorizontalAlignment="Right">
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBlock x:Name="NetworkName" Style="{StaticResource CaptionTextBlockStyle}" IsTextSelectionEnabled="True"/>
<TextBlock x:Name="NetworkIp" Style="{StaticResource CaptionTextBlockStyle}" IsTextSelectionEnabled="True"/>
</StackPanel>
<Button x:Name="NetworkButton" x:Uid="NetworkButton" Visibility="Visible" Padding="5" Margin="10">
</Grid>
<Grid x:Name="LayoutRoot" Width="Auto" Height="Auto" HorizontalAlignment="Stretch" Margin="30,40,30,0" VerticalAlignment="Stretch">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="10" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal">
<TextBlock FontFamily="Segoe MDL2 Assets" x:Uid="NetworkButton" Text="&#xEDA3;" FontSize="30" VerticalAlignment="Center" />
<TextBlock x:Name="Header" x:Uid="FactoryOrchestrator" Grid.Column="0" Text="" VerticalAlignment="Center" HorizontalAlignment="Left" FontWeight="Bold" Style="{StaticResource TitleTextBlockStyle}"/>
</StackPanel>
<Frame HorizontalAlignment="Right" Grid.Column="1">
<StackPanel Orientation="Horizontal">
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5">
<TextBlock x:Name="NetworkName" Text="" Style="{StaticResource CaptionTextBlockStyle}" VerticalAlignment="Center" TextWrapping="Wrap" IsTextSelectionEnabled="True"/>
<TextBlock x:Name="NetworkIp" Text="" Style="{StaticResource CaptionTextBlockStyle}" VerticalAlignment="Center" TextWrapping="Wrap" IsTextSelectionEnabled="True"/>
</StackPanel>
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5">
<TextBlock x:Name="OSVersionHeader" Text="" VerticalAlignment="Center" HorizontalAlignment="Left" TextWrapping="Wrap" Style="{StaticResource CaptionTextBlockStyle}" IsTextSelectionEnabled="True"/>
<TextBlock x:Name="OEMVersionHeader" Text="" VerticalAlignment="Center" HorizontalAlignment="Left" TextWrapping="Wrap" Style="{StaticResource CaptionTextBlockStyle}" IsTextSelectionEnabled="True"/>
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<StackPanel.BorderBrush>
<SolidColorBrush Color="{ThemeResource SystemAltLowColor}"/>
</StackPanel.BorderBrush>
<Button x:Name="NetworkButton" x:Uid="NetworkButton" Visibility="Visible" Padding="5" Margin="0">
<StackPanel Orientation="Horizontal">
<TextBlock FontFamily="Segoe MDL2 Assets" Text="&#xEDA3;" FontSize="30" VerticalAlignment="Center" />
</StackPanel>
<Button.Flyout>
<Flyout x:Name="NetworkFlyout" Opening="NetworkFlyout_Opening">
<Flyout.FlyoutPresenterStyle>
<Style TargetType="FlyoutPresenter">
<Setter Property="ScrollViewer.HorizontalScrollMode" Value="Disabled"/>
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"/>
<Setter Property="IsTabStop" Value="True"/>
<Setter Property="TabNavigation" Value="Cycle"/>
</Style>
</Flyout.FlyoutPresenterStyle>
<StackPanel Orientation="Vertical" HorizontalAlignment="Center">
<TextBlock Style="{StaticResource FlyoutPickerTitleTextBlockStyle}" x:Uid="IpHeader" HorizontalAlignment="Center"/>
<TextBlock Style="{StaticResource FlyoutPickerTitleTextBlockStyle}" x:Uid="IpHeader" Text="" HorizontalAlignment="Center"/>
<StackPanel x:Name="NetworkStackPanel" Orientation="Vertical" HorizontalAlignment="Center">
</StackPanel>
</StackPanel>
</Flyout>
</Button.Flyout>
</Button>
<Button x:Name="SettingsButton" x:Uid="SettingsButton" Visibility="Visible" Padding="5" Margin="10">
<Button x:Name="SettingsButton" x:Uid="SettingsButton" Visibility="Visible" Padding="5" Margin="5,0,0,0">
<StackPanel Orientation="Horizontal">
<TextBlock FontFamily="Segoe MDL2 Assets" x:Uid="SettingsButton" Text="&#xE713;" FontSize="30" VerticalAlignment="Center" />
<TextBlock FontFamily="Segoe MDL2 Assets" Text="&#xE713;" FontSize="30" VerticalAlignment="Center" />
</StackPanel>
<Button.Flyout>
<Flyout x:Name="SettingsFlyout" Opening="SettingsFlyout_Opening">
@ -63,9 +82,9 @@
</Flyout>
</Button.Flyout>
</Button>
<Button x:Name="ExitButton" x:Uid="ExitButton" AutomationProperties.LabeledBy="{Binding ElementName=ExitText}" Padding="5" Margin="10">
<Button x:Name="ExitButton" AutomationProperties.LabeledBy="{Binding ElementName=ExitText}" Padding="5" Margin="5,0,0,0">
<StackPanel Orientation="Horizontal">
<TextBlock FontFamily="Segoe MDL2 Assets" x:Uid="ExitButton" Text="&#xE711;" FontSize="30" VerticalAlignment="Center" />
<TextBlock FontFamily="Segoe MDL2 Assets" Text="&#xE711;" FontSize="30" VerticalAlignment="Center" />
</StackPanel>
<Button.Flyout>
<Flyout x:Name="ExitFlyout" Closed="ExitFlyout_Closed">
@ -97,34 +116,39 @@
</Button.Flyout>
</Button>
</StackPanel>
</StackPanel>
</Frame>
</Grid>
<Grid x:Name="LayoutRoot" Width="Auto" Height="Auto" HorizontalAlignment="Stretch" Margin="30,40,30,0" VerticalAlignment="Stretch">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="10" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock x:Name="Header" Grid.Row="0" x:Uid="FactoryOrchestrator" VerticalAlignment="Center" HorizontalAlignment="Center" FontWeight="Bold" Style="{StaticResource TitleTextBlockStyle}"/>
<TextBlock x:Name="BootTaskWarning" x:Uid="BootTaskWarning" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center" FontWeight="Bold" FontStyle="Italic" Style="{StaticResource SubtitleTextBlockStyle}" Visibility="Collapsed" Margin="5"/>
<NavigationView x:Name="NavView" Grid.Row="3" PaneDisplayMode="Top" IsBackButtonVisible="Collapsed" IsSettingsVisible="False" ItemInvoked="NavView_ItemInvoked">
<NavigationView.MenuItems>
<NavigationViewItem Tag="run" x:Uid="Run" Icon="Play"/>
<NavigationViewItem Tag="console" x:Uid="Console" AutomationProperties.LabeledBy="{Binding ElementName=CommandPromptText}">
<muxc:NavigationView
x:Name="NavView"
Grid.Row="3"
PaneDisplayMode="Top"
IsBackButtonVisible="Collapsed"
IsSettingsVisible="False"
ItemInvoked="NavView_ItemInvoked"
>
<muxc:NavigationView.MenuItems>
<muxc:NavigationViewItem Tag="run" TabIndex="0" x:Uid="Run" Icon="Play"/>
<muxc:NavigationViewItem Tag="console" TabIndex="0" x:Uid="Console" AutomationProperties.LabeledBy="{Binding ElementName=CommandPromptText}">
<StackPanel Orientation="Horizontal">
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph="&#xE756;"/>
<TextBlock x:Name="CommandPromptText" x:Uid="CommandPromptText" Margin="10, 9"/>
</StackPanel>
</NavigationViewItem>
<NavigationViewItem Tag="apps" x:Uid="Apps" Icon="AllApps" />
<NavigationViewItem Tag="save" x:Uid="Save" Icon="Edit"/>
<NavigationViewItem Tag="files" x:Uid="Files" Icon="SyncFolder"/>
<NavigationViewItem Tag="wdp" x:Uid="WDP" Icon="SwitchApps"/>
<NavigationViewItem Tag="about" x:Uid="About" Icon="Help"/>
</NavigationView.MenuItems>
<Frame x:Name="ContentFrame" IsTabStop="True" Padding="0, 0, 24, 0"/>
</NavigationView>
</muxc:NavigationViewItem>
<muxc:NavigationViewItem Tag="apps" TabIndex="0" x:Uid="Apps" Icon="AllApps" />
<muxc:NavigationViewItem Tag="save" TabIndex="0" x:Uid="Save" Icon="Edit"/>
<muxc:NavigationViewItem Tag="files" TabIndex="0" x:Uid="Files" Icon="SyncFolder"/>
<muxc:NavigationViewItem Tag="wdp" TabIndex="0" x:Uid="WDP" Icon="SwitchApps"/>
<muxc:NavigationViewItem Tag="about" TabIndex="0" x:Uid="About" Icon="Help"/>
</muxc:NavigationView.MenuItems>
<muxc:NavigationView.FooterMenuItems>
</muxc:NavigationView.FooterMenuItems>
<Frame x:Name="ContentFrame" IsTabStop="True" Padding="12" />
</muxc:NavigationView>
</Grid>
</Grid>
</Page>

Просмотреть файл

@ -15,6 +15,7 @@ using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media.Animation;
using Windows.UI.Xaml.Navigation;
using MUXC = Microsoft.UI.Xaml.Controls;
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
@ -194,11 +195,11 @@ namespace Microsoft.FactoryOrchestrator.UWP
{
// NavView doesn't load any page by default, so load home page.
NavView.SelectedItem = NavView.MenuItems[0];
((App)Application.Current).MainPageLastNavTag = lastNavTag = ((NavigationViewItem)NavView.SelectedItem).Tag.ToString();
((App)Application.Current).MainPageLastNavTag = lastNavTag = ((MUXC.NavigationViewItem)NavView.SelectedItem).Tag.ToString();
}
else
{
NavView.SelectedItem = NavView.MenuItems.Where(x => ((NavigationViewItem)x).Tag.ToString() == lastNavTag).First();
NavView.SelectedItem = NavView.MenuItems.Where(x => ((MUXC.NavigationViewItem)x).Tag.ToString() == lastNavTag).First();
}
if (!disabledPages.Any(str => str.Equals(lastNavTag, StringComparison.OrdinalIgnoreCase)))
@ -216,7 +217,7 @@ namespace Microsoft.FactoryOrchestrator.UWP
};
NavView.SelectedItem = NavView.MenuItems[0];
((App)Application.Current).MainPageLastNavTag = lastNavTag = ((NavigationViewItem)NavView.SelectedItem).Tag.ToString();
((App)Application.Current).MainPageLastNavTag = lastNavTag = ((MUXC.NavigationViewItem)NavView.SelectedItem).Tag.ToString();
NavView_Navigate(lastNavTag, null, e);
@ -260,7 +261,7 @@ namespace Microsoft.FactoryOrchestrator.UWP
private void HidePage((string Tag, Type Page, bool Enabled, bool AllowedDuringBoot) pageMap)
{
NavigationViewItem item = (NavigationViewItem)NavView.MenuItems.Where(x => ((NavigationViewItem)x).Tag.ToString() == pageMap.Tag).First();
var item = (MUXC.NavigationViewItem)NavView.MenuItems.First(x => ((MUXC.NavigationViewItem)x).Tag.ToString() == pageMap.Tag);
item.Visibility = Visibility.Collapsed;
item.IsEnabled = false;
navViewPages.Remove(pageMap);
@ -287,7 +288,7 @@ namespace Microsoft.FactoryOrchestrator.UWP
return;
}
NavigationViewItem item = (NavigationViewItem)NavView.MenuItems.Where(x => ((NavigationViewItem)x).Tag.ToString() == pageMap.Tag).First();
MUXC.NavigationViewItem item = (MUXC.NavigationViewItem)NavView.MenuItems.Where(x => ((MUXC.NavigationViewItem)x).Tag.ToString() == pageMap.Tag).First();
item.Visibility = Visibility.Visible;
item.IsEnabled = true;
navViewPages.Remove(pageMap);
@ -301,7 +302,7 @@ namespace Microsoft.FactoryOrchestrator.UWP
{
var item = navViewPages.FirstOrDefault(p => (p.Page == e.SourcePageType));
NavView.SelectedItem = NavView.MenuItems.OfType<NavigationViewItem>().
NavView.SelectedItem = NavView.MenuItems.OfType<MUXC.NavigationViewItem>().
First(n => n.Tag.Equals(item.Tag));
NavView.Header = GetHeader();
@ -310,17 +311,17 @@ namespace Microsoft.FactoryOrchestrator.UWP
private string GetHeader()
{
if ("console".Equals((string)((NavigationViewItem)NavView.SelectedItem).Tag, StringComparison.OrdinalIgnoreCase))
if ("console".Equals((string)((MUXC.NavigationViewItem)NavView.SelectedItem).Tag, StringComparison.OrdinalIgnoreCase))
{
return resourceLoader.GetString("CommandPromptText/Text");
}
else
{
return ((NavigationViewItem)NavView.SelectedItem)?.Content?.ToString();
return ((MUXC.NavigationViewItem)NavView.SelectedItem)?.Content?.ToString();
}
}
private void NavView_ItemInvoked(NavigationView sender, NavigationViewItemInvokedEventArgs args)
private void NavView_ItemInvoked(MUXC.NavigationView sender, MUXC.NavigationViewItemInvokedEventArgs args)
{
if (args.InvokedItemContainer != null)
{
@ -523,6 +524,7 @@ namespace Microsoft.FactoryOrchestrator.UWP
private List<Tuple<string, string>> ipAddresses;
private readonly SemaphoreSlim ipAddressSem;
private readonly ResourceLoader resourceLoader = ResourceLoader.GetForCurrentView();
}
}

Просмотреть файл

@ -14,7 +14,7 @@
<AssemblyName>Microsoft.FactoryOrchestrator.App</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.17763.0</TargetPlatformVersion>
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.19041.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment>
@ -280,6 +280,9 @@
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
<Version>6.2.10</Version>
</PackageReference>
<PackageReference Include="Microsoft.UI.Xaml">
<Version>2.6.0</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ClientLibrary\Microsoft.FactoryOrchestrator.Client.csproj">

Просмотреть файл

@ -7,7 +7,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
>
<Page.Resources>
<Flyout x:Name="SaveFlyout" x:Key="SaveFlyout" Closing="SaveFlyout_Closing">

Просмотреть файл

@ -7,7 +7,7 @@
xmlns:core="using:Microsoft.FactoryOrchestrator.Core"
xmlns:local="using:Microsoft.FactoryOrchestrator.UWP"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
>
<Page.Resources>
<local:TaskStatusDataBindingConverter x:Key="TaskStatusDataBindingConverter"/>
<DataTemplate x:DataType="core:TaskListSummary" x:Key="TaskListItemTemplate_NotRun">

Просмотреть файл

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) Microsoft Corporation. -->
<!-- Licensed under the MIT license. -->
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Import Project="..\common.props" />
@ -23,7 +22,7 @@
<TargetName>Microsoft.FactoryOrchestrator.UWPClient</TargetName>
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.17763.0</TargetPlatformVersion>
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.19041.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment>