Skip to content

Commit

Permalink
Change MVVM framework, finish MVP
Browse files Browse the repository at this point in the history
  • Loading branch information
tylercamp committed Dec 19, 2022
1 parent 166ef7c commit 05f2f83
Show file tree
Hide file tree
Showing 23 changed files with 660 additions and 659 deletions.
12 changes: 11 additions & 1 deletion ezgpuctl/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using Serilog;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
Expand All @@ -13,5 +14,14 @@ namespace GPUControl
/// </summary>
public partial class App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
Serilog.Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.WriteTo.Debug()
.CreateLogger();

base.OnStartup(e);
}
}
}
6 changes: 3 additions & 3 deletions ezgpuctl/Controls/OcEditorView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@

IsEnabled="{Binding CanChangePowerTarget}"
IsSnapToTickEnabled="True"
Value="{Binding PowerTarget, Mode=TwoWay}"
Value="{Binding PowerTargetDisplayValue, Mode=TwoWay}"
Minimum="{Binding PowerTargetRange.Min}" Maximum="{Binding PowerTargetRange.Max}"

Margin="10,0,10,0"
Expand Down Expand Up @@ -92,7 +92,7 @@
VerticalAlignment="Center"
IsEnabled="{Binding CanChangeCoreClockOffset}"
Height="18"
Value="{Binding CoreClockOffset, Mode=TwoWay}"
Value="{Binding CoreClockOffsetDisplayValue, Mode=TwoWay}"
Minimum="{Binding CoreClockOffsetRange.Min}"
Maximum="{Binding CoreClockOffsetRange.Max}"
IsSnapToTickEnabled="True"
Expand Down Expand Up @@ -125,7 +125,7 @@
VerticalAlignment="Center"
IsEnabled="{Binding CanChangeMemoryClockOffset}"
Height="18"
Value="{Binding MemoryClockOffset, Mode=TwoWay}"
Value="{Binding MemoryClockOffsetDisplayValue, Mode=TwoWay}"
Minimum="{Binding MemoryClockOffsetRange.Min}"
Maximum="{Binding MemoryClockOffsetRange.Max}"
IsSnapToTickEnabled="True"
Expand Down
34 changes: 16 additions & 18 deletions ezgpuctl/Controls/OcPolicyEditorWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
mc:Ignorable="d"
WindowStartupLocation="CenterOwner"
d:DataContext="{d:DesignInstance Type=controls:OcPolicyEditorWindowViewModel, IsDesignTimeCreatable=True}"
Title="Edit Policy" Height="463" Width="563">
Title="Edit Policy" Height="477" Width="950">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="13*"/>
<RowDefinition Height="2*"/>
<RowDefinition Height="30"/>
</Grid.RowDefinitions>
<TextBox Margin="10,10,10,10" TextWrapping="Wrap" FontSize="20" Text="{Binding Policy.Name, Mode=TwoWay}" VerticalAlignment="Top" Height="29"/>

Expand All @@ -29,11 +29,12 @@
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="331*" />
<ColumnDefinition Width="5"/>
<ColumnDefinition Width="100"/>
</Grid.ColumnDefinitions>

<StackPanel Grid.ColumnSpan="2" Grid.Row="0" Orientation="Horizontal" Margin="0,5,0,5">
<StackPanel Grid.ColumnSpan="3" Grid.Row="0" Orientation="Horizontal" Margin="0,5,0,5">
<StackPanel.Resources>
<Style TargetType="{x:Type Button}">
<Setter Property="Margin" Value="5,0,0,0" />
Expand All @@ -51,28 +52,26 @@
</ContextMenu>
</Button.ContextMenu>
</Button>

<Button Content="Edit" IsEnabled="{Binding HasSelectedEditableProfile}" />
<Button Content="Remove" IsEnabled="{Binding CanRemoveProfile}" Click="RemoveProfileButton_Click" />
<Button Content="Remove" Command="{Binding RemoveProfile}" />
</StackPanel>

