Skip to content

Commit

Permalink
Improve a little restting dashboard to defaults.
Browse files Browse the repository at this point in the history
  • Loading branch information
BartoszCichecki committed Jun 21, 2023
1 parent cc3318e commit a485757
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion LenovoLegionToolkit.WPF/Pages/DashboardPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ private async Task RefreshAsync()
_content.RowDefinitions.Clear();
_content.Children.Clear();

var groups = _dashboardSettings.Store.Groups;
var groups = _dashboardSettings.Store.Groups ?? DashboardGroup.DefaultGroups;

if (Log.Instance.IsTraceEnabled)
{
Expand Down
2 changes: 1 addition & 1 deletion LenovoLegionToolkit.WPF/Settings/DashboardSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public class DashboardSettings : AbstractSettings<DashboardSettings.DashboardSet
{
public class DashboardSettingsStore
{
public DashboardGroup[] Groups { get; set; } = DashboardGroup.DefaultGroups;
public DashboardGroup[]? Groups { get; set; }
}

protected override DashboardSettingsStore Default => new();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public partial class EditDashboardWindow

public EditDashboardWindow()
{
_groups = _dashboardSettings.Store.Groups;
_groups = _dashboardSettings.Store.Groups ?? DashboardGroup.DefaultGroups;

InitializeComponent();

Expand Down Expand Up @@ -74,9 +74,12 @@ private async void AddButton_Click(object sender, RoutedEventArgs e)

private async void DefaultButton_Click(object sender, RoutedEventArgs e)
{
_groups = DashboardGroup.DefaultGroups;
_dashboardSettings.Store.Groups = null;
_dashboardSettings.SynchronizeStore();

Close();

await RefreshAsync();
Apply?.Invoke(this, EventArgs.Empty);
}

private void ApplyButton_Click(object sender, RoutedEventArgs e)
Expand All @@ -94,10 +97,7 @@ private void ApplyButton_Click(object sender, RoutedEventArgs e)
Apply?.Invoke(this, EventArgs.Empty);
}

private void CancelButton_Click(object sender, RoutedEventArgs e)
{
Close();
}
private void CancelButton_Click(object sender, RoutedEventArgs e) => Close();

private IEnumerable<DashboardItem> GetAllItems() =>
_groupsStackPanel.Children
Expand Down

0 comments on commit a485757

Please sign in to comment.