Got Avalonia.Ui working.
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
<!-- Avalonia packages -->
|
||||
<!-- Important: keep version in sync! -->
|
||||
<PackageVersion Include="Avalonia" Version="11.3.10" />
|
||||
<PackageVersion Include="Avalonia.ReactiveUI" Version="11.3.8" />
|
||||
<PackageVersion Include="Avalonia.Themes.Fluent" Version="11.3.10" />
|
||||
<PackageVersion Include="Avalonia.Fonts.Inter" Version="11.3.10" />
|
||||
<PackageVersion Include="Avalonia.Diagnostics" Version="11.3.10" />
|
||||
@@ -17,7 +18,6 @@
|
||||
<PackageVersion Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
||||
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="10.0.2" />
|
||||
<PackageVersion Include="Refit" Version="9.0.2" />
|
||||
<PackageVersion Include="Refit.Newtonsoft.Json" Version="9.0.2" />
|
||||
<PackageVersion Include="Xamarin.AndroidX.Core.SplashScreen" Version="1.0.1.15" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -4,7 +4,7 @@
|
||||
<TargetFramework>net9.0-android</TargetFramework>
|
||||
<SupportedOSPlatformVersion>21</SupportedOSPlatformVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
<ApplicationId>com.CompanyName.gamenight.ui</ApplicationId>
|
||||
<ApplicationId>com.CompanyName.Gamenight.Ui</ApplicationId>
|
||||
<ApplicationVersion>1</ApplicationVersion>
|
||||
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
|
||||
<AndroidPackageFormat>apk</AndroidPackageFormat>
|
||||
@@ -23,6 +23,6 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\gamenight.ui\gamenight.ui.csproj" />
|
||||
<ProjectReference Include="..\Gamenight.Ui\Gamenight.Ui.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@@ -3,10 +3,10 @@ using Android.Content.PM;
|
||||
using Avalonia;
|
||||
using Avalonia.Android;
|
||||
|
||||
namespace gamenight.ui.Android;
|
||||
namespace Gamenight.Ui.Android;
|
||||
|
||||
[Activity(
|
||||
Label = "gamenight.ui.Android",
|
||||
Label = "Gamenight.Ui.Android",
|
||||
Theme = "@style/MyTheme.NoActionBar",
|
||||
Icon = "@drawable/icon",
|
||||
MainLauncher = true,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto">
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<application android:label="gamenight.ui" android:icon="@drawable/Icon" />
|
||||
<application android:label="Gamenight.Ui" android:icon="@drawable/Icon" />
|
||||
</manifest>
|
||||
|
||||
@@ -11,6 +11,6 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\gamenight.ui\gamenight.ui.csproj" />
|
||||
<ProjectReference Include="..\Gamenight.Ui\Gamenight.Ui.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
using System.Threading.Tasks;
|
||||
using Avalonia;
|
||||
using Avalonia.Browser;
|
||||
using gamenight.ui;
|
||||
using Gamenight.Ui;
|
||||
|
||||
internal sealed partial class Program
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"profiles": {
|
||||
"gamenight.ui.Browser": {
|
||||
"Gamenight.Ui.Browser": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>gamenight.ui.Browser</title>
|
||||
<title>Gamenight.Ui.Browser</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="./app.css" />
|
||||
|
||||
@@ -21,6 +21,6 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\gamenight.ui\gamenight.ui.csproj" />
|
||||
<ProjectReference Include="..\Gamenight.Ui\Gamenight.Ui.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
using System;
|
||||
using Avalonia;
|
||||
using Avalonia.ReactiveUI;
|
||||
|
||||
namespace gamenight.ui.Desktop;
|
||||
namespace Gamenight.Ui.Desktop;
|
||||
|
||||
sealed class Program
|
||||
{
|
||||
@@ -17,5 +18,6 @@ sealed class Program
|
||||
=> AppBuilder.Configure<App>()
|
||||
.UsePlatformDetect()
|
||||
.WithInterFont()
|
||||
.LogToTrace();
|
||||
.LogToTrace()
|
||||
.UseReactiveUI();
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<!-- This manifest is used on Windows only.
|
||||
Don't remove it as it might cause problems with window transparency and embedded controls.
|
||||
For more details visit https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests -->
|
||||
<assemblyIdentity version="1.0.0.0" name="gamenight.ui.Desktop"/>
|
||||
<assemblyIdentity version="1.0.0.0" name="Gamenight.Ui.Desktop"/>
|
||||
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
|
||||
@@ -5,7 +5,7 @@ using Avalonia.Controls;
|
||||
using Avalonia.iOS;
|
||||
using Avalonia.Media;
|
||||
|
||||
namespace gamenight.ui.iOS;
|
||||
namespace Gamenight.Ui.iOS;
|
||||
|
||||
// The UIApplicationDelegate for the application. This class is responsible for launching the
|
||||
// User Interface of the application, as well as listening (and optionally responding) to
|
||||
|
||||
@@ -11,6 +11,6 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\gamenight.ui\gamenight.ui.csproj" />
|
||||
<ProjectReference Include="..\Gamenight.Ui\Gamenight.Ui.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>gamenight.ui</string>
|
||||
<string>Gamenight.Ui</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>companyName.gamenight.ui</string>
|
||||
<string>companyName.Gamenight.Ui</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using UIKit;
|
||||
|
||||
namespace gamenight.ui.iOS;
|
||||
namespace Gamenight.Ui.iOS;
|
||||
|
||||
public class Application
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor" />
|
||||
<nil key="highlightedColor" />
|
||||
</label>
|
||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="gamenight.ui" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines"
|
||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Gamenight.Ui" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines"
|
||||
minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="kId-c2-rCX">
|
||||
<rect key="frame" x="20" y="140" width="441" height="43" />
|
||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="36" />
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<Application xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:gamenight.ui"
|
||||
x:Class="gamenight.ui.App"
|
||||
xmlns:local="using:Gamenight.Ui"
|
||||
x:Class="Gamenight.Ui.App"
|
||||
RequestedThemeVariant="Default">
|
||||
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->
|
||||
|
||||
|
||||
@@ -1,22 +1,21 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls.ApplicationLifetimes;
|
||||
using Avalonia.Data.Core;
|
||||
using Avalonia.Data.Core.Plugins;
|
||||
using System.Linq;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using gamenight.ui.ViewModels;
|
||||
using gamenight.ui.Views;
|
||||
using Avalonia.ReactiveUI;
|
||||
using Gamenight.Ui.ViewModels;
|
||||
using Gamenight.Ui.Views;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using gamenight.ui.Services;
|
||||
using Gamenight.Ui.Services;
|
||||
using System;
|
||||
using Refit;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace gamenight.ui;
|
||||
namespace Gamenight.Ui;
|
||||
|
||||
public partial class App : Application
|
||||
{
|
||||
private IServiceProvider? ServiceProvider;
|
||||
private IServiceProvider? ServiceProvider { get; set; }
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -27,13 +26,13 @@ public partial class App : Application
|
||||
{
|
||||
// Register all the services needed for the application to run
|
||||
var collection = new ServiceCollection();
|
||||
var gamenightApi = RestService.For<IGamenightApi>("https://localhost:8080",
|
||||
new RefitSettings {
|
||||
ContentSerializer = new NewtonsoftJsonContentSerializer()
|
||||
}
|
||||
var gamenightApi = RestService.For<IGamenightApi>("http://localhost:8080",
|
||||
new RefitSettings {}
|
||||
);
|
||||
collection.AddSingleton(gamenightApi);
|
||||
collection.AddSingleton<MainViewModel>();
|
||||
collection.AddSingleton<HeaderViewModel>();
|
||||
collection.AddSingleton<SideBarViewModel>();
|
||||
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime)
|
||||
{
|
||||
collection.AddSingleton<MainWindow>();
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia" />
|
||||
<PackageReference Include="Avalonia.ReactiveUI" />
|
||||
<PackageReference Include="Avalonia.Themes.Fluent" />
|
||||
<PackageReference Include="Avalonia.Fonts.Inter" />
|
||||
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
|
||||
@@ -22,6 +23,5 @@
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" />
|
||||
<PackageReference Include="Refit" />
|
||||
<PackageReference Include="Refit.Newtonsoft.Json" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@@ -10,12 +10,13 @@ using System.Threading.Tasks;
|
||||
|
||||
#nullable enable annotations
|
||||
|
||||
namespace gamenight.ui.Services
|
||||
namespace Gamenight.Ui.Services
|
||||
{
|
||||
/// <summary>Gamenight</summary>
|
||||
[System.CodeDom.Compiler.GeneratedCode("Refitter", "1.7.1.0")]
|
||||
public partial interface IGamenightApi
|
||||
{
|
||||
/// <summary>Login a user.</summary>
|
||||
/// <remarks>Submit your credentials to get a JWT-token to use with the rest of the api.</remarks>
|
||||
/// <returns>Example response</returns>
|
||||
/// <exception cref="ApiException">
|
||||
@@ -31,9 +32,10 @@ namespace gamenight.ui.Services
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// </exception>
|
||||
[Get("/token")]
|
||||
Task<Token> TokenGet([Body] Login body);
|
||||
[Post("/token")]
|
||||
Task<Token> Token([Body] Login body);
|
||||
|
||||
/// <summary>Refresh a user token</summary>
|
||||
/// <remarks>Refresh your JWT-token without logging in again.</remarks>
|
||||
/// <returns>Example response</returns>
|
||||
/// <exception cref="ApiException">
|
||||
@@ -49,9 +51,10 @@ namespace gamenight.ui.Services
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// </exception>
|
||||
[Post("/token")]
|
||||
Task<Token> TokenPost();
|
||||
[Post("/refresh_token")]
|
||||
Task<Token> RefreshToken();
|
||||
|
||||
/// <summary>Get all users</summary>
|
||||
/// <returns>List of all Users</returns>
|
||||
/// <exception cref="ApiException">
|
||||
/// Thrown when the request returns a non-success status code:
|
||||
@@ -71,8 +74,9 @@ namespace gamenight.ui.Services
|
||||
/// </list>
|
||||
/// </exception>
|
||||
[Get("/users")]
|
||||
Task<ICollection<User>> Users();
|
||||
Task<ICollection<User>> UsersGet();
|
||||
|
||||
/// <summary>Registers a user into gamenight.</summary>
|
||||
/// <remarks>Create a new user given a registration token and user information, username and email must be unique, and password and password_repeat must match.</remarks>
|
||||
/// <returns>A <see cref="Task"/> that completes when the request is finished.</returns>
|
||||
/// <exception cref="ApiException">
|
||||
@@ -88,10 +92,11 @@ namespace gamenight.ui.Services
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// </exception>
|
||||
[Post("/user")]
|
||||
Task UserPost([Body] Registration body);
|
||||
[Post("/users")]
|
||||
Task UsersPost([Body] Registration body);
|
||||
|
||||
/// <remarks>Get a user from primary id</remarks>
|
||||
/// <param name="userId">Uuid of user to get</param>
|
||||
/// <returns>A user in the gamenight system</returns>
|
||||
/// <exception cref="ApiException">
|
||||
/// Thrown when the request returns a non-success status code:
|
||||
@@ -114,8 +119,31 @@ namespace gamenight.ui.Services
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// </exception>
|
||||
[Get("/user")]
|
||||
Task<User> UserGet([Body] UserId body);
|
||||
[Get("/user/{userId}")]
|
||||
Task<User> User(string userId);
|
||||
|
||||
/// <summary>Get owned games of user</summary>
|
||||
/// <param name="userId">Uuid of user to get owned games for.</param>
|
||||
/// <returns>A list of OwnedGames</returns>
|
||||
/// <exception cref="ApiException">
|
||||
/// Thrown when the request returns a non-success status code:
|
||||
/// <list type="table">
|
||||
/// <listheader>
|
||||
/// <term>Status</term>
|
||||
/// <description>Description</description>
|
||||
/// </listheader>
|
||||
/// <item>
|
||||
/// <term>401</term>
|
||||
/// <description>Example response</description>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>422</term>
|
||||
/// <description>Example response</description>
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// </exception>
|
||||
[Get("/user/{userId}/owned_games")]
|
||||
Task<ICollection<OwnedGame>> OwnedGames(string userId);
|
||||
|
||||
/// <summary>Get a all gamenights</summary>
|
||||
/// <remarks>Retrieve the list of gamenights on this gamenight server. Requires authorization.</remarks>
|
||||
@@ -138,31 +166,9 @@ namespace gamenight.ui.Services
|
||||
/// </list>
|
||||
/// </exception>
|
||||
[Get("/gamenights")]
|
||||
Task<ICollection<Gamenight>> Gamenights();
|
||||
|
||||
/// <summary>Get all participants for a gamenight</summary>
|
||||
/// <remarks>Retrieve the participants of a single gamenight by id.</remarks>
|
||||
/// <returns>Response with a list of participant uuids</returns>
|
||||
/// <exception cref="ApiException">
|
||||
/// Thrown when the request returns a non-success status code:
|
||||
/// <list type="table">
|
||||
/// <listheader>
|
||||
/// <term>Status</term>
|
||||
/// <description>Description</description>
|
||||
/// </listheader>
|
||||
/// <item>
|
||||
/// <term>400</term>
|
||||
/// <description>Example response</description>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>401</term>
|
||||
/// <description>Example response</description>
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// </exception>
|
||||
[Get("/participants")]
|
||||
Task<Participants> Participants([Body] GamenightId body);
|
||||
Task<ICollection<Gamenight>> GamenightsGet();
|
||||
|
||||
/// <summary>Gets the gamenight</summary>
|
||||
/// <remarks>Add a gamenight by providing a name and a date, only available when providing an JWT token.</remarks>
|
||||
/// <returns>A <see cref="Task"/> that completes when the request is finished.</returns>
|
||||
/// <exception cref="ApiException">
|
||||
@@ -182,9 +188,11 @@ namespace gamenight.ui.Services
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// </exception>
|
||||
[Post("/gamenight")]
|
||||
Task GamenightPost([Body] AddGamenightRequestBody body);
|
||||
[Post("/gamenights")]
|
||||
Task GamenightsPost([Body] AddGamenightRequestBody body);
|
||||
|
||||
/// <summary>get the specified gamenight</summary>
|
||||
/// <param name="gamenightId">Uuid of gamenight to get.</param>
|
||||
/// <returns>A gamenight being hosted</returns>
|
||||
/// <exception cref="ApiException">
|
||||
/// Thrown when the request returns a non-success status code:
|
||||
@@ -203,9 +211,35 @@ namespace gamenight.ui.Services
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// </exception>
|
||||
[Get("/gamenight")]
|
||||
Task<Gamenight> GamenightGet([Body] GetGamenightRequestBody body);
|
||||
[Get("/gamenight/{gamenightId}")]
|
||||
Task<Gamenight> Gamenight(string gamenightId);
|
||||
|
||||
/// <summary>Get all participants for a gamenight</summary>
|
||||
/// <remarks>Retrieve the participants of a single gamenight by id.</remarks>
|
||||
/// <param name="gamenightId">Uuid of gamenight to get participants for.</param>
|
||||
/// <returns>Response with a list of participant uuids</returns>
|
||||
/// <exception cref="ApiException">
|
||||
/// Thrown when the request returns a non-success status code:
|
||||
/// <list type="table">
|
||||
/// <listheader>
|
||||
/// <term>Status</term>
|
||||
/// <description>Description</description>
|
||||
/// </listheader>
|
||||
/// <item>
|
||||
/// <term>400</term>
|
||||
/// <description>Example response</description>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>401</term>
|
||||
/// <description>Example response</description>
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// </exception>
|
||||
[Get("/gamenight/{gamenightId}/participants")]
|
||||
Task<Participants> ParticipantsGet(string gamenightId);
|
||||
|
||||
/// <summary>Add a participant</summary>
|
||||
/// <param name="gamenightId">Uuid of gamenight to add participants for.</param>
|
||||
/// <returns>A <see cref="Task"/> that completes when the request is finished.</returns>
|
||||
/// <exception cref="ApiException">
|
||||
/// Thrown when the request returns a non-success status code:
|
||||
@@ -224,9 +258,12 @@ namespace gamenight.ui.Services
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// </exception>
|
||||
[Post("/join")]
|
||||
Task Join([Body] GamenightId body);
|
||||
[Post("/gamenight/{gamenightId}/participants")]
|
||||
Task ParticipantsPost(string gamenightId, [Body] UserId body);
|
||||
|
||||
/// <summary>deletes a gamenight participant</summary>
|
||||
/// <param name="gamenightId">Uuid of gamenight to delete participant for</param>
|
||||
/// <param name="userId">Uuid of the of the participant to remove</param>
|
||||
/// <returns>A <see cref="Task"/> that completes when the request is finished.</returns>
|
||||
/// <exception cref="ApiException">
|
||||
/// Thrown when the request returns a non-success status code:
|
||||
@@ -245,9 +282,10 @@ namespace gamenight.ui.Services
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// </exception>
|
||||
[Post("/leave")]
|
||||
Task Leave([Body] GamenightId body);
|
||||
[Delete("/gamenight/{gamenightId}/participant/{userId}")]
|
||||
Task Participant(string gamenightId, string userId);
|
||||
|
||||
/// <summary>get all games</summary>
|
||||
/// <returns>A list of Games in this gamenight instance.</returns>
|
||||
/// <exception cref="ApiException">
|
||||
/// Thrown when the request returns a non-success status code:
|
||||
@@ -267,29 +305,9 @@ namespace gamenight.ui.Services
|
||||
/// </list>
|
||||
/// </exception>
|
||||
[Get("/games")]
|
||||
Task<ICollection<Game>> Games();
|
||||
|
||||
/// <returns>A game.</returns>
|
||||
/// <exception cref="ApiException">
|
||||
/// Thrown when the request returns a non-success status code:
|
||||
/// <list type="table">
|
||||
/// <listheader>
|
||||
/// <term>Status</term>
|
||||
/// <description>Description</description>
|
||||
/// </listheader>
|
||||
/// <item>
|
||||
/// <term>401</term>
|
||||
/// <description>Example response</description>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>422</term>
|
||||
/// <description>Example response</description>
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// </exception>
|
||||
[Get("/game")]
|
||||
Task<Game> GameGet([Body] GameId body);
|
||||
Task<ICollection<Game>> GamesGet();
|
||||
|
||||
/// <summary>add a game</summary>
|
||||
/// <returns>a game id</returns>
|
||||
/// <exception cref="ApiException">
|
||||
/// Thrown when the request returns a non-success status code:
|
||||
@@ -308,9 +326,34 @@ namespace gamenight.ui.Services
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// </exception>
|
||||
[Post("/game")]
|
||||
Task<GameId> GamePost([Body] AddGameRequestBody body);
|
||||
[Post("/games")]
|
||||
Task<GameId> GamesPost([Body] AddGameRequestBody body);
|
||||
|
||||
/// <summary>Get this specific game</summary>
|
||||
/// <param name="gameId">Uuid of game to get.</param>
|
||||
/// <returns>A game.</returns>
|
||||
/// <exception cref="ApiException">
|
||||
/// Thrown when the request returns a non-success status code:
|
||||
/// <list type="table">
|
||||
/// <listheader>
|
||||
/// <term>Status</term>
|
||||
/// <description>Description</description>
|
||||
/// </listheader>
|
||||
/// <item>
|
||||
/// <term>401</term>
|
||||
/// <description>Example response</description>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>422</term>
|
||||
/// <description>Example response</description>
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// </exception>
|
||||
[Get("/game/{gameId}")]
|
||||
Task<Game> GameGet(string gameId);
|
||||
|
||||
/// <summary>Delete this game.</summary>
|
||||
/// <param name="gameId">Uuid of game to delete.</param>
|
||||
/// <returns>A <see cref="Task"/> that completes when the request is finished.</returns>
|
||||
/// <exception cref="ApiException">
|
||||
/// Thrown when the request returns a non-success status code:
|
||||
@@ -329,9 +372,11 @@ namespace gamenight.ui.Services
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// </exception>
|
||||
[Delete("/game")]
|
||||
Task GameDelete([Body] GameId body);
|
||||
[Delete("/game/{gameId}")]
|
||||
Task GameDelete(string gameId);
|
||||
|
||||
/// <summary>Changes this game resource</summary>
|
||||
/// <param name="gameId">Uuid of game to change.</param>
|
||||
/// <returns>A <see cref="Task"/> that completes when the request is finished.</returns>
|
||||
/// <exception cref="ApiException">
|
||||
/// Thrown when the request returns a non-success status code:
|
||||
@@ -350,9 +395,11 @@ namespace gamenight.ui.Services
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// </exception>
|
||||
[Post("/rename_game")]
|
||||
Task RenameGame([Body] RenameGameRequestBody body);
|
||||
[Put("/game/{gameId}")]
|
||||
Task GamePut(string gameId, [Body] EditGameRequestBody body);
|
||||
|
||||
/// <summary>Own this game</summary>
|
||||
/// <param name="gameId">Uuid of game to own.</param>
|
||||
/// <returns>A <see cref="Task"/> that completes when the request is finished.</returns>
|
||||
/// <exception cref="ApiException">
|
||||
/// Thrown when the request returns a non-success status code:
|
||||
@@ -371,9 +418,12 @@ namespace gamenight.ui.Services
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// </exception>
|
||||
[Post("/own")]
|
||||
Task Own([Body] OwnGameRequestBody body);
|
||||
[Post("/game/{gameId}/owners")]
|
||||
Task Owners(string gameId, [Body] OwnGame body);
|
||||
|
||||
/// <summary>no longer own this game</summary>
|
||||
/// <param name="gameId">Uuid of game that user no longer owns.</param>
|
||||
/// <param name="userId">Uuid of user that no longer owns.</param>
|
||||
/// <returns>A <see cref="Task"/> that completes when the request is finished.</returns>
|
||||
/// <exception cref="ApiException">
|
||||
/// Thrown when the request returns a non-success status code:
|
||||
@@ -392,72 +442,10 @@ namespace gamenight.ui.Services
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// </exception>
|
||||
[Post("/disown")]
|
||||
Task Disown([Body] GameId body);
|
||||
|
||||
/// <returns>A list of game ids.</returns>
|
||||
/// <exception cref="ApiException">
|
||||
/// Thrown when the request returns a non-success status code:
|
||||
/// <list type="table">
|
||||
/// <listheader>
|
||||
/// <term>Status</term>
|
||||
/// <description>Description</description>
|
||||
/// </listheader>
|
||||
/// <item>
|
||||
/// <term>401</term>
|
||||
/// <description>Example response</description>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>422</term>
|
||||
/// <description>Example response</description>
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// </exception>
|
||||
[Get("/owned_games")]
|
||||
Task<ICollection<OwnedGame>> OwnedGames([Body] UserId body);
|
||||
|
||||
/// <returns>A location</returns>
|
||||
/// <exception cref="ApiException">
|
||||
/// Thrown when the request returns a non-success status code:
|
||||
/// <list type="table">
|
||||
/// <listheader>
|
||||
/// <term>Status</term>
|
||||
/// <description>Description</description>
|
||||
/// </listheader>
|
||||
/// <item>
|
||||
/// <term>401</term>
|
||||
/// <description>Example response</description>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>422</term>
|
||||
/// <description>Example response</description>
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// </exception>
|
||||
[Get("/location")]
|
||||
Task<Location> LocationGet([Body] LocationId body);
|
||||
|
||||
/// <returns>A location Id</returns>
|
||||
/// <exception cref="ApiException">
|
||||
/// Thrown when the request returns a non-success status code:
|
||||
/// <list type="table">
|
||||
/// <listheader>
|
||||
/// <term>Status</term>
|
||||
/// <description>Description</description>
|
||||
/// </listheader>
|
||||
/// <item>
|
||||
/// <term>401</term>
|
||||
/// <description>Example response</description>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>422</term>
|
||||
/// <description>Example response</description>
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// </exception>
|
||||
[Post("/location")]
|
||||
Task<LocationId> LocationPost([Body] AddLocationRequestBody body);
|
||||
[Delete("/game/{gameId}/owner/{userId}")]
|
||||
Task Owner(string gameId, string userId);
|
||||
|
||||
/// <summary>get all locations</summary>
|
||||
/// <returns>A list of all LocationsResponse</returns>
|
||||
/// <exception cref="ApiException">
|
||||
/// Thrown when the request returns a non-success status code:
|
||||
@@ -477,9 +465,10 @@ namespace gamenight.ui.Services
|
||||
/// </list>
|
||||
/// </exception>
|
||||
[Get("/locations")]
|
||||
Task<ICollection<Location>> Locations();
|
||||
Task<ICollection<Location>> LocationsGet();
|
||||
|
||||
/// <returns>A <see cref="Task"/> that completes when the request is finished.</returns>
|
||||
/// <summary>add a location</summary>
|
||||
/// <returns>A location Id</returns>
|
||||
/// <exception cref="ApiException">
|
||||
/// Thrown when the request returns a non-success status code:
|
||||
/// <list type="table">
|
||||
@@ -497,9 +486,34 @@ namespace gamenight.ui.Services
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// </exception>
|
||||
[Post("/location_authorize")]
|
||||
Task LocationAuthorize([Body] AuthorizeLocationRequestBody body);
|
||||
[Post("/locations")]
|
||||
Task<LocationId> LocationsPost([Body] AddLocationRequestBody body);
|
||||
|
||||
/// <summary>gets this location</summary>
|
||||
/// <param name="locationId">Uuid of location to get.</param>
|
||||
/// <returns>A location</returns>
|
||||
/// <exception cref="ApiException">
|
||||
/// Thrown when the request returns a non-success status code:
|
||||
/// <list type="table">
|
||||
/// <listheader>
|
||||
/// <term>Status</term>
|
||||
/// <description>Description</description>
|
||||
/// </listheader>
|
||||
/// <item>
|
||||
/// <term>401</term>
|
||||
/// <description>Example response</description>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>422</term>
|
||||
/// <description>Example response</description>
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// </exception>
|
||||
[Get("/location/{locationId}")]
|
||||
Task<Location> Location(string locationId);
|
||||
|
||||
/// <summary>gets this locations authorized users</summary>
|
||||
/// <param name="locationId">Uuid of location to get authorized users for.</param>
|
||||
/// <returns>A list of user ids.</returns>
|
||||
/// <exception cref="ApiException">
|
||||
/// Thrown when the request returns a non-success status code:
|
||||
@@ -518,8 +532,55 @@ namespace gamenight.ui.Services
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// </exception>
|
||||
[Get("/authorized_location_user_ids")]
|
||||
Task<ICollection<UserId>> AuthorizedLocationUserIds([Body] LocationId body);
|
||||
[Get("/location/{locationId}/authorized_users/")]
|
||||
Task<ICollection<UserId>> AuthorizedUsersGet(string locationId);
|
||||
|
||||
/// <summary>Authorize a user</summary>
|
||||
/// <param name="locationId">Uuid location to authorize for.</param>
|
||||
/// <returns>A <see cref="Task"/> that completes when the request is finished.</returns>
|
||||
/// <exception cref="ApiException">
|
||||
/// Thrown when the request returns a non-success status code:
|
||||
/// <list type="table">
|
||||
/// <listheader>
|
||||
/// <term>Status</term>
|
||||
/// <description>Description</description>
|
||||
/// </listheader>
|
||||
/// <item>
|
||||
/// <term>401</term>
|
||||
/// <description>Example response</description>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>422</term>
|
||||
/// <description>Example response</description>
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// </exception>
|
||||
[Post("/location/{locationId}/authorized_users/")]
|
||||
Task AuthorizedUsersPost(string locationId, [Body] UserId body);
|
||||
|
||||
/// <summary>remove an authorized user from a location</summary>
|
||||
/// <param name="locationId">Uuid of location to deauthorize for.</param>
|
||||
/// <param name="userId">Uuid of user ot deauthorize.</param>
|
||||
/// <returns>A <see cref="Task"/> that completes when the request is finished.</returns>
|
||||
/// <exception cref="ApiException">
|
||||
/// Thrown when the request returns a non-success status code:
|
||||
/// <list type="table">
|
||||
/// <listheader>
|
||||
/// <term>Status</term>
|
||||
/// <description>Description</description>
|
||||
/// </listheader>
|
||||
/// <item>
|
||||
/// <term>401</term>
|
||||
/// <description>Example response</description>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>422</term>
|
||||
/// <description>Example response</description>
|
||||
/// </item>
|
||||
/// </list>
|
||||
/// </exception>
|
||||
[Delete("/location/{locationId}/authorized_user/{userId}")]
|
||||
Task AuthorizedUser(string locationId, string userId);
|
||||
|
||||
|
||||
}
|
||||
@@ -548,7 +609,7 @@ namespace gamenight.ui.Services
|
||||
#pragma warning disable 8625 // Disable "CS8625 Cannot convert null literal to non-nullable reference type"
|
||||
#pragma warning disable 8765 // Disable "CS8765 Nullability of type of parameter doesn't match overridden member (possibly because of nullability attributes)."
|
||||
|
||||
namespace gamenight.ui.Services
|
||||
namespace Gamenight.Ui.Services
|
||||
{
|
||||
using System = global::System;
|
||||
|
||||
@@ -723,10 +784,36 @@ namespace gamenight.ui.Services
|
||||
|
||||
}
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.6.3.0 (NJsonSchema v11.5.2.0 (Newtonsoft.Json v13.0.0.0))")]
|
||||
public partial class OwnGame
|
||||
{
|
||||
|
||||
[JsonPropertyName("user_id")]
|
||||
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
|
||||
public string UserId { get; set; }
|
||||
|
||||
[JsonPropertyName("location_id")]
|
||||
public string LocationId { get; set; }
|
||||
|
||||
private IDictionary<string, object> _additionalProperties;
|
||||
|
||||
[JsonExtensionData]
|
||||
public IDictionary<string, object> AdditionalProperties
|
||||
{
|
||||
get { return _additionalProperties ?? (_additionalProperties = new Dictionary<string, object>()); }
|
||||
set { _additionalProperties = value; }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.6.3.0 (NJsonSchema v11.5.2.0 (Newtonsoft.Json v13.0.0.0))")]
|
||||
public partial class OwnedGame
|
||||
{
|
||||
|
||||
[JsonPropertyName("user_id")]
|
||||
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
|
||||
public string UserId { get; set; }
|
||||
|
||||
[JsonPropertyName("game_id")]
|
||||
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
|
||||
public string GameId { get; set; }
|
||||
@@ -825,24 +912,6 @@ namespace gamenight.ui.Services
|
||||
|
||||
}
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.6.3.0 (NJsonSchema v11.5.2.0 (Newtonsoft.Json v13.0.0.0))")]
|
||||
public partial class GetGamenightRequestBody
|
||||
{
|
||||
|
||||
[JsonPropertyName("id")]
|
||||
public string Id { get; set; }
|
||||
|
||||
private IDictionary<string, object> _additionalProperties;
|
||||
|
||||
[JsonExtensionData]
|
||||
public IDictionary<string, object> AdditionalProperties
|
||||
{
|
||||
get { return _additionalProperties ?? (_additionalProperties = new Dictionary<string, object>()); }
|
||||
set { _additionalProperties = value; }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.6.3.0 (NJsonSchema v11.5.2.0 (Newtonsoft.Json v13.0.0.0))")]
|
||||
public partial class User
|
||||
{
|
||||
@@ -912,7 +981,7 @@ namespace gamenight.ui.Services
|
||||
}
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.6.3.0 (NJsonSchema v11.5.2.0 (Newtonsoft.Json v13.0.0.0))")]
|
||||
public partial class RenameGameRequestBody
|
||||
public partial class EditGameRequestBody
|
||||
{
|
||||
|
||||
[JsonPropertyName("id")]
|
||||
@@ -935,29 +1004,7 @@ namespace gamenight.ui.Services
|
||||
}
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.6.3.0 (NJsonSchema v11.5.2.0 (Newtonsoft.Json v13.0.0.0))")]
|
||||
public partial class OwnGameRequestBody
|
||||
{
|
||||
|
||||
[JsonPropertyName("game_id")]
|
||||
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
|
||||
public string GameId { get; set; }
|
||||
|
||||
[JsonPropertyName("location_id")]
|
||||
public string LocationId { get; set; }
|
||||
|
||||
private IDictionary<string, object> _additionalProperties;
|
||||
|
||||
[JsonExtensionData]
|
||||
public IDictionary<string, object> AdditionalProperties
|
||||
{
|
||||
get { return _additionalProperties ?? (_additionalProperties = new Dictionary<string, object>()); }
|
||||
set { _additionalProperties = value; }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.6.3.0 (NJsonSchema v11.5.2.0 (Newtonsoft.Json v13.0.0.0))")]
|
||||
public partial class GameIdsResponse : System.Collections.ObjectModel.Collection<OwnedGame>
|
||||
public partial class GameIdsResponse : System.Collections.ObjectModel.Collection<GameId>
|
||||
{
|
||||
|
||||
}
|
||||
@@ -1022,46 +1069,6 @@ namespace gamenight.ui.Services
|
||||
|
||||
}
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.6.3.0 (NJsonSchema v11.5.2.0 (Newtonsoft.Json v13.0.0.0))")]
|
||||
public partial class AuthorizeLocationRequestBody
|
||||
{
|
||||
|
||||
[JsonPropertyName("location_id")]
|
||||
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
|
||||
public string LocationId { get; set; }
|
||||
|
||||
[JsonPropertyName("user_id")]
|
||||
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
|
||||
public string UserId { get; set; }
|
||||
|
||||
[JsonPropertyName("op")]
|
||||
[System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
|
||||
[JsonConverter(typeof(JsonStringEnumConverter<AuthorizeLocationRequestBodyOp>))]
|
||||
public AuthorizeLocationRequestBodyOp Op { get; set; }
|
||||
|
||||
private IDictionary<string, object> _additionalProperties;
|
||||
|
||||
[JsonExtensionData]
|
||||
public IDictionary<string, object> AdditionalProperties
|
||||
{
|
||||
get { return _additionalProperties ?? (_additionalProperties = new Dictionary<string, object>()); }
|
||||
set { _additionalProperties = value; }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "14.6.3.0 (NJsonSchema v11.5.2.0 (Newtonsoft.Json v13.0.0.0))")]
|
||||
public enum AuthorizeLocationRequestBodyOp
|
||||
{
|
||||
|
||||
[System.Runtime.Serialization.EnumMember(Value = @"grant")]
|
||||
Grant = 0,
|
||||
|
||||
[System.Runtime.Serialization.EnumMember(Value = @"revoke")]
|
||||
Revoke = 1,
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@ using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Templates;
|
||||
using gamenight.ui.ViewModels;
|
||||
using Gamenight.Ui.ViewModels;
|
||||
|
||||
namespace gamenight.ui;
|
||||
namespace Gamenight.Ui;
|
||||
|
||||
/// <summary>
|
||||
/// Given a view model, returns the corresponding view if possible.
|
||||
|
||||
7
Gamenight.Ui/Gamenight.Ui/ViewModels/HeaderViewModel.cs
Normal file
7
Gamenight.Ui/Gamenight.Ui/ViewModels/HeaderViewModel.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
namespace Gamenight.Ui.ViewModels;
|
||||
|
||||
public class HeaderViewModel : ViewModelBase
|
||||
{
|
||||
|
||||
}
|
||||
@@ -1,26 +1,37 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using gamenight.ui.Services;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using Gamenight.Ui.Services;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace gamenight.ui.ViewModels;
|
||||
namespace Gamenight.Ui.ViewModels;
|
||||
|
||||
public partial class MainViewModel : ViewModelBase
|
||||
{
|
||||
[ObservableProperty]
|
||||
private string _greeting = "Welcome to Avalonia!";
|
||||
|
||||
private IGamenightApi GamenightApi { get; }
|
||||
public HeaderViewModel HeaderViewModel { get; }
|
||||
public SideBarViewModel SideBarViewModel { get; }
|
||||
|
||||
public MainViewModel(IGamenightApi gamenightApi)
|
||||
[ObservableProperty]
|
||||
private ICommand _loginCommand;
|
||||
|
||||
public MainViewModel(IGamenightApi gamenightApi, HeaderViewModel headerViewModel, SideBarViewModel sideBarViewModel)
|
||||
{
|
||||
GamenightApi = gamenightApi;
|
||||
HeaderViewModel = headerViewModel;
|
||||
SideBarViewModel = sideBarViewModel;
|
||||
|
||||
Test();
|
||||
_loginCommand = ReactiveCommand.Create(Test);
|
||||
}
|
||||
|
||||
public async void Test() {
|
||||
var token = await GamenightApi.TokenGet(new Login() {
|
||||
Username = "Admin",
|
||||
Password = "Gamenight!"
|
||||
public MainViewModel() => throw new System.NotImplementedException();
|
||||
|
||||
public async Task Test() {
|
||||
var token = await GamenightApi.Token(new Login() {
|
||||
Username = "admin",
|
||||
Password = "gamenight!"
|
||||
});
|
||||
|
||||
System.Console.WriteLine($"Token: {token.JwtToken}");
|
||||
|
||||
7
Gamenight.Ui/Gamenight.Ui/ViewModels/SideBarViewModel.cs
Normal file
7
Gamenight.Ui/Gamenight.Ui/ViewModels/SideBarViewModel.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
namespace Gamenight.Ui.ViewModels;
|
||||
|
||||
public class SideBarViewModel : ViewModelBase
|
||||
{
|
||||
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace gamenight.ui.ViewModels;
|
||||
namespace Gamenight.Ui.ViewModels;
|
||||
|
||||
public abstract class ViewModelBase : ObservableObject
|
||||
{
|
||||
|
||||
15
Gamenight.Ui/Gamenight.Ui/Views/HeaderView.axaml
Normal file
15
Gamenight.Ui/Gamenight.Ui/Views/HeaderView.axaml
Normal file
@@ -0,0 +1,15 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
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:vm="using:Gamenight.Ui.ViewModels"
|
||||
xmlns:views="clr-namespace:Gamenight.Ui.Views"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="Gamenight.Ui.Views.HeaderView"
|
||||
x:DataType="vm:HeaderViewModel">
|
||||
<Design.DataContext>
|
||||
<!-- This only sets the DataContext for the previewer in an IDE,
|
||||
to set the actual DataContext for runtime, set the DataContext property in code (look at App.axaml.cs) -->
|
||||
<vm:HeaderViewModel />
|
||||
</Design.DataContext>
|
||||
</UserControl>
|
||||
17
Gamenight.Ui/Gamenight.Ui/Views/HeaderView.axaml.cs
Normal file
17
Gamenight.Ui/Gamenight.Ui/Views/HeaderView.axaml.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Gamenight.Ui.Views;
|
||||
|
||||
public partial class HeaderView : UserControl
|
||||
{
|
||||
public HeaderView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
}
|
||||
@@ -2,15 +2,32 @@
|
||||
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:vm="using:gamenight.ui.ViewModels"
|
||||
xmlns:vm="using:Gamenight.Ui.ViewModels"
|
||||
xmlns:views="clr-namespace:Gamenight.Ui.Views"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="gamenight.ui.Views.MainView"
|
||||
x:Class="Gamenight.Ui.Views.MainView"
|
||||
x:DataType="vm:MainViewModel">
|
||||
<Design.DataContext>
|
||||
<!-- This only sets the DataContext for the previewer in an IDE,
|
||||
to set the actual DataContext for runtime, set the DataContext property in code (look at App.axaml.cs) -->
|
||||
<vm:MainViewModel />
|
||||
</Design.DataContext>
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<!--<views:HeaderView Grid.Row="0" DataContext="{Binding HeaderViewModel}"/>-->
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<views:SideBarView Grid.Column="0" DataContext="{Binding SideBarViewModel}"/>
|
||||
<StackPanel Grid.Column="1">
|
||||
<TextBlock Text="{Binding Greeting}" HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||
<Button Content="Login" Command="{Binding LoginCommand}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace gamenight.ui.Views;
|
||||
namespace Gamenight.Ui.Views;
|
||||
|
||||
public partial class MainView : UserControl
|
||||
{
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<Window xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="using:gamenight.ui.ViewModels"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:views="using:gamenight.ui.Views"
|
||||
xmlns:views="using:Gamenight.Ui.Views"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="gamenight.ui.Views.MainWindow"
|
||||
x:Class="Gamenight.Ui.Views.MainWindow"
|
||||
Icon="/Assets/avalonia-logo.ico"
|
||||
Title="gamenight.ui">
|
||||
Title="Gamenight.Ui">
|
||||
<views:MainView />
|
||||
</Window>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace gamenight.ui.Views;
|
||||
namespace Gamenight.Ui.Views;
|
||||
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
|
||||
15
Gamenight.Ui/Gamenight.Ui/Views/SideBarView.axaml
Normal file
15
Gamenight.Ui/Gamenight.Ui/Views/SideBarView.axaml
Normal file
@@ -0,0 +1,15 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
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:vm="using:Gamenight.Ui.ViewModels"
|
||||
xmlns:views="clr-namespace:Gamenight.Ui.Views"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="Gamenight.Ui.Views.SideBarView"
|
||||
x:DataType="vm:SideBarViewModel">
|
||||
<Design.DataContext>
|
||||
<!-- This only sets the DataContext for the previewer in an IDE,
|
||||
to set the actual DataContext for runtime, set the DataContext property in code (look at App.axaml.cs) -->
|
||||
<vm:SideBarViewModel />
|
||||
</Design.DataContext>
|
||||
</UserControl>
|
||||
17
Gamenight.Ui/Gamenight.Ui/Views/SideBarView.axaml.cs
Normal file
17
Gamenight.Ui/Gamenight.Ui/Views/SideBarView.axaml.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace Gamenight.Ui.Views;
|
||||
|
||||
public partial class SideBarView : UserControl
|
||||
{
|
||||
public SideBarView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user