-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
91 additions
and
5 deletions.
There are no files selected for viewing
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,32 @@ | ||
<UserControl x:Class="CipherPunk.UI.ElevationView" | ||
x:ClassModifier="internal" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:ui="clr-namespace:CipherPunk.UI" | ||
d:DataContext="{d:DesignInstance Type=ui:ElevationViewModel}" | ||
mc:Ignorable="d" | ||
d:DesignHeight="450" d:DesignWidth="800"> | ||
<Grid> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="Auto"/> | ||
</Grid.RowDefinitions> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="*"/> | ||
</Grid.ColumnDefinitions> | ||
<Border Style="{StaticResource BorderStyle}" Grid.Row="0" Grid.Column="0"> | ||
<Expander Header="Current Process UAC Elevation Level"> | ||
<Grid> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="Auto"/> | ||
</Grid.RowDefinitions> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="Auto"/> | ||
</Grid.ColumnDefinitions> | ||
<ListBox Grid.Row="0" Grid.Column="0" ItemsSource="{Binding MandatoryLevels}" SelectedItem="{Binding MandatoryLevel, Mode=OneWay}" IsEnabled="False"/> | ||
</Grid> | ||
</Expander> | ||
</Border> | ||
</Grid> | ||
</UserControl> |
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,6 @@ | ||
namespace CipherPunk.UI; | ||
|
||
internal sealed partial class ElevationView | ||
{ | ||
public ElevationView() => InitializeComponent(); | ||
} |
33 changes: 33 additions & 0 deletions
33
CipherPunk.UI/UserControls/Elevation/ElevationViewModel.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,33 @@ | ||
namespace CipherPunk.UI; | ||
|
||
using System.Collections.ObjectModel; | ||
|
||
internal sealed class ElevationViewModel : BaseViewModel | ||
{ | ||
private ObservableCollection<MandatoryLevel>? mandatoryLevels; | ||
private MandatoryLevel? mandatoryLevel; | ||
|
||
public ElevationViewModel(ILogger logger, IUacService uacService) | ||
: base(logger, uacService) | ||
=> UpdateCanExecuteDefaultCommand(); | ||
|
||
public ObservableCollection<MandatoryLevel>? MandatoryLevels | ||
{ | ||
get => mandatoryLevels; | ||
private set => _ = SetProperty(ref mandatoryLevels, value); | ||
} | ||
|
||
public MandatoryLevel? MandatoryLevel | ||
{ | ||
get => mandatoryLevel; | ||
private set => _ = SetProperty(ref mandatoryLevel, value); | ||
} | ||
|
||
protected override Task DoExecuteDefaultCommandAsync(CancellationToken cancellationToken) | ||
{ | ||
MandatoryLevels ??= new(Enum.GetValues<MandatoryLevel>().OrderByDescending(q => (int)q)); | ||
(MandatoryLevel, _) = UacService.GetIntegrityLevel(); | ||
|
||
return Task.CompletedTask; | ||
} | ||
} |
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