Skip to content

Commit

Permalink
Fix CL supported not saving (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
integralfx authored Mar 17, 2021
1 parent ed3b472 commit 79b436a
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 5 deletions.
2 changes: 1 addition & 1 deletion DDR4SPD/XMP.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public bool SetCLSupported(int cl, bool supported)
return false;
}

int[] mask = { 1, 2, 4, 8, 16, 32, 64 };
int[] mask = { 1, 2, 4, 8, 16, 32, 64, 128 };
if (cl >= 7 && cl <= 14)
{
if (supported)
Expand Down
12 changes: 10 additions & 2 deletions Pages/EditorViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using DDR4XMPEditor.DDR4SPD;
using DDR4XMPEditor.Events;
using Stylet;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Windows;
Expand Down Expand Up @@ -39,12 +41,18 @@ public void Handle(SelectedSPDFileEvent e)
xmpVm1.IsEnabled = SPD.XMP1Enabled;
SPD.Bind(x => x.XMP1Enabled, (s, args) => xmpVm1.IsEnabled = args.NewValue);
xmpVm1.Profile = SPD.XMP1;
xmpVm1.CLSupported = Enumerable.Range(0, 31).Select(cl => xmpVm1.Profile.IsCLSupported(cl)).ToArray();
for (int i = 0; i < xmpVm1.CLSupported.Count; ++i)
{
xmpVm1.CLSupported[i] = xmpVm1.Profile.IsCLSupported(i);
}

xmpVm2.IsEnabled = SPD.XMP2Enabled;
SPD.Bind(x => x.XMP2Enabled, (s, args) => xmpVm2.IsEnabled = args.NewValue);
xmpVm2.Profile = SPD.XMP2;
xmpVm2.CLSupported = Enumerable.Range(0, 31).Select(cl => xmpVm2.Profile.IsCLSupported(cl)).ToArray();
for (int i = 0; i < xmpVm2.CLSupported.Count; ++i)
{
xmpVm2.CLSupported[i] = xmpVm2.Profile.IsCLSupported(i);
}

BindNotifyPropertyChanged(xmpVm1);
BindNotifyPropertyChanged(xmpVm2);
Expand Down
2 changes: 1 addition & 1 deletion Pages/ShellView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
xmlns:s="https://github.com/canton7/Stylet"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance local:ShellViewModel}"
Title="DDR4 XMP Editor v0.2.0" Height="620" Width="360">
Title="DDR4 XMP Editor v0.2.1" Height="620" Width="360">
<StackPanel>
<ContentControl s:View.Model="{Binding MenuBar}"/>
<ContentControl s:View.Model="{Binding Editor}"/>
Expand Down
14 changes: 13 additions & 1 deletion Pages/XMPEditorViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using DDR4XMPEditor.DDR4SPD;
using Stylet;
using System;
using System.ComponentModel;
using System.Globalization;
using System.Linq;
using System.Windows.Data;

namespace DDR4XMPEditor.Pages
Expand All @@ -25,7 +27,17 @@ public double? Frequency
}
}

public bool[] CLSupported { get; set; }
public XMPEditorViewModel()
{
CLSupported = new BindingList<bool>(Enumerable.Range(0, 31).Select(n => false).ToList());
CLSupported.ListChanged += (s, e) =>
{
Profile.SetCLSupported(e.NewIndex, CLSupported[e.NewIndex]);
Refresh();
};
}

public BindingList<bool> CLSupported { get; private set; }

public int? tCL
{
Expand Down
Binary file modified ddr4xmpeditor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 79b436a

Please sign in to comment.