-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Maintenance and font adjustments (#86)
#84 adjust font sizes fix height on properties page add fallback for user logged in status fix typo in readme
- Loading branch information
1 parent
a7ed341
commit b537e1b
Showing
23 changed files
with
674 additions
and
584 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
using Avalonia.Controls; | ||
using FluentAvalonia.UI.Controls; | ||
using KeyVaultExplorer.Views.Pages; | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace KeyVaultExplorer.ViewModels; | ||
|
||
public class NavigationFactory : INavigationPageFactory | ||
{ | ||
// Do this to avoid needing Activator.CreateInstance to create from type info | ||
// and to avoid a ridiculous amount of 'ifs' | ||
private readonly Control[] _pages = | ||
{ | ||
new MainPage(), | ||
new SubscriptionsPage(), | ||
new SettingsPage(), | ||
}; | ||
|
||
private readonly Dictionary<string, Func<Control>> CorePages = new Dictionary<string, Func<Control>> | ||
{ | ||
{ "MainPage", () => new MainPage() }, | ||
{ "SubscriptionsPage", () => new SubscriptionsPage() }, | ||
{ "SettingsPage", () => new SettingsPage() }, | ||
}; | ||
|
||
public NavigationFactory() | ||
{ | ||
Instance = this; | ||
} | ||
|
||
private static NavigationFactory? Instance { get; set; } | ||
|
||
public static Control[] GetPages() | ||
{ | ||
return Instance!._pages; | ||
} | ||
|
||
// Create a page based on a Type, but you can create it however you want | ||
public Control? GetPage(Type srcType) | ||
{ | ||
// Return null here because we won't use this method at all | ||
CorePages.TryGetValue(srcType.FullName, out var func); | ||
Control page = null; | ||
page = func(); | ||
return page; | ||
} | ||
|
||
// Create a page based on an object, such as a view model | ||
public Control? GetPageFromObject(object target) | ||
{ | ||
return target switch | ||
{ | ||
MainPage => _pages[0], | ||
SubscriptionsPage => _pages[1], | ||
SettingsPage => _pages[2], | ||
|
||
_ => throw new Exception() | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<UserControl | ||
x:Class="KeyVaultExplorer.Views.CustomControls.UserStatusTag" | ||
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:models="clr-namespace:KeyVaultExplorer.Models;assembly=KeyVaultExplorer" | ||
xmlns:ui="using:FluentAvalonia.UI.Controls" | ||
xmlns:vm="using:KeyVaultExplorer.ViewModels" | ||
d:DesignHeight="150" | ||
d:DesignWidth="925" | ||
x:DataType="vm:MainViewModel" | ||
mc:Ignorable="d"> | ||
|
||
<Design.DataContext> | ||
<vm:MainViewModel /> | ||
</Design.DataContext> | ||
|
||
|
||
<StackPanel | ||
Grid.Row="1" | ||
HorizontalAlignment="Stretch" | ||
Background="{DynamicResource SolidBackgroundFillColorTertiaryBrush}" | ||
IsHitTestVisible="False"> | ||
|
||
<StackPanel | ||
HorizontalAlignment="Right" | ||
IsVisible="{Binding !IsAuthenticated}" | ||
Orientation="Horizontal"> | ||
<ui:BitmapIcon | ||
Width="16" | ||
Height="16" | ||
VerticalAlignment="Bottom" | ||
RenderOptions.BitmapInterpolationMode="HighQuality" | ||
UriSource="avares://KeyVaultExplorer/Assets/StatusErrorOutline.png" /> | ||
<TextBlock | ||
Margin="4,0" | ||
Background="{x:Null}" | ||
FontSize="{StaticResource FontSizeSmall}" | ||
Text="You are currently signed out" | ||
Theme="{StaticResource CaptionTextBlockStyle}" /> | ||
</StackPanel> | ||
|
||
|
||
<StackPanel | ||
HorizontalAlignment="Right" | ||
IsVisible="{Binding IsAuthenticated}" | ||
Orientation="Horizontal"> | ||
<ui:BitmapIcon | ||
Width="16" | ||
Height="16" | ||
Margin="0,2,0,0" | ||
VerticalAlignment="Bottom" | ||
IsVisible="{Binding AuthenticatedUserClaims.TenantId}" | ||
RenderOptions.BitmapInterpolationMode="HighQuality" | ||
ShowAsMonochrome="True" | ||
UriSource="avares://KeyVaultExplorer/Assets/Cloud.png" /> | ||
<TextBlock | ||
Margin="5,0" | ||
Background="{x:Null}" | ||
FontSize="{StaticResource FontSizeSmall}" | ||
Text="{Binding AuthenticatedUserClaims.Email}" | ||
Theme="{StaticResource CaptionTextBlockStyle}" /> | ||
</StackPanel> | ||
</StackPanel> | ||
|
||
</UserControl> |
19 changes: 19 additions & 0 deletions
19
KeyVaultExplorer/Views/CustomControls/UserStatusTag.axaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using Avalonia.Controls; | ||
using Avalonia.Interactivity; | ||
using Avalonia.Threading; | ||
using KeyVaultExplorer.ViewModels; | ||
using KeyVaultExplorer.Services; | ||
using System; | ||
using System.ComponentModel; | ||
using System.ComponentModel.Design.Serialization; | ||
|
||
namespace KeyVaultExplorer.Views.CustomControls; | ||
|
||
public partial class UserStatusTag : UserControl | ||
{ | ||
public UserStatusTag() | ||
{ | ||
InitializeComponent(); | ||
DataContext = Defaults.Locator.GetRequiredService<MainViewModel>(); | ||
} | ||
} |
Oops, something went wrong.