Skip to content

Commit

Permalink
Added TgDownloaderWinUI project
Browse files Browse the repository at this point in the history
  • Loading branch information
DamianMorozov committed Oct 29, 2024
1 parent 7d0a633 commit 005d79c
Show file tree
Hide file tree
Showing 18 changed files with 286 additions and 10 deletions.
10 changes: 9 additions & 1 deletion Clients/TgDownloaderBlazor/TgDownloaderBlazor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<PackageLicenseFile>LICENSE.md</PackageLicenseFile>
<Platforms>AnyCPU</Platforms>
<Platforms>AnyCPU;x64;x86</Platforms>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>acec7ca6-caa9-470e-96aa-3f14f080d6bd</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
Expand All @@ -16,6 +16,14 @@
<DebugType>none</DebugType>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x86'">
<DebugType>none</DebugType>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<DebugType>none</DebugType>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.10">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
2 changes: 1 addition & 1 deletion Clients/TgDownloaderBlazor/Utils/TgBlazorUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public static async Task RunFuncAsync(Func<Task> action, Action<string> actionEx
Console.WriteLine(ex);
#endif
if (ex.InnerException is null)
actionException(ex.Message);
actionException(ex.Message);
else
actionException(ex.Message + Environment.NewLine + ex.InnerException.Message);
}
Expand Down
16 changes: 16 additions & 0 deletions Clients/TgDownloaderWinUI/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<Application
x:Class="TgDownloaderWinUI.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:TgDownloaderWinUI">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
<!-- Other merged dictionaries here -->
</ResourceDictionary.MergedDictionaries>
<!-- Other app resources here -->
</ResourceDictionary>
</Application.Resources>
</Application>
48 changes: 48 additions & 0 deletions Clients/TgDownloaderWinUI/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Controls.Primitives;
using Microsoft.UI.Xaml.Data;
using Microsoft.UI.Xaml.Input;
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Navigation;
using Microsoft.UI.Xaml.Shapes;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.Foundation;
using Windows.Foundation.Collections;

// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.

namespace TgDownloaderWinUI;
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
public partial class App : Application
{
/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
this.InitializeComponent();
}

/// <summary>
/// Invoked when the application is launched.
/// </summary>
/// <param name="args">Details about the launch request and process.</param>
protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
{
m_window = new MainWindow();
m_window.Activate();
}

private Window m_window;
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Clients/TgDownloaderWinUI/Assets/StoreLogo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions Clients/TgDownloaderWinUI/MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Window
x:Class="TgDownloaderWinUI.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:TgDownloaderWinUI"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">

<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<Button x:Name="myButton" Click="myButton_Click">Click Me</Button>
</StackPanel>
</Window>
34 changes: 34 additions & 0 deletions Clients/TgDownloaderWinUI/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Controls.Primitives;
using Microsoft.UI.Xaml.Data;
using Microsoft.UI.Xaml.Input;
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Navigation;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;

// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.

namespace TgDownloaderWinUI;
/// <summary>
/// An empty window that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class MainWindow : Window
{
public MainWindow()
{
this.InitializeComponent();
}

private void myButton_Click(object sender, RoutedEventArgs e)
{
myButton.Content = "Clicked";
}
}
51 changes: 51 additions & 0 deletions Clients/TgDownloaderWinUI/Package.appxmanifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>

<Package
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
IgnorableNamespaces="uap rescap">

<Identity
Name="2a94c77e-8fd1-49f9-b9be-cf63d78348ac"
Publisher="CN=dev"
Version="1.0.0.0" />

<mp:PhoneIdentity PhoneProductId="2a94c77e-8fd1-49f9-b9be-cf63d78348ac" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>

<Properties>
<DisplayName>TgDownloaderWinUI</DisplayName>
<PublisherDisplayName>dev</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>

<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19041.0" />
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19041.0" />
</Dependencies>

<Resources>
<Resource Language="x-generate"/>
</Resources>

<Applications>
<Application Id="App"
Executable="$targetnametoken$.exe"
EntryPoint="$targetentrypoint$">
<uap:VisualElements
DisplayName="TgDownloaderWinUI"
Description="TgDownloaderWinUI"
BackgroundColor="transparent"
Square150x150Logo="Assets\Square150x150Logo.png"
Square44x44Logo="Assets\Square44x44Logo.png">
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png" />
<uap:SplashScreen Image="Assets\SplashScreen.png" />
</uap:VisualElements>
</Application>
</Applications>

