mirror of
https://github.com/Microsoft/calculator.git
synced 2025-07-08 06:00:45 -07:00
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:
parent
9d7d3a6b79
commit
80015d227f
19 changed files with 998 additions and 676 deletions
|
@ -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();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue