Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use new titlebar control (AppSdk 1.7?) #2490

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions src/UniGetUI/Interface/MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -25,12 +25,29 @@
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="36"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Border Grid.Row="0" Grid.Column="0" x:Name="__app_titlebar" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
<TitleBar
Name="titlebar"
Title="UniGetUI"
IsPaneToggleButtonVisible="False"
IsBackButtonVisible="False"
Subtitle="formerly WingetUI">
<TitleBar.IconSource>
<ImageIconSource ImageSource="ms-appx:///Assets/Images/icon.png" />
</TitleBar.IconSource>
<TextBox
Name="GenericSearchBox"
Width="400"
PlaceholderText="Search anything"
Margin="4,0,4,0" Height="30"
>
</TextBox>
</TitleBar>
<!--Border Grid.Row="0" Grid.Column="0" x:Name="__app_titlebar" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
<StackPanel Orientation="Horizontal" VerticalAlignment="Top" HorizontalAlignment="Stretch" Margin="12,8,12,8" Spacing="10">
<Image VerticalAlignment="Stretch" HorizontalAlignment="Left" Width="16" Height="16" >
<Image.Source>
@@ -39,7 +56,7 @@
</Image>
<widgets:TranslatedTextBlock x:Name="AppTitle" Text="WingetUI" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" FontSize="12"/>
</StackPanel>
</Border>
</Border-->
<InfoBar Name="UpdatesBanner" x:FieldModifier="public" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" IsOpen="False" Visibility="{x:Bind UpdatesBanner.IsOpen, Mode=OneWay}" Margin="0,0,0,4" CornerRadius="0" BorderThickness="0,1,0,1"/>
<InfoBar Name="ErrorBanner" x:FieldModifier="public" Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" IsOpen="False" Visibility="{x:Bind ErrorBanner.IsOpen, Mode=OneWay}" Margin="0,0,0,4" Severity="Error" CornerRadius="0" BorderThickness="0,1,0,1"/>
</Grid>
27 changes: 23 additions & 4 deletions src/UniGetUI/Interface/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -77,30 +77,49 @@ public struct MONITORINFO

public List<NavButton> NavButtonList = [];
#pragma warning disable CS8618

public MainWindow()
{
InitializeComponent();
LoadTrayMenu();
ExtendsContentIntoTitleBar = true;
SetTitleBar(__content_root);
//SetTitleBar(__content_root);
ContentRoot = __content_root;
ApplyTheme();

SizeChanged += (s, e) => { SaveGeometry(); };

titlebar.Loaded += (sender, args) =>
{
VisualStateManager.GoToState(titlebar, "SubtitleTextVisible", false);
VisualStateManager.GoToState(titlebar, "HeaderVisible", false);
VisualStateManager.GoToState(titlebar, "ContentVisible", false);
VisualStateManager.GoToState(titlebar, "FooterVisible", false);

// Run layout so we re-calculate the drag regions.
titlebar.InvalidateMeasure();
};

AppWindow.SetIcon(Path.Join(CoreData.UniGetUIExecutableDirectory, "Assets", "Images", "icon.ico"));
//titlebar.IconSource = new BitmapIconSource() { UriSource = new Uri("ms-appx:///Assets/Images/icon.png") };
titlebar.Title = "UniGetUI";
titlebar.Subtitle = CoreTools.Translate("formerly known as WingetUI");
//titlebar.Content = new TextBox();
//AppWindow.SetIcon(Path.Join(CoreData.UniGetUIExecutableDirectory, "Assets", "Images", "icon.ico"));
if (CoreTools.IsAdministrator())
{
Title = "UniGetUI " + CoreTools.Translate("[RAN AS ADMINISTRATOR]");
AppTitle.Text = Title;
titlebar.Title = Title;
}
ExtendsContentIntoTitleBar = true;
SetTitleBar(titlebar);

LoadingSthDalog = new ContentDialog
{
Style = Application.Current.Resources["DefaultContentDialogStyle"] as Style,
Title = CoreTools.Translate("Please wait"),
Content = new ProgressBar { IsIndeterminate = true, Width = 300 }
};

}
#pragma warning restore CS8618
public void HandleNotificationActivation(ToastArguments args, ValueSet input)
@@ -352,7 +371,7 @@ public void UpdateSystemTrayStatus()

public void SwitchToInterface()
{
SetTitleBar(__app_titlebar);
//SetTitleBar(__app_titlebar);
ContentRoot = __content_root;

NavigationPage = new MainView();
6 changes: 4 additions & 2 deletions src/UniGetUI/UniGetUI.csproj
Original file line number Diff line number Diff line change
@@ -35,7 +35,9 @@
<ApplicationIcon>icon.ico</ApplicationIcon>
<AssemblyName>WingetUI</AssemblyName>
<Nullable>enable</Nullable>

<WindowsSdkPackageVersion>10.0.22621.35-preview</WindowsSdkPackageVersion>


</PropertyGroup>
<ItemGroup>
<Content Include="icon.ico" />
@@ -77,7 +79,7 @@
<PackageReference Include="CommunityToolkit.WinUI.Controls.Sizers" Version="8.0.240109" />
<PackageReference Include="CommunityToolkit.WinUI.Notifications" Version="7.1.2" />
<PackageReference Include="H.NotifyIcon.WinUI" Version="2.0.131" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.5.240607001" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.6.240701003-experimental2" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />