-
Notifications
You must be signed in to change notification settings - Fork 92
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
11 changed files
with
1,183 additions
and
197 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Windows.Foundation.Collections; | ||
using Windows.Storage; | ||
|
||
namespace ContextMenuCustomApp.Common | ||
{ | ||
|
||
public class Settings | ||
{ | ||
private readonly static IPropertySet settings; | ||
|
||
public readonly static Settings INS; | ||
static Settings() { | ||
settings = ApplicationData.Current.LocalSettings.CreateContainer("app-settings", ApplicationDataCreateDisposition.Always).Values; | ||
INS = new Settings(); | ||
} | ||
|
||
public bool CacheEnabled { | ||
get { | ||
return GetValue(nameof(CacheEnabled),false); | ||
} | ||
set { | ||
SetValue(nameof(CacheEnabled), value); | ||
} | ||
} | ||
|
||
private T GetValue<T>(string key,T defaultValue= default) { | ||
if (settings[key] is T value) { | ||
return value; | ||
} | ||
|
||
return defaultValue; | ||
} | ||
|
||
|
||
private T SetValue<T>(string key, T value) | ||
{ | ||
settings[key] = value; | ||
return value; | ||
} | ||
|
||
|
||
} | ||
} |
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
Oops, something went wrong.