Improve the Recall support (#2245)

* stash changes

* stash changes

* pass build

* set snapshot

* stash changes

* update launch utils

* stash changes

* stash changes

* renaming

* DeflateUtils

* stash changes

* deserialization

* restore session

* connect ui

* handle errors

* rename CalcManagerHistoryToken

* handle optional props

* fix optional props

* ensure error state

* resolve a comment

* resolve a comment
This commit is contained in:
Tian L. 2024-11-07 17:04:01 +08:00 committed by GitHub
parent 9d7d3a6b79
commit 80015d227f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 998 additions and 676 deletions

View file

@ -3,6 +3,7 @@
#pragma once
#include "Snapshots.h"
#include "StandardCalculatorViewModel.h"
#include "DateCalculatorViewModel.h"
#include "GraphingCalculator/GraphingCalculatorViewModel.h"
@ -12,19 +13,13 @@ namespace CalculatorApp
{
namespace ViewModel
{
struct ApplicationSnapshot
{
int SnapshotVersion;
int Mode;
std::optional<StandardCalculatorSnapshot> StandardCalc;
};
[Windows::UI::Xaml::Data::Bindable] public ref class ApplicationViewModel sealed : public Windows::UI::Xaml::Data::INotifyPropertyChanged
{
public:
ApplicationViewModel();
void Initialize(CalculatorApp::ViewModel::Common::ViewMode mode); // Use for first init, use deserialize for rehydration
void RestoreFromSnapshot(CalculatorApp::ViewModel::Snapshot::ApplicationSnapshot^ snapshot);
OBSERVABLE_OBJECT();
OBSERVABLE_PROPERTY_RW(StandardCalculatorViewModel ^, CalculatorViewModel);
@ -77,6 +72,11 @@ namespace CalculatorApp
}
}
property CalculatorApp::ViewModel::Snapshot::ApplicationSnapshot ^ Snapshot
{
CalculatorApp::ViewModel::Snapshot::ApplicationSnapshot ^ get();
}
static property Platform::String ^ LaunchedLocalSettings
{
Platform::String ^ get()
@ -103,9 +103,6 @@ namespace CalculatorApp
void ToggleAlwaysOnTop(float width, float height);
Windows::Data::Json::JsonObject ^ SaveApplicationSnapshot();
bool TryRestoreFromSnapshot(Windows::Data::Json::JsonObject ^ jsonObject);
private:
bool TryRecoverFromNavigationModeFailure();