Skip to content

Commit 7ae0744

Browse files
authored
feat: Launcher - "Visual Studio Extensions" section only visible on Windows (stride3d#2795)
1 parent 4d9a1b9 commit 7ae0744

2 files changed

Lines changed: 81 additions & 66 deletions

File tree

sources/launcher/Stride.Launcher/Views/MainView.axaml

Lines changed: 73 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
55
xmlns:sd="http://schemas.stride3d.net/xaml/presentation"
66
xmlns:md="https://github.com/whistyun/Markdown.Avalonia.Tight"
7+
xmlns:p="using:Stride.Core.Presentation.Avalonia.Services"
78
xmlns:l="using:Stride.Launcher.Assets.Localization"
89
xmlns:srv="using:Stride.Launcher.Services"
910
xmlns:vm="using:Stride.Launcher.ViewModels"
@@ -240,6 +241,7 @@
240241
</Border>
241242
<!-- Visual studio extensions -->
242243
<Border DockPanel.Dock="Bottom"
244+
IsVisible="{Binding Source={x:Static p:OperatingSystemHelper.IsWindows}, Mode=OneTime}"
243245
BorderBrush="{StaticResource TileBorderBrush}" BorderThickness="{StaticResource BorderThicknessTile}">
244246
<StackPanel>
245247
<StackPanel.DataTemplates>
@@ -269,6 +271,7 @@
269271
</StackPanel>
270272
</Border>
271273
<Border DockPanel.Dock="Bottom"
274+
IsVisible="{Binding Source={x:Static p:OperatingSystemHelper.IsWindows}, Mode=OneTime}"
272275
BorderBrush="{StaticResource BorderBrushTile}">
273276
<DockPanel Margin="4,0">
274277
<Button Classes="TransparentButton"
@@ -284,6 +287,7 @@
284287
</DockPanel>
285288
</Border>
286289
<Border DockPanel.Dock="Bottom"
290+
IsVisible="{Binding Source={x:Static p:OperatingSystemHelper.IsWindows}, Mode=OneTime}"
287291
BorderBrush="{StaticResource BorderBrushTile}" BorderThickness="12,0,0,0">
288292
<DockPanel Height="32" Margin="4,0">
289293
<Image Source="/Assets/Images/visual-studio.png"
@@ -393,7 +397,7 @@
393397
<Border.Effect>
394398
<DropShadowEffect BlurRadius="5" Opacity="0.4" />
395399
</Border.Effect>
396-
<ScrollViewer VerticalScrollBarVisibility="Auto" MaxHeight="128">
400+
<ScrollViewer VerticalScrollBarVisibility="Auto" MaxHeight="256">
397401
<ItemsControl ItemsSource="{Binding AlternateVersions}">
398402
<ItemsControl.ItemTemplate>
399403
<DataTemplate DataType="{x:Type vm:StrideStoreAlternateVersionViewModel}">
@@ -507,72 +511,75 @@
507511
FontSize="24" TextAlignment="Left" VerticalAlignment="Center" />
508512
</DockPanel>
509513
</Border>
510-
<Border BorderBrush="{StaticResource BorderBrushTile}" BorderThickness="{StaticResource BorderThicknessTile}"
511-
Background="{StaticResource BackgroundTileAlpha}"
512-
IsVisible="{Binding !RecentProjects.Count, FallbackValue={x:False}}">
513-
<TextBlock Text="{x:Static l:Strings.NoProjectCreated}"
514-
FontSize="16" Margin="20"
515-
TextAlignment="Center" VerticalAlignment="Center" />
516-
</Border>
517-
<Border BorderBrush="{StaticResource BorderBrushTile}" BorderThickness="{StaticResource BorderThicknessTile}">
518-
<ScrollViewer VerticalScrollBarVisibility="Auto">
519-
<ItemsControl ItemsSource="{Binding RecentProjects}">
520-
<ItemsControl.ItemTemplate>
521-
<DataTemplate DataType="{x:Type vm:RecentProjectViewModel}">
522-
<Border BorderBrush="{StaticResource BorderBrushTile}" BorderThickness="{StaticResource BorderThicknessTileList}">
523-
<Button Command="{Binding OpenCommand}"
524-
IsEnabled="{Binding Launcher.StartStudioCommand.IsEnabled}"
525-
HorizontalAlignment="Stretch"
526-
HorizontalContentAlignment="Stretch">
527-
<DockPanel Margin="8,4">
528-
<DockPanel DockPanel.Dock="Bottom">
529-
<!-- Update dropdown -->
530-
<ToggleButton DockPanel.Dock="Right" x:Name="Toggle"
531-
IsVisible="{Binding CompatibleVersions.Count}"/>
532-
<Popup IsOpen="{Binding ElementName=Toggle, Path=IsChecked}"
533-
PlacementTarget="{Binding ElementName=Toggle}">
534-
<ScrollViewer VerticalScrollBarVisibility="Auto">
535-
<ItemsControl ItemsSource="{Binding CompatibleVersions}">
536-
<ItemsControl.ItemTemplate>
537-
<DataTemplate DataType="{x:Type vm:StrideVersionViewModel}">
538-
<Button Content="{Binding DisplayName, StringFormat={x:Static l:Strings.OpenProjectWithVersion}}"
539-
Command="{Binding $parent[ScrollViewer].((vm:RecentProjectViewModel)DataContext).OpenWithCommand}"
540-
HorizontalAlignment="Stretch" HorizontalContentAlignment="Left" />
541-
</DataTemplate>
542-
</ItemsControl.ItemTemplate>
543-
</ItemsControl>
544-
</ScrollViewer>
545-
</Popup>
546-
<TextBlock DockPanel.Dock="Bottom"
547-
Text="{Binding FullPath}"
548-
FontStyle="Italic" />
549-
</DockPanel>
550-
<DockPanel>
551-
<!-- Discovering -->
552-
<TextBlock Text="{Binding StrideVersionName}"
553-
FontSize="14"
554-
IsVisible="{Binding StrideVersionName, Converter={sd:ObjectToBool}}" />
555-
<!-- Unknown -->
556-
<TextBlock Text="{x:Static l:Strings.UnknownVersion}"
557-
FontSize="14"
558-
IsVisible="{Binding StrideVersionName, Converter={sd:Chained {sd:ObjectToBool}, {sd:InvertBool}}}" />
559-
<TextBlock Text="{Binding Name}"
560-
FontSize="16" FontWeight="Bold" />
514+
<Grid>
515+
<Border BorderBrush="{StaticResource BorderBrushTile}" BorderThickness="{StaticResource BorderThicknessTile}"
516+
Background="{StaticResource BackgroundTileAlpha}"
517+
IsVisible="{Binding !RecentProjects.Count, FallbackValue={x:False}}"
518+
VerticalAlignment="Top">
519+
<TextBlock Text="{x:Static l:Strings.NoProjectCreated}"
520+
FontSize="16" Margin="20"
521+
TextAlignment="Center" VerticalAlignment="Center" />
522+
</Border>
523+
<Border BorderBrush="{StaticResource BorderBrushTile}" BorderThickness="{StaticResource BorderThicknessTile}">
524+
<ScrollViewer VerticalScrollBarVisibility="Auto">
525+
<ItemsControl ItemsSource="{Binding RecentProjects}">
526+
<ItemsControl.ItemTemplate>
527+
<DataTemplate DataType="{x:Type vm:RecentProjectViewModel}">
528+
<Border BorderBrush="{StaticResource BorderBrushTile}" BorderThickness="{StaticResource BorderThicknessTileList}">
529+
<Button Command="{Binding OpenCommand}"
530+
IsEnabled="{Binding Launcher.StartStudioCommand.IsEnabled}"
531+
HorizontalAlignment="Stretch"
532+
HorizontalContentAlignment="Stretch">
533+
<DockPanel Margin="8,4">
534+
<DockPanel DockPanel.Dock="Bottom">
535+
<!-- Update dropdown -->
536+
<ToggleButton DockPanel.Dock="Right" x:Name="Toggle"
537+
IsVisible="{Binding CompatibleVersions.Count}"/>
538+
<Popup IsOpen="{Binding ElementName=Toggle, Path=IsChecked}"
539+
PlacementTarget="{Binding ElementName=Toggle}">
540+
<ScrollViewer VerticalScrollBarVisibility="Auto">
541+
<ItemsControl ItemsSource="{Binding CompatibleVersions}">
542+
<ItemsControl.ItemTemplate>
543+
<DataTemplate DataType="{x:Type vm:StrideVersionViewModel}">
544+
<Button Content="{Binding DisplayName, StringFormat={x:Static l:Strings.OpenProjectWithVersion}}"
545+
Command="{Binding $parent[ScrollViewer].((vm:RecentProjectViewModel)DataContext).OpenWithCommand}"
546+
HorizontalAlignment="Stretch" HorizontalContentAlignment="Left" />
547+
</DataTemplate>
548+
</ItemsControl.ItemTemplate>
549+
</ItemsControl>
550+
</ScrollViewer>
551+
</Popup>
552+
<TextBlock DockPanel.Dock="Bottom"
553+
Text="{Binding FullPath}"
554+
FontStyle="Italic" />
555+
</DockPanel>
556+
<DockPanel>
557+
<!-- Discovering -->
558+
<TextBlock Text="{Binding StrideVersionName}"
559+
FontSize="14"
560+
IsVisible="{Binding StrideVersionName, Converter={sd:ObjectToBool}}" />
561+
<!-- Unknown -->
562+
<TextBlock Text="{x:Static l:Strings.UnknownVersion}"
563+
FontSize="14"
564+
IsVisible="{Binding StrideVersionName, Converter={sd:Chained {sd:ObjectToBool}, {sd:InvertBool}}}" />
565+
<TextBlock Text="{Binding Name}"
566+
FontSize="16" FontWeight="Bold" />
567+
</DockPanel>
561568
</DockPanel>
562-
</DockPanel>
563-
</Button>
564-
<Border.ContextMenu>
565-
<ContextMenu>
566-
<MenuItem Header="{x:Static l:Strings.ShowInExplorer}" Command="{Binding ExploreCommand}" />
567-
<MenuItem Header="{x:Static l:Strings.RemoveFromList}" Command="{Binding RemoveCommand}" />
568-
</ContextMenu>
569-
</Border.ContextMenu>
570-
</Border>
571-
</DataTemplate>
572-
</ItemsControl.ItemTemplate>
573-
</ItemsControl>
574-
</ScrollViewer>
575-
</Border>
569+
</Button>
570+
<Border.ContextMenu>
571+
<ContextMenu>
572+
<MenuItem Header="{x:Static l:Strings.ShowInExplorer}" Command="{Binding ExploreCommand}" />
573+
<MenuItem Header="{x:Static l:Strings.RemoveFromList}" Command="{Binding RemoveCommand}" />
574+
</ContextMenu>
575+
</Border.ContextMenu>
576+
</Border>
577+
</DataTemplate>
578+
</ItemsControl.ItemTemplate>
579+
</ItemsControl>
580+
</ScrollViewer>
581+
</Border>
582+
</Grid>
576583
</DockPanel>
577584
</Border>
578585

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace Stride.Core.Presentation.Avalonia.Services;
2+
3+
public static class OperatingSystemHelper
4+
{
5+
public static readonly bool IsWindows = OperatingSystem.IsWindows();
6+
public static readonly bool IsLinux = OperatingSystem.IsLinux();
7+
public static readonly bool IsMacOS = OperatingSystem.IsMacOS();
8+
}

0 commit comments

Comments
 (0)