<Capabilities>
<rescap:Capability Name="runFullTrust" />
</Capabilities>
</Package>
10 changes: 10 additions & 0 deletions Clients/TgDownloaderWinUI/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"profiles": {
"TgDownloaderWinUI (Package)": {
"commandName": "MsixPackage"
},
"TgDownloaderWinUI (Unpackaged)": {
"commandName": "Project"
}
}
}
55 changes: 55 additions & 0 deletions Clients/TgDownloaderWinUI/TgDownloaderWinUI.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows10.0.19041.0</TargetFramework>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<RootNamespace>TgDownloaderWinUI</RootNamespace>
<ApplicationManifest>app.manifest</ApplicationManifest>
<Platforms>x86;x64;ARM64;AnyCPU</Platforms>
<RuntimeIdentifiers Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) &gt;= 8">win-x86;win-x64;win-arm64</RuntimeIdentifiers>
<RuntimeIdentifiers Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) &lt; 8">win10-x86;win10-x64;win10-arm64</RuntimeIdentifiers>
<PublishProfile>win-$(Platform).pubxml</PublishProfile>
<UseWinUI>true</UseWinUI>
<EnableMsixTooling>true</EnableMsixTooling>
<Version>0.5.150.0</Version>
</PropertyGroup>

<ItemGroup>
<Content Include="Assets\SplashScreen.scale-200.png" />
<Content Include="Assets\LockScreenLogo.scale-200.png" />
<Content Include="Assets\Square150x150Logo.scale-200.png" />
<Content Include="Assets\Square44x44Logo.scale-200.png" />
<Content Include="Assets\Square44x44Logo.targetsize-24_altform-unplated.png" />
<Content Include="Assets\StoreLogo.png" />
<Content Include="Assets\Wide310x150Logo.scale-200.png" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.756" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.6.240923002" />
<Manifest Include="$(ApplicationManifest)" />
</ItemGroup>

<!--
Defining the "Msix" ProjectCapability here allows the Single-project MSIX Packaging
Tools extension to be activated for this project even if the Windows App SDK Nuget
package has not yet been restored.
-->
<ItemGroup Condition="'$(DisableMsixProjectCapabilityAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'">
<ProjectCapability Include="Msix" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Core\TgDownloader\TgDownloader.csproj" />
<ProjectReference Include="..\..\Core\TgLocalization\TgLocalization.csproj" />
<ProjectReference Include="..\..\Core\TgStorage\TgStorage.csproj" />
</ItemGroup>

<!--
Defining the "HasPackageAndPublishMenuAddedByProject" property here allows the Solution
Explorer "Package and Publish" context menu entry to be enabled for this project even if
the Windows App SDK Nuget package has not yet been restored.
-->
<PropertyGroup Condition="'$(DisableHasPackageAndPublishMenuAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'">
<HasPackageAndPublishMenu>true</HasPackageAndPublishMenu>
</PropertyGroup>
</Project>
19 changes: 19 additions & 0 deletions Clients/TgDownloaderWinUI/app.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="TgDownloaderWinUI.app"/>

<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- The ID below informs the system that this application is compatible with OS features first introduced in Windows 10.
It is necessary to support features in unpackaged applications, for example the custom titlebar implementation.
For more info see https://docs.microsoft.com/windows/apps/windows-app-sdk/use-windows-app-sdk-run-time#declare-os-compatibility-in-your-application-manifest -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
</application>
</compatibility>