<StackPanel Grid.Column="1" Margin="0,10,10,0" Grid.Row="1">
<StackPanel Grid.Column="2" Margin="0,10,10,0" Grid.Row="1">
<StackPanel.Resources>
<Style TargetType="{x:Type Button}">
<Setter Property="Margin" Value="0,0,0,5" />
</Style>
</StackPanel.Resources>

<Button Content="Move Up" IsEnabled="{Binding CanMoveUp}" Click="MoveProfileUpButton_Click" />
<Button Content="Move Down" IsEnabled="{Binding CanMoveDown}" Click="MoveProfileDownButton_Click" />
<Button Content="Move Up" Command="{Binding MoveProfileUp}" />
<Button Content="Move Down" Command="{Binding MoveProfileDown}" />

<Button Content="..." Visibility="Hidden" />

<Button Content="Move to Top" IsEnabled="{Binding CanMoveToTop}" Click="MoveProfileTopButton_Click" />
<Button Content="Move to Bottom" IsEnabled="{Binding CanMoveToBottom}" Click="MoveProfileBottomButton_Click" />
<Button Content="Move to Top" Command="{Binding MoveProfileTop}" />
<Button Content="Move to Bottom" Command="{Binding MoveProfileBottom}" />
</StackPanel>

<ListBox Grid.Column="0" ItemsSource="{Binding Policy.PendingProfiles}" SelectedItem="{Binding SelectedProfile, Mode=TwoWay}" Grid.Row="1">
<ListBox Grid.Column="0" ItemsSource="{Binding Policy.Profiles}" SelectedItem="{Binding SelectedProfile, Mode=TwoWay}" Grid.Row="1">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Label}" />
Expand All @@ -96,10 +95,10 @@
</StackPanel.Resources>

<Button Content="Add" IsEnabled="{Binding CanAddRule}" HorizontalAlignment="Left" VerticalAlignment="Top" Width="60" Click="AddProgramButton_Click"/>
<Button Content="Remove" IsEnabled="{Binding HasSelectedRule}" HorizontalAlignment="Left" VerticalAlignment="Top" Width="60" Click="RemoveProgramButton_Click" />
<Button Content="Remove" Command="{Binding RemoveRule}" HorizontalAlignment="Left" VerticalAlignment="Top" Width="60" />
</StackPanel>

<ListView Grid.Row="1" ItemsSource="{Binding Policy.PendingRules}" SelectedItem="{Binding SelectedRule, Mode=TwoWay}">
<ListView Grid.Row="1" ItemsSource="{Binding Policy.Rules}" SelectedItem="{Binding SelectedRule, Mode=TwoWay}">
<ListView.View>
<GridView>
<GridView.ColumnHeaderContainerStyle>
Expand Down Expand Up @@ -128,9 +127,8 @@
</GroupBox>
</Grid>

<Button Content="Save" Margin="0,27,24,0" Grid.Row="2" VerticalAlignment="Top" HorizontalAlignment="Right" Width="29" Click="SaveButton_Click"/>
<Button Content="Cancel" Margin="0,27,80,0" Grid.Row="2" VerticalAlignment="Top" HorizontalAlignment="Right" Width="39"/>
<Button Content="Revert" Margin="0,27,212,0" Grid.Row="2" VerticalAlignment="Top" HorizontalAlignment="Right" Width="37"/>
<Button Content="Save" Margin="0,0,10,3" Grid.Row="2" HorizontalAlignment="Right" Width="29" Click="SaveButton_Click" Height="20" VerticalAlignment="Bottom"/>
<Button Content="Cancel" Margin="0,0,44,3" Grid.Row="2" HorizontalAlignment="Right" Width="39" Height="20" VerticalAlignment="Bottom"/>

</Grid>
</Window>
Loading

0 comments on commit 05f2f83

Please sign in to comment.