Přidání nového projektu - pokus o explorer
No files matched your search
@@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Application
|
||||||
|
x:Class="winui_learning_2.App"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:local="using:winui_learning_2">
|
||||||
|
<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>
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
using Microsoft.UI.Xaml;
|
||||||
|
|
||||||
|
// To learn more about WinUI, the WinUI project structure,
|
||||||
|
// and more about our project templates, see: http://aka.ms/winui-project-info.
|
||||||
|
|
||||||
|
namespace winui_learning_2
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Provides application-specific behavior to supplement the default Application class.
|
||||||
|
/// </summary>
|
||||||
|
public partial class App : Application
|
||||||
|
{
|
||||||
|
private Window? _window;
|
||||||
|
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Invoked when the application is launched.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="args">Details about the launch request and process.</param>
|
||||||
|
protected override void OnLaunched(LaunchActivatedEventArgs args)
|
||||||
|
{
|
||||||
|
_window = new MainWindow();
|
||||||
|
_window.Activate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
After Width: | Height: | Size: 432 B |
|
After Width: | Height: | Size: 5.2 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 637 B |
|
After Width: | Height: | Size: 283 B |
|
After Width: | Height: | Size: 456 B |
|
After Width: | Height: | Size: 2.0 KiB |
@@ -0,0 +1,31 @@
|
|||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
|
||||||
|
namespace winui_learning_2.Helpers;
|
||||||
|
|
||||||
|
public static class DashboardFormatting
|
||||||
|
{
|
||||||
|
public static readonly CultureInfo CzechCulture = CultureInfo.GetCultureInfo("cs-CZ");
|
||||||
|
|
||||||
|
public static string CategoryLabel(string category) => category switch
|
||||||
|
{
|
||||||
|
"win" => "Výhra",
|
||||||
|
"loss" => "Prohra",
|
||||||
|
"bet" => "Výzva",
|
||||||
|
"payment" => "Platba",
|
||||||
|
"team" => "Tým",
|
||||||
|
_ => "Jiné"
|
||||||
|
};
|
||||||
|
|
||||||
|
public static string FormatCount(int value) =>
|
||||||
|
value.ToString("N0", CzechCulture);
|
||||||
|
|
||||||
|
public static string FormatCoins(decimal value) =>
|
||||||
|
$"{value.ToString("N2", CzechCulture)} NC";
|
||||||
|
|
||||||
|
public static string FormatDateTime(DateTime value) =>
|
||||||
|
value.ToString("d. M. yyyy HH:mm", CzechCulture);
|
||||||
|
|
||||||
|
public static string FormatIntroDateTime() =>
|
||||||
|
DateTime.Now.ToString("dddd d. MMMM yyyy, HH:mm", CzechCulture);
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Window
|
||||||
|
x:Class="winui_learning_2.MainWindow"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:views="using:winui_learning_2.Views"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="Nodplay">
|
||||||
|
|
||||||
|
<Window.SystemBackdrop>
|
||||||
|
<MicaBackdrop Kind="Base"/>
|
||||||
|
</Window.SystemBackdrop>
|
||||||
|
|
||||||
|
<Grid>
|
||||||
|
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<!-- Title bar -->
|
||||||
|
<RowDefinition Height="Auto"></RowDefinition>
|
||||||
|
|
||||||
|
<!-- Kontent aplikace -->
|
||||||
|
<RowDefinition Height="*"></RowDefinition>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<TitleBar x:Name="AppTitleBar"
|
||||||
|
Title="Nodplay ADMIN"
|
||||||
|
IsBackButtonVisible="True"
|
||||||
|
IsBackButtonEnabled="{x:Bind rootFrame.CanGoBack, Mode=OneWay}"
|
||||||
|
BackRequested="AppTitleBar_BackRequested">
|
||||||
|
<TitleBar.IconSource>
|
||||||
|
<FontIconSource Glyph=""/>
|
||||||
|
</TitleBar.IconSource>
|
||||||
|
</TitleBar>
|
||||||
|
|
||||||
|
<Frame x:Name="rootFrame" Grid.Row="1"/>
|
||||||
|
<!-- SourcePageType="views:AllNotesPage"/> -->
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
using Microsoft.UI.Xaml;
|
||||||
|
using TitleBar = Microsoft.UI.Xaml.Controls.TitleBar;
|
||||||
|
using winui_learning_2.Services;
|
||||||
|
using winui_learning_2.Views;
|
||||||
|
|
||||||
|
namespace winui_learning_2;
|
||||||
|
|
||||||
|
public sealed partial class MainWindow : Window
|
||||||
|
{
|
||||||
|
public MainWindow()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
ExtendsContentIntoTitleBar = true;
|
||||||
|
SetTitleBar(AppTitleBar);
|
||||||
|
|
||||||
|
if (AuthSession.IsAuthenticated)
|
||||||
|
{
|
||||||
|
rootFrame.Navigate(typeof(HomePage));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rootFrame.Navigate(typeof(LoginPage));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AppTitleBar_BackRequested(TitleBar titleBar, object args)
|
||||||
|
{
|
||||||
|
if (rootFrame.CanGoBack)
|
||||||
|
{
|
||||||
|
rootFrame.GoBack();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
using System;
|
||||||
|
using winui_learning_2.Helpers;
|
||||||
|
using Windows.UI;
|
||||||
|
|
||||||
|
namespace winui_learning_2.Models;
|
||||||
|
|
||||||
|
public class ActivityDisplayItem
|
||||||
|
{
|
||||||
|
public string Username { get; init; } = string.Empty;
|
||||||
|
public string Action { get; init; } = string.Empty;
|
||||||
|
public string CategoryLabel { get; init; } = string.Empty;
|
||||||
|
public Color CategoryColor { get; init; }
|
||||||
|
public string TimestampText { get; init; } = string.Empty;
|
||||||
|
|
||||||
|
public static ActivityDisplayItem From(DashboardActivity activity) => new()
|
||||||
|
{
|
||||||
|
Username = activity.Username,
|
||||||
|
Action = activity.Action,
|
||||||
|
CategoryLabel = DashboardFormatting.CategoryLabel(activity.Category),
|
||||||
|
CategoryColor = GetCategoryColor(activity.Category),
|
||||||
|
TimestampText = DashboardFormatting.FormatDateTime(activity.Timestamp)
|
||||||
|
};
|
||||||
|
|
||||||
|
private static Color GetCategoryColor(string category) => category switch
|
||||||
|
{
|
||||||
|
"win" => Color.FromArgb(255, 25, 135, 84),
|
||||||
|
"loss" => Color.FromArgb(255, 220, 53, 69),
|
||||||
|
"bet" => Color.FromArgb(255, 255, 193, 7),
|
||||||
|
"payment" => Color.FromArgb(255, 13, 202, 240),
|
||||||
|
"team" => Color.FromArgb(255, 108, 117, 125),
|
||||||
|
_ => Color.FromArgb(255, 33, 37, 41)
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace winui_learning_2.Models;
|
||||||
|
|
||||||
|
public class DashBoardViewModel
|
||||||
|
{
|
||||||
|
public int TotalUsers { get; set; }
|
||||||
|
public int ActiveChallenges { get; set; }
|
||||||
|
public int RegisteredGames { get; set; }
|
||||||
|
public decimal TotalNodCoins { get; set; }
|
||||||
|
public decimal ProfitNc { get; set; }
|
||||||
|
public int ActivityPage { get; set; }
|
||||||
|
public int ActivityMaxPages { get; set; }
|
||||||
|
public int TotalActivities { get; set; }
|
||||||
|
public List<DashboardActivity> RecentActivities { get; set; } = [];
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace winui_learning_2.Models;
|
||||||
|
|
||||||
|
public class DashboardActivity
|
||||||
|
{
|
||||||
|
public int? UserId { get; set; }
|
||||||
|
public string Username { get; set; } = string.Empty;
|
||||||
|
public string Action { get; set; } = string.Empty;
|
||||||
|
public string Category { get; set; } = string.Empty;
|
||||||
|
public DateTime Timestamp { get; set; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace winui_learning_2.Models;
|
||||||
|
|
||||||
|
public class LoginResponse
|
||||||
|
{
|
||||||
|
[JsonPropertyName("token")]
|
||||||
|
public string? Token { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("accessToken")]
|
||||||
|
public string? AccessToken { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("access_token")]
|
||||||
|
public string? AccessTokenSnake { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("jwtToken")]
|
||||||
|
public string? JwtToken { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("jwt")]
|
||||||
|
public string? Jwt { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("username")]
|
||||||
|
public string? Username { get; set; }
|
||||||
|
|
||||||
|
public string? GetToken() =>
|
||||||
|
Token ?? AccessToken ?? AccessTokenSnake ?? JwtToken ?? Jwt;
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace winui_learning_2.Models;
|
||||||
|
|
||||||
|
public class UserLoginDto
|
||||||
|
{
|
||||||
|
[JsonPropertyName("username")]
|
||||||
|
public string Username { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[JsonPropertyName("password")]
|
||||||
|
public string Password { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
<?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"
|
||||||
|
xmlns:systemai="http://schemas.microsoft.com/appx/manifest/systemai/windows10"
|
||||||
|
IgnorableNamespaces="uap rescap systemai">
|
||||||
|
|
||||||
|
<Identity
|
||||||
|
Name="b90563be-4ff9-4ffd-8b34-33bc5aa9cb21"
|
||||||
|
Publisher="CN=matej"
|
||||||
|
Version="1.0.0.0" />
|
||||||
|
|
||||||
|
<mp:PhoneIdentity PhoneProductId="b90563be-4ff9-4ffd-8b34-33bc5aa9cb21" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
|
||||||
|
|
||||||
|
<Properties>
|
||||||
|
<DisplayName>winui-learning</DisplayName>
|
||||||
|
<PublisherDisplayName>matej</PublisherDisplayName>
|
||||||
|
<Logo>Assets\StoreLogo.png</Logo>
|
||||||
|
</Properties>
|
||||||
|
|
||||||
|
<Dependencies>
|
||||||
|
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.17763.0" MaxVersionTested="10.0.26226.0" />
|
||||||
|
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.17763.0" MaxVersionTested="10.0.26226.0" />
|
||||||
|
</Dependencies>
|
||||||
|
|
||||||
|
<Resources>
|
||||||
|
<Resource Language="x-generate"/>
|
||||||
|
</Resources>
|
||||||
|
|
||||||
|
<Applications>
|
||||||
|
<Application Id="App"
|
||||||
|
Executable="$targetnametoken$.exe"
|
||||||
|
EntryPoint="$targetentrypoint$">
|
||||||
|
<uap:VisualElements
|
||||||
|
DisplayName="winui-learning"
|
||||||
|
Description="winui-learning"
|
||||||
|
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>
|
||||||
|
<Capability Name="internetClient" />
|
||||||
|
<rescap:Capability Name="runFullTrust" />
|
||||||
|
<systemai:Capability Name="systemAIModels"/>
|
||||||
|
</Capabilities>
|
||||||
|
</Package>
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"profiles": {
|
||||||
|
"winui-learning (Package)": {
|
||||||
|
"commandName": "MsixPackage"
|
||||||
|
},
|
||||||
|
"winui-learning (Unpackaged)": {
|
||||||
|
"commandName": "Project"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
namespace winui_learning_2.Services;
|
||||||
|
|
||||||
|
public static class ApiConstants
|
||||||
|
{
|
||||||
|
public const string BaseUrl = "https://api.nodplay.cz";
|
||||||
|
public const string LoginPath = "/api/users/authenticate";
|
||||||
|
public const string AdminDashboardPath = "/api/admin/dashboard";
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
namespace winui_learning_2.Services;
|
||||||
|
|
||||||
|
public static class AuthSession
|
||||||
|
{
|
||||||
|
public static string? Token { get; private set; }
|
||||||
|
public static string? Username { get; private set; }
|
||||||
|
|
||||||
|
public static bool IsAuthenticated => !string.IsNullOrEmpty(Token);
|
||||||
|
|
||||||
|
public static void SignIn(string username, string? token)
|
||||||
|
{
|
||||||
|
Username = username;
|
||||||
|
Token = token;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void SignOut()
|
||||||
|
{
|
||||||
|
Username = null;
|
||||||
|
Token = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using System.Threading.Tasks;
|
||||||
|
using winui_learning_2.Models;
|
||||||
|
|
||||||
|
namespace winui_learning_2.Services;
|
||||||
|
|
||||||
|
public class NodplayAdminService
|
||||||
|
{
|
||||||
|
private readonly NodplayApiClient _apiClient = new();
|
||||||
|
|
||||||
|
public Task<DashBoardViewModel?> GetDashboardAsync(int page = 1) =>
|
||||||
|
_apiClient.GetAsync<DashBoardViewModel>($"{ApiConstants.AdminDashboardPath}?page={page}");
|
||||||
|
}
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
using System;
|
||||||
|
using System.Net.Http;
|
||||||
|
using System.Net.Http.Headers;
|
||||||
|
using System.Text.Json;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace winui_learning_2.Services;
|
||||||
|
|
||||||
|
public class NodplayApiClient
|
||||||
|
{
|
||||||
|
private static readonly JsonSerializerOptions JsonOptions = new()
|
||||||
|
{
|
||||||
|
PropertyNameCaseInsensitive = true
|
||||||
|
};
|
||||||
|
|
||||||
|
private readonly HttpClient _httpClient = new()
|
||||||
|
{
|
||||||
|
BaseAddress = new Uri(ApiConstants.BaseUrl)
|
||||||
|
};
|
||||||
|
|
||||||
|
public async Task<T?> GetAsync<T>(string path)
|
||||||
|
{
|
||||||
|
using var request = CreateRequest(HttpMethod.Get, path);
|
||||||
|
using var response = await _httpClient.SendAsync(request);
|
||||||
|
|
||||||
|
if (!response.IsSuccessStatusCode)
|
||||||
|
{
|
||||||
|
var body = await response.Content.ReadAsStringAsync();
|
||||||
|
throw new NodplayApiException((int)response.StatusCode, body);
|
||||||
|
}
|
||||||
|
|
||||||
|
var json = await response.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(json))
|
||||||
|
{
|
||||||
|
return default;
|
||||||
|
}
|
||||||
|
|
||||||
|
return JsonSerializer.Deserialize<T>(json, JsonOptions);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static HttpRequestMessage CreateRequest(HttpMethod method, string path)
|
||||||
|
{
|
||||||
|
var request = new HttpRequestMessage(method, path);
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(AuthSession.Token))
|
||||||
|
{
|
||||||
|
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", AuthSession.Token);
|
||||||
|
}
|
||||||
|
|
||||||
|
return request;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class NodplayApiException : Exception
|
||||||
|
{
|
||||||
|
public int StatusCode { get; }
|
||||||
|
|
||||||
|
public NodplayApiException(int statusCode, string? body)
|
||||||
|
: base(string.IsNullOrWhiteSpace(body)
|
||||||
|
? $"API request failed ({statusCode})."
|
||||||
|
: body)
|
||||||
|
{
|
||||||
|
StatusCode = statusCode;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
using System;
|
||||||
|
using System.Net.Http;
|
||||||
|
using System.Net.Http.Json;
|
||||||
|
using System.Text.Json;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using winui_learning_2.Models;
|
||||||
|
|
||||||
|
namespace winui_learning_2.Services;
|
||||||
|
|
||||||
|
public class NodplayAuthService
|
||||||
|
{
|
||||||
|
private static readonly JsonSerializerOptions JsonOptions = new()
|
||||||
|
{
|
||||||
|
PropertyNameCaseInsensitive = true
|
||||||
|
};
|
||||||
|
|
||||||
|
private readonly HttpClient _httpClient = new()
|
||||||
|
{
|
||||||
|
BaseAddress = new Uri(ApiConstants.BaseUrl)
|
||||||
|
};
|
||||||
|
|
||||||
|
public async Task<LoginResult> LoginAsync(string username, string password)
|
||||||
|
{
|
||||||
|
var request = new UserLoginDto
|
||||||
|
{
|
||||||
|
Username = username,
|
||||||
|
Password = password
|
||||||
|
};
|
||||||
|
|
||||||
|
using var response = await _httpClient.PostAsJsonAsync(ApiConstants.LoginPath, request);
|
||||||
|
|
||||||
|
if (response.IsSuccessStatusCode)
|
||||||
|
{
|
||||||
|
var body = await response.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(body))
|
||||||
|
{
|
||||||
|
return LoginResult.Success(username, token: null);
|
||||||
|
}
|
||||||
|
|
||||||
|
var loginResponse = JsonSerializer.Deserialize<LoginResponse>(body, JsonOptions);
|
||||||
|
return LoginResult.Success(
|
||||||
|
loginResponse?.Username ?? username,
|
||||||
|
loginResponse?.GetToken());
|
||||||
|
}
|
||||||
|
|
||||||
|
var errorBody = await response.Content.ReadAsStringAsync();
|
||||||
|
var message = string.IsNullOrWhiteSpace(errorBody)
|
||||||
|
? $"Login failed ({(int)response.StatusCode})."
|
||||||
|
: errorBody;
|
||||||
|
|
||||||
|
return LoginResult.Failure(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public readonly record struct LoginResult(bool IsSuccess, string? Username, string? Token, string? ErrorMessage)
|
||||||
|
{
|
||||||
|
public static LoginResult Success(string username, string? token) =>
|
||||||
|
new(true, username, token, null);
|
||||||
|
|
||||||
|
public static LoginResult Failure(string message) =>
|
||||||
|
new(false, null, null, message);
|
||||||
|
}
|
||||||
@@ -0,0 +1,261 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Page
|
||||||
|
x:Class="winui_learning_2.Views.HomePage"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:models="using:winui_learning_2.Models"
|
||||||
|
mc:Ignorable="d">
|
||||||
|
|
||||||
|
<Page.Resources>
|
||||||
|
<Style x:Key="DashboardStatCardStyle" TargetType="Border">
|
||||||
|
<Setter Property="Width" Value="180"/>
|
||||||
|
<Setter Property="Padding" Value="16"/>
|
||||||
|
<Setter Property="CornerRadius" Value="8"/>
|
||||||
|
<Setter Property="Background" Value="{ThemeResource CardBackgroundFillColorDefaultBrush}"/>
|
||||||
|
<Setter Property="BorderBrush" Value="{ThemeResource CardStrokeColorDefaultBrush}"/>
|
||||||
|
<Setter Property="BorderThickness" Value="1"/>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style x:Key="DashboardStatNumberStyle" TargetType="TextBlock">
|
||||||
|
<Setter Property="FontSize" Value="24"/>
|
||||||
|
<Setter Property="FontWeight" Value="SemiBold"/>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style x:Key="DashboardStatTitleStyle" TargetType="TextBlock">
|
||||||
|
<Setter Property="FontSize" Value="13"/>
|
||||||
|
<Setter Property="Foreground" Value="{ThemeResource TextFillColorSecondaryBrush}"/>
|
||||||
|
<Setter Property="TextWrapping" Value="Wrap"/>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style x:Key="DashboardPanelStyle" TargetType="Border">
|
||||||
|
<Setter Property="Padding" Value="16"/>
|
||||||
|
<Setter Property="CornerRadius" Value="8"/>
|
||||||
|
<Setter Property="Background" Value="{ThemeResource CardBackgroundFillColorDefaultBrush}"/>
|
||||||
|
<Setter Property="BorderBrush" Value="{ThemeResource CardStrokeColorDefaultBrush}"/>
|
||||||
|
<Setter Property="BorderThickness" Value="1"/>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<DataTemplate x:Key="ActivityRowTemplate" x:DataType="models:ActivityDisplayItem">
|
||||||
|
<Grid Padding="0,10" ColumnSpacing="12">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="1.2*"/>
|
||||||
|
<ColumnDefinition Width="2*"/>
|
||||||
|
<ColumnDefinition Width="0.8*"/>
|
||||||
|
<ColumnDefinition Width="1*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<TextBlock Grid.Column="0"
|
||||||
|
Text="{x:Bind Username}"
|
||||||
|
VerticalAlignment="Center"/>
|
||||||
|
|
||||||
|
<TextBlock Grid.Column="1"
|
||||||
|
Text="{x:Bind Action}"
|
||||||
|
TextWrapping="Wrap"
|
||||||
|
VerticalAlignment="Center"/>
|
||||||
|
|
||||||
|
<Border Grid.Column="2"
|
||||||
|
Padding="8,4"
|
||||||
|
CornerRadius="4"
|
||||||
|
HorizontalAlignment="Left"
|
||||||
|
VerticalAlignment="Center">
|
||||||
|
<Border.Background>
|
||||||
|
<SolidColorBrush Color="{x:Bind CategoryColor}"/>
|
||||||
|
</Border.Background>
|
||||||
|
<TextBlock Text="{x:Bind CategoryLabel}"
|
||||||
|
FontSize="12"
|
||||||
|
Foreground="White"/>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<TextBlock Grid.Column="3"
|
||||||
|
Text="{x:Bind TimestampText}"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Foreground="{ThemeResource TextFillColorSecondaryBrush}"/>
|
||||||
|
</Grid>
|
||||||
|
</DataTemplate>
|
||||||
|
</Page.Resources>
|
||||||
|
|
||||||
|
<Grid>
|
||||||
|
<ScrollViewer x:Name="DashboardScrollViewer">
|
||||||
|
<StackPanel Padding="24" Spacing="20">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<StackPanel Spacing="4">
|
||||||
|
<TextBlock Text="Dashboard"
|
||||||
|
Style="{ThemeResource TitleLargeTextBlockStyle}"/>
|
||||||
|
<TextBlock x:Name="IntroText"
|
||||||
|
Style="{ThemeResource BodyTextBlockStyle}"
|
||||||
|
Foreground="{ThemeResource TextFillColorSecondaryBrush}"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<Button Grid.Column="1"
|
||||||
|
Content="Odhlásit se"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Click="SignOutButton_Click"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<ScrollViewer HorizontalScrollBarVisibility="Auto"
|
||||||
|
HorizontalScrollMode="Auto"
|
||||||
|
VerticalScrollBarVisibility="Disabled">
|
||||||
|
<StackPanel Orientation="Horizontal" Spacing="12">
|
||||||
|
<Border x:Name="UsersStatCard" Style="{StaticResource DashboardStatCardStyle}">
|
||||||
|
<StackPanel Spacing="8">
|
||||||
|
<FontIcon Glyph="" FontSize="20"/>
|
||||||
|
<TextBlock x:Name="TotalUsersText" Style="{StaticResource DashboardStatNumberStyle}"/>
|
||||||
|
<TextBlock Text="Celkem uživatelů" Style="{StaticResource DashboardStatTitleStyle}"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<Border x:Name="ChallengesStatCard" Style="{StaticResource DashboardStatCardStyle}">
|
||||||
|
<StackPanel Spacing="8">
|
||||||
|
<FontIcon Glyph="" FontSize="20"/>
|
||||||
|
<TextBlock x:Name="ActiveChallengesText" Style="{StaticResource DashboardStatNumberStyle}"/>
|
||||||
|
<TextBlock Text="Výzvy v systému" Style="{StaticResource DashboardStatTitleStyle}"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<Border x:Name="GamesStatCard" Style="{StaticResource DashboardStatCardStyle}">
|
||||||
|
<StackPanel Spacing="8">
|
||||||
|
<FontIcon Glyph="" FontSize="20"/>
|
||||||
|
<TextBlock x:Name="RegisteredGamesText" Style="{StaticResource DashboardStatNumberStyle}"/>
|
||||||
|
<TextBlock Text="Registrované hry" Style="{StaticResource DashboardStatTitleStyle}"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<Border Style="{StaticResource DashboardStatCardStyle}">
|
||||||
|
<StackPanel Spacing="8">
|
||||||
|
<FontIcon Glyph="" FontSize="20"/>
|
||||||
|
<TextBlock x:Name="TotalNodCoinsText" Style="{StaticResource DashboardStatNumberStyle}"/>
|
||||||
|
<TextBlock Text="NodCoiny v oběhu" Style="{StaticResource DashboardStatTitleStyle}"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<Border Style="{StaticResource DashboardStatCardStyle}">
|
||||||
|
<StackPanel Spacing="8">
|
||||||
|
<FontIcon Glyph="" FontSize="20"/>
|
||||||
|
<TextBlock x:Name="ProfitNcText" Style="{StaticResource DashboardStatNumberStyle}"/>
|
||||||
|
<TextBlock Text="Poplatky z proher" Style="{StaticResource DashboardStatTitleStyle}"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
</StackPanel>
|
||||||
|
</ScrollViewer>
|
||||||
|
|
||||||
|
<Grid ColumnSpacing="16">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="2*"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<Border Style="{StaticResource DashboardPanelStyle}">
|
||||||
|
<StackPanel Spacing="12">
|
||||||
|
<TextBlock x:Name="ActivityTitleText"
|
||||||
|
Style="{ThemeResource SubtitleTextBlockStyle}"/>
|
||||||
|
|
||||||
|
<Grid Padding="0,0,0,4">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="1.2*"/>
|
||||||
|
<ColumnDefinition Width="2*"/>
|
||||||
|
<ColumnDefinition Width="0.8*"/>
|
||||||
|
<ColumnDefinition Width="1*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Grid.Column="0" Text="Uživatel" FontWeight="SemiBold"/>
|
||||||
|
<TextBlock Grid.Column="1" Text="Akce" FontWeight="SemiBold"/>
|
||||||
|
<TextBlock Grid.Column="2" Text="Typ" FontWeight="SemiBold"/>
|
||||||
|
<TextBlock Grid.Column="3" Text="Datum" FontWeight="SemiBold" HorizontalAlignment="Right"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<ItemsRepeater x:Name="ActivityRepeater"
|
||||||
|
ItemTemplate="{StaticResource ActivityRowTemplate}"/>
|
||||||
|
|
||||||
|
<TextBlock x:Name="EmptyActivityText"
|
||||||
|
Text="Zatím žádná aktivita"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
||||||
|
Visibility="Collapsed"/>
|
||||||
|
|
||||||
|
<StackPanel x:Name="PaginationPanel"
|
||||||
|
Orientation="Horizontal"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
Spacing="8"
|
||||||
|
Visibility="Collapsed">
|
||||||
|
<Button x:Name="PreviousPageButton"
|
||||||
|
Content="Předchozí"
|
||||||
|
Click="PreviousPageButton_Click"/>
|
||||||
|
<TextBlock x:Name="PageInfoText"
|
||||||
|
VerticalAlignment="Center"/>
|
||||||
|
<Button x:Name="NextPageButton"
|
||||||
|
Content="Další"
|
||||||
|
Click="NextPageButton_Click"/>
|
||||||
|
</StackPanel>
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<StackPanel Grid.Column="1" Spacing="16">
|
||||||
|
<Border Style="{StaticResource DashboardPanelStyle}">
|
||||||
|
<StackPanel Spacing="12">
|
||||||
|
<TextBlock Text="Rychlé akce"
|
||||||
|
Style="{ThemeResource SubtitleTextBlockStyle}"/>
|
||||||
|
<StackPanel Spacing="8">
|
||||||
|
<Button Content="Přidat / spravovat hry" HorizontalAlignment="Stretch"/>
|
||||||
|
<Button Content="Spravovat výzvy" HorizontalAlignment="Stretch"/>
|
||||||
|
<Button Content="Spravovat uživatele" HorizontalAlignment="Stretch"/>
|
||||||
|
<Button Content="Aktuality" HorizontalAlignment="Stretch"/>
|
||||||
|
<Button Content="Pravidla" HorizontalAlignment="Stretch"/>
|
||||||
|
</StackPanel>
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<Border Style="{StaticResource DashboardPanelStyle}">
|
||||||
|
<StackPanel Spacing="12">
|
||||||
|
<TextBlock Text="Souhrn"
|
||||||
|
Style="{ThemeResource SubtitleTextBlockStyle}"/>
|
||||||
|
<StackPanel Spacing="8">
|
||||||
|
<Grid>
|
||||||
|
<TextBlock Text="Uživatelé"/>
|
||||||
|
<TextBlock x:Name="SummaryUsersText" HorizontalAlignment="Right" FontWeight="SemiBold"/>
|
||||||
|
</Grid>
|
||||||
|
<Grid>
|
||||||
|
<TextBlock Text="Výzvy"/>
|
||||||
|
<TextBlock x:Name="SummaryChallengesText" HorizontalAlignment="Right" FontWeight="SemiBold"/>
|
||||||
|
</Grid>
|
||||||
|
<Grid>
|
||||||
|
<TextBlock Text="Hry"/>
|
||||||
|
<TextBlock x:Name="SummaryGamesText" HorizontalAlignment="Right" FontWeight="SemiBold"/>
|
||||||
|
</Grid>
|
||||||
|
<Grid>
|
||||||
|
<TextBlock Text="NodCoiny v oběhu"/>
|
||||||
|
<TextBlock x:Name="SummaryNodCoinsText" HorizontalAlignment="Right" FontWeight="SemiBold"/>
|
||||||
|
</Grid>
|
||||||
|
<Grid>
|
||||||
|
<TextBlock Text="Poplatky"/>
|
||||||
|
<TextBlock x:Name="SummaryProfitText" HorizontalAlignment="Right" FontWeight="SemiBold"/>
|
||||||
|
</Grid>
|
||||||
|
</StackPanel>
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</StackPanel>
|
||||||
|
</ScrollViewer>
|
||||||
|
|
||||||
|
<ProgressRing x:Name="LoadingRing"
|
||||||
|
Width="40"
|
||||||
|
Height="40"
|
||||||
|
IsActive="False"
|
||||||
|
Visibility="Collapsed"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
VerticalAlignment="Center"/>
|
||||||
|
|
||||||
|
<InfoBar x:Name="ErrorInfoBar"
|
||||||
|
IsOpen="False"
|
||||||
|
Severity="Error"
|
||||||
|
IsClosable="True"
|
||||||
|
VerticalAlignment="Top"/>
|
||||||
|
</Grid>
|
||||||
|
</Page>
|
||||||
@@ -0,0 +1,141 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.UI.Xaml;
|
||||||
|
using Microsoft.UI.Xaml.Controls;
|
||||||
|
using winui_learning_2.Helpers;
|
||||||
|
using winui_learning_2.Models;
|
||||||
|
using winui_learning_2.Services;
|
||||||
|
|
||||||
|
namespace winui_learning_2.Views;
|
||||||
|
|
||||||
|
public sealed partial class HomePage : Page
|
||||||
|
{
|
||||||
|
private readonly NodplayAdminService _adminService = new();
|
||||||
|
private DashBoardViewModel? _dashboard;
|
||||||
|
private int _currentPage = 1;
|
||||||
|
|
||||||
|
public HomePage()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override async void OnNavigatedTo(Microsoft.UI.Xaml.Navigation.NavigationEventArgs e)
|
||||||
|
{
|
||||||
|
base.OnNavigatedTo(e);
|
||||||
|
IntroText.Text = $"Přehled platformy Nodplay · {DashboardFormatting.FormatIntroDateTime()}";
|
||||||
|
await LoadDashboardAsync(_currentPage);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task LoadDashboardAsync(int page)
|
||||||
|
{
|
||||||
|
SetLoading(true);
|
||||||
|
HideError();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_dashboard = await _adminService.GetDashboardAsync(page);
|
||||||
|
|
||||||
|
if (_dashboard == null)
|
||||||
|
{
|
||||||
|
ShowError("Dashboard data nebyla vrácena.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_currentPage = _dashboard.ActivityPage > 0 ? _dashboard.ActivityPage : page;
|
||||||
|
BindDashboard(_dashboard);
|
||||||
|
}
|
||||||
|
catch (NodplayApiException ex) when (ex.StatusCode is 401 or 403)
|
||||||
|
{
|
||||||
|
AuthSession.SignOut();
|
||||||
|
Frame?.Navigate(typeof(LoginPage));
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
ShowError("Nepodařilo se načíst dashboard. Zkontrolujte připojení a zkuste to znovu.");
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
SetLoading(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BindDashboard(DashBoardViewModel dashboard)
|
||||||
|
{
|
||||||
|
TotalUsersText.Text = DashboardFormatting.FormatCount(dashboard.TotalUsers);
|
||||||
|
ActiveChallengesText.Text = DashboardFormatting.FormatCount(dashboard.ActiveChallenges);
|
||||||
|
RegisteredGamesText.Text = DashboardFormatting.FormatCount(dashboard.RegisteredGames);
|
||||||
|
TotalNodCoinsText.Text = DashboardFormatting.FormatCoins(dashboard.TotalNodCoins);
|
||||||
|
ProfitNcText.Text = DashboardFormatting.FormatCoins(dashboard.ProfitNc);
|
||||||
|
|
||||||
|
SummaryUsersText.Text = DashboardFormatting.FormatCount(dashboard.TotalUsers);
|
||||||
|
SummaryChallengesText.Text = DashboardFormatting.FormatCount(dashboard.ActiveChallenges);
|
||||||
|
SummaryGamesText.Text = DashboardFormatting.FormatCount(dashboard.RegisteredGames);
|
||||||
|
SummaryNodCoinsText.Text = DashboardFormatting.FormatCoins(dashboard.TotalNodCoins);
|
||||||
|
SummaryProfitText.Text = DashboardFormatting.FormatCoins(dashboard.ProfitNc);
|
||||||
|
|
||||||
|
ActivityTitleText.Text =
|
||||||
|
$"Aktivita ({DashboardFormatting.FormatCount(dashboard.TotalActivities)})";
|
||||||
|
|
||||||
|
var activities = dashboard.RecentActivities?
|
||||||
|
.Select(ActivityDisplayItem.From)
|
||||||
|
.ToList() ?? new List<ActivityDisplayItem>();
|
||||||
|
|
||||||
|
ActivityRepeater.ItemsSource = activities;
|
||||||
|
EmptyActivityText.Visibility = activities.Count == 0 ? Visibility.Visible : Visibility.Collapsed;
|
||||||
|
|
||||||
|
var maxPages = Math.Max(dashboard.ActivityMaxPages, 1);
|
||||||
|
var showPagination = dashboard.TotalActivities > 0;
|
||||||
|
PaginationPanel.Visibility = showPagination ? Visibility.Visible : Visibility.Collapsed;
|
||||||
|
|
||||||
|
if (showPagination)
|
||||||
|
{
|
||||||
|
PageInfoText.Text = $"Strana {_currentPage} z {maxPages}";
|
||||||
|
PreviousPageButton.IsEnabled = _currentPage > 1;
|
||||||
|
NextPageButton.IsEnabled = _currentPage < maxPages;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void PreviousPageButton_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (_currentPage > 1)
|
||||||
|
{
|
||||||
|
await LoadDashboardAsync(_currentPage - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void NextPageButton_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
var maxPages = Math.Max(_dashboard?.ActivityMaxPages ?? 1, 1);
|
||||||
|
|
||||||
|
if (_currentPage < maxPages)
|
||||||
|
{
|
||||||
|
await LoadDashboardAsync(_currentPage + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SignOutButton_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
AuthSession.SignOut();
|
||||||
|
Frame?.Navigate(typeof(LoginPage));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetLoading(bool isLoading)
|
||||||
|
{
|
||||||
|
LoadingRing.IsActive = isLoading;
|
||||||
|
LoadingRing.Visibility = isLoading ? Visibility.Visible : Visibility.Collapsed;
|
||||||
|
DashboardScrollViewer.IsEnabled = !isLoading;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ShowError(string message)
|
||||||
|
{
|
||||||
|
ErrorInfoBar.Message = message;
|
||||||
|
ErrorInfoBar.IsOpen = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HideError()
|
||||||
|
{
|
||||||
|
ErrorInfoBar.IsOpen = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Page
|
||||||
|
x:Class="winui_learning_2.Views.LoginPage"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
mc:Ignorable="d">
|
||||||
|
|
||||||
|
<Grid Padding="32">
|
||||||
|
<StackPanel VerticalAlignment="Center"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
Spacing="12"
|
||||||
|
MaxWidth="360"
|
||||||
|
Width="360">
|
||||||
|
<TextBlock Text="Nodplay"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
Style="{ThemeResource TitleLargeTextBlockStyle}"/>
|
||||||
|
<TextBlock Text="Sign in to continue"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
Style="{ThemeResource BodyTextBlockStyle}"
|
||||||
|
Foreground="{ThemeResource TextFillColorSecondaryBrush}"/>
|
||||||
|
|
||||||
|
<TextBox x:Name="UsernameBox"
|
||||||
|
Header="Username"
|
||||||
|
PlaceholderText="Username"
|
||||||
|
KeyDown="InputBox_KeyDown"/>
|
||||||
|
|
||||||
|
<PasswordBox x:Name="PasswordBox"
|
||||||
|
Header="Password"
|
||||||
|
PlaceholderText="Password"
|
||||||
|
KeyDown="InputBox_KeyDown"/>
|
||||||
|
|
||||||
|
<TextBlock x:Name="ErrorText"
|
||||||
|
Foreground="{ThemeResource SystemFillColorCriticalBrush}"
|
||||||
|
TextWrapping="Wrap"
|
||||||
|
Visibility="Collapsed"/>
|
||||||
|
|
||||||
|
<Button x:Name="LoginButton"
|
||||||
|
Content="Sign in"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
Click="LoginButton_Click"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<ProgressRing x:Name="LoadingRing"
|
||||||
|
Width="32"
|
||||||
|
Height="32"
|
||||||
|
IsActive="False"
|
||||||
|
Visibility="Collapsed"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
VerticalAlignment="Center"/>
|
||||||
|
</Grid>
|
||||||
|
</Page>
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.UI.Xaml;
|
||||||
|
using Microsoft.UI.Xaml.Controls;
|
||||||
|
using Microsoft.UI.Xaml.Input;
|
||||||
|
using winui_learning_2.Services;
|
||||||
|
|
||||||
|
namespace winui_learning_2.Views;
|
||||||
|
|
||||||
|
public sealed partial class LoginPage : Page
|
||||||
|
{
|
||||||
|
private readonly NodplayAuthService _authService = new();
|
||||||
|
|
||||||
|
public LoginPage()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void LoginButton_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
await TryLoginAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void InputBox_KeyDown(object sender, KeyRoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Key == Windows.System.VirtualKey.Enter)
|
||||||
|
{
|
||||||
|
await TryLoginAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task TryLoginAsync()
|
||||||
|
{
|
||||||
|
ErrorText.Visibility = Visibility.Collapsed;
|
||||||
|
ErrorText.Text = string.Empty;
|
||||||
|
|
||||||
|
var username = UsernameBox.Text.Trim();
|
||||||
|
var password = PasswordBox.Password;
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(username))
|
||||||
|
{
|
||||||
|
ShowError("Username is required.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(password))
|
||||||
|
{
|
||||||
|
ShowError("Password is required.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetLoading(true);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = await _authService.LoginAsync(username, password);
|
||||||
|
|
||||||
|
if (!result.IsSuccess)
|
||||||
|
{
|
||||||
|
ShowError(result.ErrorMessage ?? "Login failed.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
AuthSession.SignIn(result.Username ?? username, result.Token);
|
||||||
|
Frame?.Navigate(typeof(HomePage));
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
ShowError("Could not reach the Nodplay API. Check your connection and try again.");
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
SetLoading(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ShowError(string message)
|
||||||
|
{
|
||||||
|
ErrorText.Text = message;
|
||||||
|
ErrorText.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetLoading(bool isLoading)
|
||||||
|
{
|
||||||
|
LoginButton.IsEnabled = !isLoading;
|
||||||
|
UsernameBox.IsEnabled = !isLoading;
|
||||||
|
PasswordBox.IsEnabled = !isLoading;
|
||||||
|
LoadingRing.IsActive = isLoading;
|
||||||
|
LoadingRing.Visibility = isLoading ? Visibility.Visible : Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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="winui-learning.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>
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<TargetFramework>net8.0-windows10.0.19041.0</TargetFramework>
|
||||||
|
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
|
||||||
|
<RootNamespace>winui_learning_2</RootNamespace>
|
||||||
|
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||||
|
<Platforms>x86;x64;ARM64</Platforms>
|
||||||
|
<RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
|
||||||
|
<PublishProfile>win-$(Platform).pubxml</PublishProfile>
|
||||||
|
<UseWinUI>true</UseWinUI>
|
||||||
|
<WinUISDKReferences>true</WinUISDKReferences>
|
||||||
|
<EnableMsixTooling>true</EnableMsixTooling>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Remove="NotePage.xaml" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<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>
|
||||||
|
<Manifest Include="$(ApplicationManifest)" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.7.250606003" />
|
||||||
|
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.1742" />
|
||||||
|
</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>
|
||||||
|
<Page Update="NotePage.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
</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>
|
||||||
|
|
||||||
|
<!-- Publish Properties -->
|
||||||
|
<PropertyGroup>
|
||||||
|
<PublishReadyToRun Condition="'$(Configuration)' == 'Debug'">False</PublishReadyToRun>
|
||||||
|
<PublishReadyToRun Condition="'$(Configuration)' != 'Debug'">True</PublishReadyToRun>
|
||||||
|
<PublishTrimmed Condition="'$(Configuration)' == 'Debug'">False</PublishTrimmed>
|
||||||
|
<PublishTrimmed Condition="'$(Configuration)' != 'Debug'">True</PublishTrimmed>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Application
|
||||||
|
x:Class="winui_learning_3.App"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:local="using:winui_learning_2">
|
||||||
|
<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>
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
using Microsoft.UI.Xaml;
|
||||||
|
|
||||||
|
// To learn more about WinUI, the WinUI project structure,
|
||||||
|
// and more about our project templates, see: http://aka.ms/winui-project-info.
|
||||||
|
|
||||||
|
namespace winui_learning_3
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Provides application-specific behavior to supplement the default Application class.
|
||||||
|
/// </summary>
|
||||||
|
public partial class App : Application
|
||||||
|
{
|
||||||
|
private Window? _window;
|
||||||
|
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Invoked when the application is launched.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="args">Details about the launch request and process.</param>
|
||||||
|
protected override void OnLaunched(LaunchActivatedEventArgs args)
|
||||||
|
{
|
||||||
|
_window = new MainWindow();
|
||||||
|
_window.Activate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
After Width: | Height: | Size: 432 B |
|
After Width: | Height: | Size: 5.2 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 637 B |
|
After Width: | Height: | Size: 283 B |
|
After Width: | Height: | Size: 456 B |
|
After Width: | Height: | Size: 2.0 KiB |
@@ -0,0 +1,39 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Window
|
||||||
|
x:Class="winui_learning_3.MainWindow"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:views="using:winui_learning_3.Views"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="File Adventurer">
|
||||||
|
|
||||||
|
<Window.SystemBackdrop>
|
||||||
|
<MicaBackdrop Kind="Base"/>
|
||||||
|
</Window.SystemBackdrop>
|
||||||
|
|
||||||
|
<Grid>
|
||||||
|
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<!-- Title bar -->
|
||||||
|
<RowDefinition Height="Auto"></RowDefinition>
|
||||||
|
|
||||||
|
<!-- Kontent aplikace -->
|
||||||
|
<RowDefinition Height="*"></RowDefinition>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<TitleBar x:Name="AppTitleBar"
|
||||||
|
Title="file adventurer"
|
||||||
|
IsBackButtonVisible="True"
|
||||||
|
IsBackButtonEnabled="{x:Bind rootFrame.CanGoBack, Mode=OneWay}"
|
||||||
|
BackRequested="AppTitleBar_BackRequested">
|
||||||
|
<TitleBar.IconSource>
|
||||||
|
<FontIconSource Glyph=""/>
|
||||||
|
</TitleBar.IconSource>
|
||||||
|
</TitleBar>
|
||||||
|
|
||||||
|
<Frame x:Name="rootFrame" Grid.Row="1"/>
|
||||||
|
<!-- SourcePageType="views:AllNotesPage"/> -->
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
using Microsoft.UI.Xaml;
|
||||||
|
using TitleBar = Microsoft.UI.Xaml.Controls.TitleBar;
|
||||||
|
|
||||||
|
namespace winui_learning_3;
|
||||||
|
|
||||||
|
public sealed partial class MainWindow : Window
|
||||||
|
{
|
||||||
|
public MainWindow()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
ExtendsContentIntoTitleBar = true;
|
||||||
|
SetTitleBar(AppTitleBar);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AppTitleBar_BackRequested(TitleBar titleBar, object args)
|
||||||
|
{
|
||||||
|
if (rootFrame.CanGoBack)
|
||||||
|
{
|
||||||
|
rootFrame.GoBack();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
<?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"
|
||||||
|
xmlns:systemai="http://schemas.microsoft.com/appx/manifest/systemai/windows10"
|
||||||
|
IgnorableNamespaces="uap rescap systemai">
|
||||||
|
|
||||||
|
<Identity
|
||||||
|
Name="b90563be-4ff9-4ffd-8b34-33bc5aa9cb21"
|
||||||
|
Publisher="CN=matej"
|
||||||
|
Version="1.0.0.0" />
|
||||||
|
|
||||||
|
<mp:PhoneIdentity PhoneProductId="b90563be-4ff9-4ffd-8b34-33bc5aa9cb21" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
|
||||||
|
|
||||||
|
<Properties>
|
||||||
|
<DisplayName>File Adventurer</DisplayName>
|
||||||
|
<PublisherDisplayName>egmont11</PublisherDisplayName>
|
||||||
|
<Logo>Assets\StoreLogo.png</Logo>
|
||||||
|
</Properties>
|
||||||
|
|
||||||
|
<Dependencies>
|
||||||
|
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.17763.0" MaxVersionTested="10.0.26226.0" />
|
||||||
|
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.17763.0" MaxVersionTested="10.0.26226.0" />
|
||||||
|
</Dependencies>
|
||||||
|
|
||||||
|
<Resources>
|
||||||
|
<Resource Language="x-generate"/>
|
||||||
|
</Resources>
|
||||||
|
|
||||||
|
<Applications>
|
||||||
|
<Application Id="App"
|
||||||
|
Executable="$targetnametoken$.exe"
|
||||||
|
EntryPoint="$targetentrypoint$">
|
||||||
|
<uap:VisualElements
|
||||||
|
DisplayName="File Adventurer"
|
||||||
|
Description="File Adventurer"
|
||||||
|
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>
|
||||||
|
<Capability Name="internetClient" />
|
||||||
|
<rescap:Capability Name="runFullTrust" />
|
||||||
|
<systemai:Capability Name="systemAIModels"/>
|
||||||
|
</Capabilities>
|
||||||
|
</Package>
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"profiles": {
|
||||||
|
"winui-learning (Package)": {
|
||||||
|
"commandName": "MsixPackage"
|
||||||
|
},
|
||||||
|
"winui-learning (Unpackaged)": {
|
||||||
|
"commandName": "Project"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Page
|
||||||
|
x:Class="winui_learning_3.Views.HomePage"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:models="using:winui_learning_3.Models"
|
||||||
|
mc:Ignorable="d">
|
||||||
|
</Page>
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
using Microsoft.UI.Xaml.Controls;
|
||||||
|
|
||||||
|
namespace winui_learning_3.Views;
|
||||||
|
|
||||||
|
public sealed partial class HomePage : Page
|
||||||
|
{
|
||||||
|
public HomePage()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override async void OnNavigatedTo(Microsoft.UI.Xaml.Navigation.NavigationEventArgs e)
|
||||||
|
{
|
||||||
|
base.OnNavigatedTo(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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="file-dventurer.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>
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<TargetFramework>net8.0-windows10.0.19041.0</TargetFramework>
|
||||||
|
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
|
||||||
|
<RootNamespace>winui_learning_3</RootNamespace>
|
||||||
|
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||||
|
<Platforms>x86;x64;ARM64</Platforms>
|
||||||
|
<RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
|
||||||
|
<PublishProfile>win-$(Platform).pubxml</PublishProfile>
|
||||||
|
<UseWinUI>true</UseWinUI>
|
||||||
|
<WinUISDKReferences>true</WinUISDKReferences>
|
||||||
|
<EnableMsixTooling>true</EnableMsixTooling>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Remove="NotePage.xaml" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<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>
|
||||||
|
<Manifest Include="$(ApplicationManifest)" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.WindowsAppSDK" Version="2.5.1" />
|
||||||
|
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.28000.2705" />
|
||||||
|
</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>
|
||||||
|
<Page Update="NotePage.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Helpers\" />
|
||||||
|
<Folder Include="Models\" />
|
||||||
|
<Folder Include="Services\" />
|
||||||
|
</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>
|
||||||
|
|
||||||
|
<!-- Publish Properties -->
|
||||||
|
<PropertyGroup>
|
||||||
|
<PublishReadyToRun Condition="'$(Configuration)' == 'Debug'">False</PublishReadyToRun>
|
||||||
|
<PublishReadyToRun Condition="'$(Configuration)' != 'Debug'">True</PublishReadyToRun>
|
||||||
|
<PublishTrimmed Condition="'$(Configuration)' == 'Debug'">False</PublishTrimmed>
|
||||||
|
<PublishTrimmed Condition="'$(Configuration)' != 'Debug'">True</PublishTrimmed>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
||||||
@@ -4,10 +4,22 @@
|
|||||||
<Platform Name="x64" />
|
<Platform Name="x64" />
|
||||||
<Platform Name="x86" />
|
<Platform Name="x86" />
|
||||||
</Configurations>
|
</Configurations>
|
||||||
|
<Project Path="winui-learning-3/winui-learning-3.csproj">
|
||||||
|
<Platform Solution="*|ARM64" Project="ARM64" />
|
||||||
|
<Platform Solution="*|x64" Project="x64" />
|
||||||
|
<Platform Solution="*|x86" Project="x86" />
|
||||||
|
<Deploy />
|
||||||
|
</Project>
|
||||||
<Project Path="winui-learning/winui-learning.csproj">
|
<Project Path="winui-learning/winui-learning.csproj">
|
||||||
<Platform Solution="*|ARM64" Project="ARM64" />
|
<Platform Solution="*|ARM64" Project="ARM64" />
|
||||||
<Platform Solution="*|x64" Project="x64" />
|
<Platform Solution="*|x64" Project="x64" />
|
||||||
<Platform Solution="*|x86" Project="x86" />
|
<Platform Solution="*|x86" Project="x86" />
|
||||||
<Deploy />
|
<Deploy />
|
||||||
</Project>
|
</Project>
|
||||||
|
<Project Path="winui-learning-2/winui-learning-2.csproj">
|
||||||
|
<Platform Solution="*|ARM64" Project="ARM64" />
|
||||||
|
<Platform Solution="*|x64" Project="x64" />
|
||||||
|
<Platform Solution="*|x86" Project="x86" />
|
||||||
|
<Deploy />
|
||||||
|
</Project>
|
||||||
</Solution>
|
</Solution>
|
||||||