- Notifications
You must be signed in to change notification settings - Fork3
added new settings dialog + settings manager#113
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
changed order of CredentialManager loading
9037758
tobad5320
CompareUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
string exe = Process.GetCurrentProcess().MainModule!.FileName; | ||
try | ||
{ | ||
using var key = Registry.CurrentUser.OpenSubKey(RunKey, writable: true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Is there any (easy) way we can clean this up on uninstall?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
We can, but this will also basically clear the setting every team you update (I believe you run the uninstall then too, right)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Follow up here:#121
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
App/Services/SettingsManager.cs Outdated
/// </summary> | ||
bool ConnectOnLaunch { get; set; } | ||
/// <returns></returns> | ||
public T? GetFromCache(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Rather than have this,Read
should probably return from cache by default. I know this goes against a point I made in a previous review but if we're going with the Read/Write API then it should just be all in
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Also, Read should probably not fail if it failed to read/parse the file. IDK what good behavior is, but I think for now just returning a default config is OK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This is definitely going against this comment :D
#113 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I'm like 50/50 on whether we should crash or just use the default config... IDK what the best option is. For now with a single option maybe it's fine to just keep going, but in the future if we add config options that are more sensitive to being clobbered it might be bad to just ignore a parse failure...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
it throws an exception now and I think that's OK considering - if you fail to operate the file there's a high likelihood that the feature won't work ata ll.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I think that's fair. We can revisit this if it's causing issues
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
public interface ISettings | ||
{ | ||
/// <summary> | ||
///Gets the version ofthe settingsschema. | ||
///FileName wherethe settingsare stored. | ||
/// </summary> | ||
int Version { get; } | ||
static abstract string SettingsFileName { get; } | ||
/// <summary> | ||
///FileName wherethe settingsare stored. | ||
///Gets the version ofthe settingsschema. | ||
/// </summary> | ||
static abstract string SettingsFileName { get; } | ||
int Version { get; } | ||
ISettings Clone(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
You could separate this intoISettings
with theVersion
field, and a new interface likeICloneable<T>
publicinterfaceICloneable<T>{TClone();}
which avoids the casting required after callingClone()
inRead()
// deserialize; fall back to default(T) if empty or malformed | ||
var result = JsonSerializer.Deserialize<T>(json)!; | ||
_cachedSettings = result; | ||
return result; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Needs to be cloned.
@@ -1,4 +1,5 @@ | |||
using Google.Protobuf.WellKnownTypes; | |||
using Serilog; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I think this got added by mistake, I can't see any code that uses it
{ | ||
_connectSettings = settingsCache.Clone(); | ||
} | ||
var settingsCache = settingsManager.Read(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This code seems like it's not doing anything. Read is async, and_connectSettings
doesn't get populated. It's not going to be easy cuz it's async but there are existing patterns in other view models with async gets in the ctor
Uh oh!
There was an error while loading.Please reload this page.
Closes:#57 7
Adds: