mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-21 22:03:11 -07:00
fix optional props
This commit is contained in:
parent
c8cfe10ed0
commit
3bc92544d2
2 changed files with 7 additions and 4 deletions
|
@ -1792,7 +1792,10 @@ CalculatorApp::ViewModel::Snapshot::StandardCalculatorSnapshot ^ StandardCalcula
|
||||||
auto result = ref new CalculatorApp::ViewModel::Snapshot::StandardCalculatorSnapshot();
|
auto result = ref new CalculatorApp::ViewModel::Snapshot::StandardCalculatorSnapshot();
|
||||||
result->CalcManager = ref new CalculatorApp::ViewModel::Snapshot::CalcManagerSnapshot(m_standardCalculatorManager);
|
result->CalcManager = ref new CalculatorApp::ViewModel::Snapshot::CalcManagerSnapshot(m_standardCalculatorManager);
|
||||||
result->PrimaryDisplay = ref new CalculatorApp::ViewModel::Snapshot::PrimaryDisplaySnapshot(m_DisplayValue, m_IsInError);
|
result->PrimaryDisplay = ref new CalculatorApp::ViewModel::Snapshot::PrimaryDisplaySnapshot(m_DisplayValue, m_IsInError);
|
||||||
|
if (!m_tokens->empty() && !m_commands->empty())
|
||||||
|
{
|
||||||
result->ExpressionDisplay = ref new CalculatorApp::ViewModel::Snapshot::ExpressionDisplaySnapshot(*m_tokens, *m_commands);
|
result->ExpressionDisplay = ref new CalculatorApp::ViewModel::Snapshot::ExpressionDisplaySnapshot(*m_tokens, *m_commands);
|
||||||
|
}
|
||||||
result->DisplayCommands = ref new Platform::Collections::Vector<CalculatorApp::ViewModel::Snapshot::ICalcManagerIExprCommand ^>();
|
result->DisplayCommands = ref new Platform::Collections::Vector<CalculatorApp::ViewModel::Snapshot::ICalcManagerIExprCommand ^>();
|
||||||
for (auto cmd : m_standardCalculatorManager.GetDisplayCommandsSnapshot())
|
for (auto cmd : m_standardCalculatorManager.GetDisplayCommandsSnapshot())
|
||||||
{
|
{
|
||||||
|
|
|
@ -162,7 +162,7 @@ namespace CalculatorApp.JsonUtils
|
||||||
[JsonPropertyName("h")]
|
[JsonPropertyName("h")]
|
||||||
public IEnumerable<CalcManagerHistoryItemAlias> HistoryItems // optional
|
public IEnumerable<CalcManagerHistoryItemAlias> HistoryItems // optional
|
||||||
{
|
{
|
||||||
get => Value?.HistoryItems.Select(x => new CalcManagerHistoryItemAlias { Value = x });
|
get => Value.HistoryItems?.Select(x => new CalcManagerHistoryItemAlias { Value = x });
|
||||||
set => Value.HistoryItems = value?.Select(x => new CalcManagerHistoryItem
|
set => Value.HistoryItems = value?.Select(x => new CalcManagerHistoryItem
|
||||||
{
|
{
|
||||||
Tokens = x.Tokens.Select(Helpers.MapHistoryToken).ToList(),
|
Tokens = x.Tokens.Select(Helpers.MapHistoryToken).ToList(),
|
||||||
|
@ -240,7 +240,7 @@ namespace CalculatorApp.JsonUtils
|
||||||
[JsonPropertyName("e")]
|
[JsonPropertyName("e")]
|
||||||
public ExpressionDisplaySnapshotAlias ExpressionDisplay // optional
|
public ExpressionDisplaySnapshotAlias ExpressionDisplay // optional
|
||||||
{
|
{
|
||||||
get => Value != null ? new ExpressionDisplaySnapshotAlias(Value.ExpressionDisplay) : null;
|
get => Value.ExpressionDisplay != null ? new ExpressionDisplaySnapshotAlias(Value.ExpressionDisplay) : null;
|
||||||
set => Value.ExpressionDisplay = value?.Value;
|
set => Value.ExpressionDisplay = value?.Value;
|
||||||
}
|
}
|
||||||
[JsonPropertyName("c")]
|
[JsonPropertyName("c")]
|
||||||
|
@ -264,7 +264,7 @@ namespace CalculatorApp.JsonUtils
|
||||||
[JsonPropertyName("s")]
|
[JsonPropertyName("s")]
|
||||||
public StandardCalculatorSnapshotAlias StandardCalculatorSnapshot // optional
|
public StandardCalculatorSnapshotAlias StandardCalculatorSnapshot // optional
|
||||||
{
|
{
|
||||||
get => Value != null ? new StandardCalculatorSnapshotAlias(Value.StandardCalculator) : null;
|
get => Value.StandardCalculator != null ? new StandardCalculatorSnapshotAlias(Value.StandardCalculator) : null;
|
||||||
set => Value.StandardCalculator = value?.Value;
|
set => Value.StandardCalculator = value?.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue