Skip to content
Snippets Groups Projects
Verified Commit 686c5554 authored by Emilia's avatar Emilia
Browse files

dead.png

parent 681c4886
No related branches found
No related tags found
No related merge requests found
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003A020002A9pdb321_002Eil_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FDecompilerCache_003FILViewer_003Fda232ecc044f4c3d8e856366253516531d2800_003F71_003F8a186d8b_003F020002A9pdb321_002Eil/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003A020002ACpdb869_002Eil_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FDecompilerCache_003FILViewer_003Fda232ecc044f4c3d8e856366253516531d2800_003F00_003F5a1370d8_003F020002ACpdb869_002Eil/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AAssetLoader_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003F6dcc875f2facef5a505e1840bcae49509f5b796e47105cc3205aa92843f4753e_003FAssetLoader_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AContentControl_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fa0b45743773945a3bb67ca6440ae9eadf9c00_003F50_003F9d315227_003FContentControl_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ADockFluentTheme_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fc13735b26c914624b4ee4a88a575ae253ae00_003Feb_003F23efc6b0_003FDockFluentTheme_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AFactory_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003Fe8b9e6b427dceb6f436414441b760d4dc52661df17f386ce4caa48aab354989_003FFactory_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AHtmlControl_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003F58931fa041a846b53462c4c4c5f52620bf9de09eff582aa4b1ed83c83e4e10ea_003FHtmlControl_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AIAssetLoader_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003Fda232ecc044f4c3d8e856366253516531d2800_003F_005F27262_003FIAssetLoader_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AIFactory_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003F52dbc4b2fb874f79fb4fec0b07cf7f6ca6ac95616e1d164ef210a0645a1aa9_003FIFactory_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ANetworkInformation_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F5b1b048ea0e94b28ad7cbac8ef6bc4c26e00_003Fb4_003Fff405095_003FNetworkInformation_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AProportionalDock_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FSourcesCache_003F91c655b1795150937d9264ac1431c463ed5e5e8ad0286ad17e16f16175d94_003FProportionalDock_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
......
......@@ -47,6 +47,7 @@ public partial class App : Application
var path = Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "blacklight", "login.json");
try
{
Console.WriteLine("Deleting login.json");
File.Delete(path);
}
catch (Exception ex)
......
Blacklight/Assets/dead.png

3.73 KiB

......@@ -2,6 +2,8 @@
using System.IO;
using System.Threading;
using System.Windows.Input;
using Avalonia.Media.Imaging;
using Avalonia.Platform;
using Avalonia.Threading;
using Blacklight.Util;
using Blacklight.Views.Login;
......@@ -31,6 +33,7 @@ public class LoginViewModel : ViewModelBase
private string _password = string.Empty;
private string? _loginError;
private string _loadingText = "Loading...";
private bool _loadingError;
public string Email
{
......@@ -56,6 +59,12 @@ public class LoginViewModel : ViewModelBase
set => SetProperty(ref _networkError, value);
}
public bool LoadingError
{
get => _loadingError;
set => SetProperty(ref _loadingError, value);
}
public string? LoginError
{
get => _loginError;
......@@ -96,6 +105,7 @@ public class LoginViewModel : ViewModelBase
var network = await Client.GetNetworkAsync(new Uri(persistentData.NetworkBase));
if (network.success)
{
Client.UseToken(null, "temp");
Client.NetworkInformation = network.networkInformation;
Client.UseToken(persistentData.AccessToken, persistentData.RefreshToken);
Console.WriteLine("Found token, showing ClientView");
......@@ -104,7 +114,8 @@ public class LoginViewModel : ViewModelBase
}
else
{
LoadingText = $"Failed to connect to network :< ({network.error})";
LoadingText = $"{network.error}";
LoadingError = true;
}
}
......@@ -132,6 +143,25 @@ public class LoginViewModel : ViewModelBase
set => SetProperty(ref _loadingText, value);
}
public ICommand ErrorResetCommand => new RelayCommand(ErrorReset);
private void ErrorReset()
{
Client.LogOut();
Client.RunLogOut();
var path = Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "blacklight", "login.json");
try
{
Console.WriteLine("Deleting login.json");
File.Delete(path);
}
catch (Exception ex)
{
Console.Error.WriteLine(ex);
}
UseSolstice();
}
private async void Login()
{
......
......@@ -8,7 +8,7 @@
x:Class="Blacklight.Views.Login.Loading"
x:DataType="viewModels:LoginViewModel">
<StackPanel HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<gif:GifImage HorizontalAlignment="Center" VerticalAlignment="Center" Source="avares://Blacklight/Assets/loading.gif" >
<gif:GifImage IsVisible="{Binding !LoadingError}" HorizontalAlignment="Center" VerticalAlignment="Center" Source="avares://Blacklight/Assets/loading.gif">
<gif:GifImage.Effect>
<DropShadowEffect Color="#FFFFFF"
BlurRadius="50"
......@@ -16,6 +16,16 @@
Opacity="0.5"/>
</gif:GifImage.Effect>
</gif:GifImage>
<TextBlock HorizontalAlignment="Center" Text="{Binding LoadingText, FallbackValue='Loading...'}" />
<Image IsVisible="{Binding LoadingError}" MaxHeight="219" HorizontalAlignment="Center" VerticalAlignment="Center" Source="avares://Blacklight/Assets/dead.png">
<Image.Effect>
<DropShadowEffect Color="#FFFFFF"
BlurRadius="50"
OffsetX="0" OffsetY="0"
Opacity="0.5"/>
</Image.Effect>
</Image>
<TextBlock TextWrapping="Wrap" HorizontalAlignment="Center" Text="{Binding LoadingText, FallbackValue='Loading...'}" />
<Button HorizontalAlignment="Center" IsVisible="{Binding LoadingError}" Command="{Binding ErrorResetCommand}">Log out</Button>
</StackPanel>
</UserControl>
......@@ -26,14 +26,14 @@
<ResourceDictionary>
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Light">
<SolidColorBrush x:Key="RightBeltColor">#F2e9e9e9</SolidColorBrush>
<SolidColorBrush x:Key="NavBarColor">#F2D4DCE2</SolidColorBrush>
<SolidColorBrush x:Key="RightBeltColor">#E2e9e9e9</SolidColorBrush>
<SolidColorBrush x:Key="NavBarColor">#E2D4DCE2</SolidColorBrush>
<SolidColorBrush x:Key="NavBarBorderColor">#e1e0dd</SolidColorBrush>
<SolidColorBrush x:Key="ResourceExplorerColor">#F2e9e9e9</SolidColorBrush>
<SolidColorBrush x:Key="ResourceExplorerColor">#E2e9e9e9</SolidColorBrush>
<SolidColorBrush x:Key="ResourceExplorerBorderColor">#e1e0dd</SolidColorBrush>
<SolidColorBrush x:Key="BottomBarColor">#e9e9e9</SolidColorBrush>
<SolidColorBrush x:Key="DocumentColor">#E6e9e9e9</SolidColorBrush>
<SolidColorBrush x:Key="TabStripColor">#F2e9e9e9</SolidColorBrush>
<SolidColorBrush x:Key="DocumentColor">#D6e9e9e9</SolidColorBrush>
<SolidColorBrush x:Key="TabStripColor">#E2e9e9e9</SolidColorBrush>
<SolidColorBrush x:Key="TabPointerOverColor">#1E00FF00</SolidColorBrush>
<SolidColorBrush x:Key="DockApplicationAccentBrushLow">Transparent</SolidColorBrush>
<SolidColorBrush x:Key="DockApplicationAccentBrushMed">Transparent</SolidColorBrush>
......
......@@ -78,11 +78,12 @@ public partial class Client : ObservableObject
}
}
}
Console.WriteLine($"Detected {e.PropertyName} change");
if (e.PropertyName == "RefreshToken" && RefreshToken == null && OnLogOut != null)
if (e.PropertyName == "RefreshToken" && RefreshToken == null)
{
OnLogOut.Invoke();
_refreshTimer?.Dispose();
Console.WriteLine("Detected LogOut");
RunLogOut();
}
base.OnPropertyChanged(e);
}
......
......@@ -46,7 +46,7 @@ public partial class Client
}
}
public async void UseToken(string accessToken, string refreshToken)
public void UseToken(string? accessToken, string refreshToken)
{
RefreshToken = refreshToken;
AccessToken = accessToken;
......@@ -96,4 +96,11 @@ public partial class Client
AccessToken = null;
RefreshToken = null;
}
public void RunLogOut()
{
Console.WriteLine("Logging out!");
OnLogOut?.Invoke();
_refreshTimer?.Dispose();
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment