Skip to content

Commit

Permalink
fixed logic for reboot request
Browse files Browse the repository at this point in the history
  • Loading branch information
sensboston committed Jul 9, 2015
1 parent 261b27d commit 71ed942
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 3 deletions.
17 changes: 17 additions & 0 deletions WPTweaker/Common/RegistryEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ public class RegistryEntry
public string Comparer { get; set; }
public Int64 Min { get; set; }
public Int64 Max { get; set; }
private bool _firstTime = true;
private dynamic _originalValue;
public static bool IsInteropUnlocked()
{
#if ARM
Expand Down Expand Up @@ -125,6 +127,14 @@ public bool IsSet
}
}

public bool IsChanged
{
get
{
return Value != _originalValue;
}
}

public void Reset() { Value = DefaultValue; }

public dynamic Value
Expand Down Expand Up @@ -198,6 +208,13 @@ public dynamic Value
{
Debug.WriteLine(string.Format("Reading registry key {0}\non path {1}\nreturned {2}\n", KeyName, string.Concat(Hive, "\\", KeyPath), result));
}

if (_firstTime)
{
_firstTime = false;
_originalValue = DataConverter.FromString(result, DataType);
}

return DataConverter.FromString(result, DataType);
}

Expand Down
8 changes: 8 additions & 0 deletions WPTweaker/Common/Tweak.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,14 @@ public dynamic DefaultValue
}
}

public bool IsChanged
{
get
{
return Entries.Count(e => e.RegEntry.IsChanged) > 0;
}
}

public string ValueToString
{
get
Expand Down
1 change: 1 addition & 0 deletions WPTweaker/Controls/EnumTweak.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ void ValueChanged(object sender, string hashedKeys)
{
_ignoreChange = true;
ValuesList.SelectedIndex = index;
_ignoreChange = false;
}
}
}
Expand Down
7 changes: 4 additions & 3 deletions WPTweaker/MainPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ protected override async void OnNavigatedTo(NavigationEventArgs e)
if (_settings.RunCount++ == 5)
{
if (MessageBox.Show("Would you like to support this project by installing and rating \"5 stars\" my apps from the store? "+
"It will take not more than five minutes of your time...\n\n"+
"I hope these appls will be useful for you\n\n" +
"It will take less than 5 minutes of your time...\n\n" +
"I hope you will like these apps\n\n" +
"Press [OK] to open store or [Cancel] to igonre this note", "Developer's note", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
{
await Launcher.LaunchUriAsync(new Uri("ms-windows-store:search?keyword=senssoft"));
Expand Down Expand Up @@ -200,7 +200,8 @@ void TweakValueChanged(object sender, string hashedKeys)
{
foreach (var tweak in _tweaks)
{
if (senderTweak != tweak && tweak.CheckForUpdate(hashedKeys)) _rebootCounter += tweak.RequireReboot;
if (senderTweak != tweak) tweak.CheckForUpdate(hashedKeys);
else _rebootCounter += tweak.RequireReboot * (tweak.IsChanged ? 1 : -1);
}
}
}
Expand Down

0 comments on commit 71ed942

Please sign in to comment.