mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-23 06:25:19 -07:00
[Perf] Set x:Load=false for StandardOperators
As a workaround for nventive/Uno#925 (binding to x:Load doesn't work), this improves start-up time when going directly to calculators other than Standard.
This commit is contained in:
parent
a1ad61900e
commit
99c1af1ecd
3 changed files with 19 additions and 1 deletions
|
@ -301,6 +301,11 @@ namespace CalculatorApp
|
||||||
|
|
||||||
void OnIsStandardPropertyChanged(bool oldValue, bool newValue)
|
void OnIsStandardPropertyChanged(bool oldValue, bool newValue)
|
||||||
{
|
{
|
||||||
|
if (newValue)
|
||||||
|
{
|
||||||
|
EnsureStandard();
|
||||||
|
}
|
||||||
|
|
||||||
UpdateViewState();
|
UpdateViewState();
|
||||||
UpdatePanelViewState();
|
UpdatePanelViewState();
|
||||||
}
|
}
|
||||||
|
@ -430,6 +435,11 @@ namespace CalculatorApp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EnsureStandard()
|
||||||
|
{
|
||||||
|
OpsPanel.EnsureStandardOps();
|
||||||
|
}
|
||||||
|
|
||||||
void EnsureScientific()
|
void EnsureScientific()
|
||||||
{
|
{
|
||||||
OpsPanel.EnsureScientificOps();
|
OpsPanel.EnsureScientificOps();
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<Grid>
|
<Grid>
|
||||||
<!--Bind visibility as a workaround for nventive/Uno#925-->
|
<!--Bind visibility as a workaround for nventive/Uno#925-->
|
||||||
<local:CalculatorStandardOperators x:Name="StandardOperators"
|
<local:CalculatorStandardOperators x:Name="StandardOperators"
|
||||||
x:Load="{x:Bind Model.IsStandard, Mode=OneWay}"
|
x:Load="False"
|
||||||
IsEnabled="{x:Bind Model.IsStandard, Mode=OneWay}"
|
IsEnabled="{x:Bind Model.IsStandard, Mode=OneWay}"
|
||||||
Visibility="{x:Bind Model.IsStandard, Mode=OneWay}"
|
Visibility="{x:Bind Model.IsStandard, Mode=OneWay}"
|
||||||
TabIndex="17" />
|
TabIndex="17" />
|
||||||
|
|
|
@ -88,6 +88,14 @@ namespace CalculatorApp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal void EnsureStandardOps()
|
||||||
|
{
|
||||||
|
if (StandardOperators == null)
|
||||||
|
{
|
||||||
|
this.FindName("StandardOperators");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
internal void EnsureScientificOps()
|
internal void EnsureScientificOps()
|
||||||
{
|
{
|
||||||
if (ScientificOperators == null)
|
if (ScientificOperators == null)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue