Skip to content

Commit

Permalink
Merge pull request #46 from sahin-a/18-settings-tab-select-what-data-…
Browse files Browse the repository at this point in the history
…should-be-shown

18 settings tab select what data should be shown
  • Loading branch information
sahin-a committed Mar 12, 2023
2 parents 5416513 + 703bca0 commit 8741173
Show file tree
Hide file tree
Showing 85 changed files with 716 additions and 411 deletions.
3 changes: 2 additions & 1 deletion DI/Dependencies.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ namespace DI
{
public static class Dependencies
{
public static void RegisterModules(this ContainerBuilder builder)
public static ContainerBuilder RegisterModules(this ContainerBuilder builder)
{
builder.RegisterInfrastructureModule();
return builder;
}
}
}

This file was deleted.

This file was deleted.

19 changes: 0 additions & 19 deletions SteamAccountManager.Application/Common/Observable/Unsubscriber.cs

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using SteamAccountManager.Application.Steam.UseCase;
using SteamAccountManager.Domain.Steam.Model;
using SteamAccountManager.Domain.Steam.Model;
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading.Tasks;
using SteamAccountManager.Domain.Steam.UseCase;

namespace SteamAccountManager.AvaloniaUI.DemoMock
{
Expand Down
36 changes: 24 additions & 12 deletions SteamAccountManager.AvaloniaUI/Dependencies.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using Autofac;
using Autofac.Core;
using DI;
using ReactiveUI;
using SteamAccountManager.Application.Steam.Service;
using SteamAccountManager.AvaloniaUI.Mappers;
using SteamAccountManager.AvaloniaUI.Notifications;
using SteamAccountManager.AvaloniaUI.Services;
using SteamAccountManager.AvaloniaUI.ViewModels;
using SteamAccountManager.Domain.Steam.Observables;
using SteamAccountManager.Domain.Steam.Service;

namespace SteamAccountManager.AvaloniaUI
{
Expand All @@ -16,15 +16,21 @@ internal static class Dependencies

public static void RegisterDependencies()
{
ContainerBuilder builder = new();
builder.RegisterModules();
builder.RegisterAvaloniaModule();
builder.RegisterViewModels();
Container = new ContainerBuilder()
.RegisterModules()
.RegisterAvaloniaModule()
.RegisterViewModels()
.Build()
.StartWatchers();
}

Container = builder.Build();
public static IContainer StartWatchers(this IContainer container)
{
container.Resolve<IAccountStorageWatcher>().Start();
return container;
}

public static void RegisterAvaloniaModule(this ContainerBuilder builder)
public static ContainerBuilder RegisterAvaloniaModule(this ContainerBuilder builder)
{
builder.RegisterType<AvatarService>().SingleInstance();
builder.RegisterType<AccountMapper>().SingleInstance();
Expand All @@ -33,19 +39,25 @@ public static void RegisterAvaloniaModule(this ContainerBuilder builder)
#else
builder.RegisterType<LegacyWindowsLocalNotificationService>().As<ILocalNotificationService>().SingleInstance();
#endif

return builder;
}

public static void RegisterViewModels(this ContainerBuilder builder)
public static ContainerBuilder RegisterViewModels(this ContainerBuilder builder)
{

builder.RegisterViewModel<AccountSwitcherViewModel>();
builder.RegisterViewModel<SettingsViewModel>();

return builder;
}

private static void RegisterViewModel<ViewModel>(this ContainerBuilder builder) where ViewModel : RoutableViewModel
private static ContainerBuilder RegisterViewModel<ViewModel>(this ContainerBuilder builder)
where ViewModel : RoutableViewModel
{
builder.RegisterType<ViewModel>()
.WithParameter(new TypedParameter(typeof(IScreen), "screen"));

return builder;
}
}
}
}
30 changes: 7 additions & 23 deletions SteamAccountManager.AvaloniaUI/Models/Account.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
using Avalonia.Media.Imaging;
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System;
using Avalonia.Media.Imaging;

namespace SteamAccountManager.AvaloniaUI.Models
{
public class Account : INotifyPropertyChanged
public class Account
{
public IBitmap? ProfilePicture { get; set; }
public Uri? ProfilePictureUrl { get; set; }
Expand All @@ -16,29 +14,15 @@ public class Account : INotifyPropertyChanged
public bool IsVacBanned { get; set; }
public bool IsCommunityBanned { get; set; }
public string LastLogin { get; set; } = string.Empty;
public Rank Rank { get; set; } = new Rank()

public Rank Rank { get; set; } = new()
{
Level = -1
};

public bool ShowLevel
{
get { return Rank.Level >= 0; }
}


#pragma warning disable CS8612 // Die NULL-Zulässigkeit von Verweistypen im Typ entspricht nicht dem implizit implementierten Member.
public event PropertyChangedEventHandler PropertyChanged;
#pragma warning restore CS8612 // Die NULL-Zulässigkeit von Verweistypen im Typ entspricht nicht dem implizit implementierten Member.

// This method is called by the Set accessor of each property.
// The CallerMemberName attribute that is applied to the optional propertyName
// parameter causes the property name of the caller to be substituted as an argument.
private void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using SteamAccountManager.Application.Steam.Service;
using SteamAccountManager.Domain.Steam.Service;

namespace SteamAccountManager.AvaloniaUI.Notifications
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#if WINDOWS10_0_17763_0_OR_GREATER
using Microsoft.Toolkit.Uwp.Notifications;
using SteamAccountManager.Application.Steam.Service;
using SteamAccountManager.Domain.Steam.Service;

namespace SteamAccountManager.AvaloniaUI.Notifications
{
Expand Down
2 changes: 1 addition & 1 deletion SteamAccountManager.AvaloniaUI/Services/AvatarService.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using Avalonia;
using Avalonia.Media.Imaging;
using Avalonia.Platform;
using SteamAccountManager.Application.Steam.Service;
using System;
using System.IO;
using System.Threading.Tasks;
using SteamAccountManager.Domain.Steam.Service;

namespace SteamAccountManager.AvaloniaUI.Services
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DI\DI.csproj" />
<ProjectReference Include="..\SteamAccountManager.Application\SteamAccountManager.Application.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Update="Views\AccountSwitcherView.axaml.cs">
Expand Down
68 changes: 37 additions & 31 deletions SteamAccountManager.AvaloniaUI/SteamAccountSwitcherStyles.xaml
Original file line number Diff line number Diff line change
@@ -1,35 +1,41 @@
<Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style Selector="Window">
<Setter Property="Background" Value="#1c1b1b" />
<Setter Property="Icon" Value="/Assets/sam.ico" />
<Setter Property="ExtendClientAreaToDecorationsHint" Value="True" />
</Style>
<Style Selector="Window">
<Setter Property="Background" Value="#1c1b1b" />
<Setter Property="Icon" Value="/Assets/sam.ico" />
<Setter Property="ExtendClientAreaToDecorationsHint" Value="True" />
</Style>

<Style Selector="Grid.NavBar">
<Setter Property="Background" Value="#1c1b1b" />
</Style>
<Style Selector="Button.NavTab">
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Padding" Value="12" />
<Setter Property="Margin" Value="0" />
</Style>
<Style Selector="Grid.NavBar">
<Setter Property="Background" Value="#1c1b1b" />
</Style>
<Style Selector="Button.NavTab">
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Padding" Value="12" />
<Setter Property="Margin" Value="0" />
</Style>

<Style Selector="Grid.ButtonBar">
<Setter Property="Background" Value="#1c1b1b" />
</Style>
<Style Selector="Button.BarItem">
<Setter Property="FontSize" Value="25" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Padding" Value="12" />
<Setter Property="Margin" Value="0" />
</Style>
</Styles>
<Style Selector="Grid.ButtonBar">
<Setter Property="Background" Value="#1c1b1b" />
</Style>
<Style Selector="Button.BarItem">
<Setter Property="FontSize" Value="25" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Padding" Value="12" />
<Setter Property="Margin" Value="0" />
</Style>

<Style Selector="TextBox.PasswordInput">
<Setter Property="PasswordChar" Value="" />
<Setter Property="FontSize" Value="12" />
<Setter Property="VerticalContentAlignment" Value="Center" />
</Style>
</Styles>
Loading

0 comments on commit 8741173

Please sign in to comment.