Skip to content

Improved settings model code regions #2825

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 3, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 55 additions & 40 deletions Files/ViewModels/SettingsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public async void DetectQuickLook()
catch (Exception ex)
{
NLog.LogManager.GetCurrentClassLogger().Warn(ex, ex.Message);
}
}
}

private void DetectRecycleBinPreference()
Expand Down Expand Up @@ -229,23 +229,7 @@ public TimeStyle DisplayedTimeStyle
}
}

public string OneDriveCommercialPath { get; set; } = Environment.GetEnvironmentVariable("OneDriveCommercial");
public string OneDrivePath { get; set; } = Environment.GetEnvironmentVariable("OneDriveConsumer");

public bool ShowFileOwner
{
get => Get(false);
set => Set(value);
}

/// <summary>
/// Gets or sets a value indicating whether or not to cache files and folders.
/// </summary>
public bool UseFileListCache
{
get => Get(false);
set => Set(value);
}
#region DetailsView Column Settings

/// <summary>
/// Gets or sets a value indicating whether or not the date column should be visible.
Expand Down Expand Up @@ -274,10 +258,12 @@ public bool ShowSizeColumn
set => Set(value);
}

#region CommonPaths
#endregion

// Any distinguishable path here is fine
#region CommonPaths

public string OneDriveCommercialPath { get; set; } = Environment.GetEnvironmentVariable("OneDriveCommercial");
public string OneDrivePath { get; set; } = Environment.GetEnvironmentVariable("OneDriveConsumer");
public string DesktopPath { get; set; } = UserDataPaths.GetDefault().Desktop;
public string DocumentsPath { get; set; } = UserDataPaths.GetDefault().Documents;
public string DownloadsPath { get; set; } = UserDataPaths.GetDefault().Downloads;
Expand Down Expand Up @@ -601,30 +587,30 @@ public bool ShowOpenInNewTabMenuItem

#endregion Appearance

#region Experimental

/// <summary>
/// Gets or sets a value indicating whether or not WSL is supported.
/// Gets or sets a value indicating whether or not to show the item owner in the properties window.
/// </summary>
public bool AreLinuxFilesSupported
public bool ShowFileOwner
{
get => Get(false);
set => Set(value);
}

public bool OpenNewTabPageOnStartup
{
get => Get(true);
set => Set(value);
}

/// <summary>
/// Gets or sets a value indicating whether or not to show a teaching tip informing the user about the status center.
/// Gets or sets a value indicating whether or not to cache files and folders.
/// </summary>
public bool ShowStatusCenterTeachingTip
public bool UseFileListCache
{
get => Get(true);
set => Set(value);
}

#endregion Experimental

#region Startup

/// <summary>
/// Gets or sets a value indicating whether or not to navigate to a specific location when launching the app.
/// </summary>
Expand All @@ -635,29 +621,29 @@ public bool OpenASpecificPageOnStartup
}

/// <summary>
/// Gets or sets a value indicating whether or not continue the last session whenever the app is launched.
/// Gets or sets a value indicating the default startup location.
/// </summary>
public bool ContinueLastSessionOnStartUp
public string OpenASpecificPageOnStartupPath
{
get => Get(false);
get => Get("");
set => Set(value);
}

/// <summary>
/// Gets or sets a value indicating whether or not to restore tabs after restarting the app.
/// Gets or sets a value indicating whether or not continue the last session whenever the app is launched.
/// </summary>
public bool ResumeAfterRestart
public bool ContinueLastSessionOnStartUp
{
get => Get(false);
set => Set(value);
}

/// <summary>
/// Gets or sets a value indicating the default startup location.
/// Gets or sets a value indicating whether or not to open a page when the app is launched.
/// </summary>
public string OpenASpecificPageOnStartupPath
public bool OpenNewTabPageOnStartup
{
get => Get("");
get => Get(true);
set => Set(value);
}

Expand All @@ -669,7 +655,7 @@ public bool AlwaysOpenANewInstance
get => Get(false);
set => Set(value);
}

public string[] PagesOnStartupList
{
get => Get<string[]>(null);
Expand All @@ -682,6 +668,35 @@ public string[] LastSessionPages
set => Set(value);
}

#endregion Startup

/// <summary>
/// Gets or sets a value indicating whether or not WSL is supported.
/// </summary>
public bool AreLinuxFilesSupported
{
get => Get(false);
set => Set(value);
}

/// <summary>
/// Gets or sets a value indicating whether or not to show a teaching tip informing the user about the status center.
/// </summary>
public bool ShowStatusCenterTeachingTip
{
get => Get(true);
set => Set(value);
}

/// <summary>
/// Gets or sets a value indicating whether or not to restore tabs after restarting the app.
/// </summary>
public bool ResumeAfterRestart
{
get => Get(false);
set => Set(value);
}

public event EventHandler ThemeModeChanged;

public RelayCommand UpdateThemeElements => new RelayCommand(() =>
Expand Down Expand Up @@ -801,4 +816,4 @@ public void Dispose()
DrivesManager?.Dispose();
}
}
}
}