<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness>
</windowsSettings>
</application>
</assembly>
37 changes: 29 additions & 8 deletions TgDownloader.sln
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{
.github\workflows\branch_preview_tests.yml = .github\workflows\branch_preview_tests.yml
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TgDownloaderWinUI", "Clients\TgDownloaderWinUI\TgDownloaderWinUI.csproj", "{962490FD-54E1-4062-87F0-5676407F33BE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -187,16 +189,34 @@ Global
{FC689594-30C9-45D2-B8DB-7079E752984B}.Release|x86.Build.0 = Release|x86
{2CEEB42C-BE70-4D2C-811F-17648FB742F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2CEEB42C-BE70-4D2C-811F-17648FB742F5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2CEEB42C-BE70-4D2C-811F-17648FB742F5}.Debug|x64.ActiveCfg = Debug|Any CPU
{2CEEB42C-BE70-4D2C-811F-17648FB742F5}.Debug|x64.Build.0 = Debug|Any CPU
{2CEEB42C-BE70-4D2C-811F-17648FB742F5}.Debug|x86.ActiveCfg = Debug|Any CPU
{2CEEB42C-BE70-4D2C-811F-17648FB742F5}.Debug|x86.Build.0 = Debug|Any CPU
{2CEEB42C-BE70-4D2C-811F-17648FB742F5}.Debug|x64.ActiveCfg = Debug|x64
{2CEEB42C-BE70-4D2C-811F-17648FB742F5}.Debug|x64.Build.0 = Debug|x64
{2CEEB42C-BE70-4D2C-811F-17648FB742F5}.Debug|x86.ActiveCfg = Debug|x86
{2CEEB42C-BE70-4D2C-811F-17648FB742F5}.Debug|x86.Build.0 = Debug|x86
{2CEEB42C-BE70-4D2C-811F-17648FB742F5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2CEEB42C-BE70-4D2C-811F-17648FB742F5}.Release|Any CPU.Build.0 = Release|Any CPU
{2CEEB42C-BE70-4D2C-811F-17648FB742F5}.Release|x64.ActiveCfg = Release|Any CPU
{2CEEB42C-BE70-4D2C-811F-17648FB742F5}.Release|x64.Build.0 = Release|Any CPU
{2CEEB42C-BE70-4D2C-811F-17648FB742F5}.Release|x86.ActiveCfg = Release|Any CPU
{2CEEB42C-BE70-4D2C-811F-17648FB742F5}.Release|x86.Build.0 = Release|Any CPU
{2CEEB42C-BE70-4D2C-811F-17648FB742F5}.Release|x64.ActiveCfg = Release|x64
{2CEEB42C-BE70-4D2C-811F-17648FB742F5}.Release|x64.Build.0 = Release|x64
{2CEEB42C-BE70-4D2C-811F-17648FB742F5}.Release|x86.ActiveCfg = Release|x86
{2CEEB42C-BE70-4D2C-811F-17648FB742F5}.Release|x86.Build.0 = Release|x86
{962490FD-54E1-4062-87F0-5676407F33BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{962490FD-54E1-4062-87F0-5676407F33BE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{962490FD-54E1-4062-87F0-5676407F33BE}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{962490FD-54E1-4062-87F0-5676407F33BE}.Debug|x64.ActiveCfg = Debug|x64
{962490FD-54E1-4062-87F0-5676407F33BE}.Debug|x64.Build.0 = Debug|x64
{962490FD-54E1-4062-87F0-5676407F33BE}.Debug|x64.Deploy.0 = Debug|x64
{962490FD-54E1-4062-87F0-5676407F33BE}.Debug|x86.ActiveCfg = Debug|x86
{962490FD-54E1-4062-87F0-5676407F33BE}.Debug|x86.Build.0 = Debug|x86
{962490FD-54E1-4062-87F0-5676407F33BE}.Debug|x86.Deploy.0 = Debug|x86
{962490FD-54E1-4062-87F0-5676407F33BE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{962490FD-54E1-4062-87F0-5676407F33BE}.Release|Any CPU.Build.0 = Release|Any CPU
{962490FD-54E1-4062-87F0-5676407F33BE}.Release|Any CPU.Deploy.0 = Release|Any CPU
{962490FD-54E1-4062-87F0-5676407F33BE}.Release|x64.ActiveCfg = Release|x64
{962490FD-54E1-4062-87F0-5676407F33BE}.Release|x64.Build.0 = Release|x64
{962490FD-54E1-4062-87F0-5676407F33BE}.Release|x64.Deploy.0 = Release|x64
{962490FD-54E1-4062-87F0-5676407F33BE}.Release|x86.ActiveCfg = Release|x86
{962490FD-54E1-4062-87F0-5676407F33BE}.Release|x86.Build.0 = Release|x86
{962490FD-54E1-4062-87F0-5676407F33BE}.Release|x86.Deploy.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -213,6 +233,7 @@ Global
{FC689594-30C9-45D2-B8DB-7079E752984B} = {BC2545B1-7D32-4DBC-BA36-C49AF2536B82}
{2CEEB42C-BE70-4D2C-811F-17648FB742F5} = {3F563803-8BCB-4477-89CF-91167A8F887C}
{7EEAAFF3-9F51-477B-B6C5-1019737A779A} = {CBC604E8-02F7-46EF-A530-B4FDAF7EF0E6}
{962490FD-54E1-4062-87F0-5676407F33BE} = {3F563803-8BCB-4477-89CF-91167A8F887C}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B5CEF6C8-2885-432D-9D8C-8EDBCEB7AA2C}
Expand Down

0 comments on commit 005d79c

Please sign in to comment.