Skip to content

Commit

Permalink
Persist app zone history in real time (microsoft#1257)
Browse files Browse the repository at this point in the history
* save settings every time changes are performed
* settings are not saved on app exit
  • Loading branch information
SeraphimaZykova authored and udit3333 committed Feb 20, 2020
1 parent a457899 commit 4df0d0c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/modules/fancyzones/dll/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,6 @@ class FancyZonesModule : public PowertoyModuleIface
void Disable(bool const traceEvent)
{
if (m_app) {
const auto& fancyZonesData = JSONHelpers::FancyZonesDataInstance();
fancyZonesData.SaveFancyZonesData();
if (traceEvent)
{
Trace::FancyZones::EnableFancyZones(false);
Expand Down
3 changes: 3 additions & 0 deletions src/modules/fancyzones/lib/JsonHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ namespace JSONHelpers
if (data.zoneSetUuid == zoneSetId && data.deviceId == deviceId)
{
appZoneHistoryMap.erase(processPath);
SaveFancyZonesData();
return true;
}
}
Expand All @@ -224,6 +225,7 @@ namespace JSONHelpers
}

appZoneHistoryMap[processPath] = AppZoneHistoryData{ .zoneSetUuid = zoneSetId, .deviceId = deviceId, .zoneIndex = zoneIndex };
SaveFancyZonesData();
return true;
}

Expand Down Expand Up @@ -538,6 +540,7 @@ namespace JSONHelpers
if (appliedZoneSetsMap.contains(std::wstring{ activeZoneSetId }))
{
deviceInfoMap[deviceId] = DeviceInfoData{ appliedZoneSetsMap.at(std::wstring{ activeZoneSetId }), static_cast<bool>(showSpacing), static_cast<int>(spacing), static_cast<int>(zoneCount) };
SaveFancyZonesData();
}
}

Expand Down

0 comments on commit 4df0d0c

Please sign in to comment.