-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathApp.WetDryCondition.cs
More file actions
80 lines (63 loc) · 2.09 KB
/
Copy pathApp.WetDryCondition.cs
File metadata and controls
80 lines (63 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
using System.Windows;
using System.Windows.Media;
namespace MarvinsAIRA
{
public partial class App : Application
{
public const string ALL_WETDRYCONDITIONS_SAVE_NAME = "All";
private const string WET_CONDITION_DISPLAY_NAME = "Wet";
private const string DRY_CONDITION_DISPLAY_NAME = "Dry";
private string _wetdry_currentConditionDisplayName = string.Empty;
private string _wetdry_conditionSaveName = ALL_WETDRYCONDITIONS_SAVE_NAME;
private bool _wetdry_conditionChanged = false;
private void InitializeWetDryCondition()
{
WriteLine( "InitializeWetDryCondition called.", true );
UpdateCurrentWetDryCondition();
}
private void UpdateCurrentWetDryCondition()
{
var wetDryConditionDisplayName = string.Empty;
if ( _irsdk.IsConnected )
{
wetDryConditionDisplayName = _irsdk_weatherDeclaredWet ? WET_CONDITION_DISPLAY_NAME : DRY_CONDITION_DISPLAY_NAME;
}
if ( _wetdry_currentConditionDisplayName != wetDryConditionDisplayName )
{
if ( wetDryConditionDisplayName != string.Empty )
{
WriteLine( $"The track is {wetDryConditionDisplayName}.", true );
if ( wetDryConditionDisplayName == WET_CONDITION_DISPLAY_NAME )
{
Say( Settings.SayTrackWet );
}
else
{
Say( Settings.SayTrackDry );
}
}
_wetdry_currentConditionDisplayName = wetDryConditionDisplayName;
UpdateWetDryConditionSaveName();
Dispatcher.BeginInvoke( () =>
{
var mainWindow = MarvinsAIRA.MainWindow.Instance;
if ( mainWindow != null )
{
mainWindow.CurrentTrackCondition_StatusBarItem.Content = _wetdry_currentConditionDisplayName;
mainWindow.CurrentTrackCondition_StatusBarItem.Foreground = Brushes.ForestGreen;
}
} );
}
}
public void UpdateWetDryConditionSaveName()
{
var oldWetDryConditionSaveName = _wetdry_conditionSaveName;
_wetdry_conditionSaveName = Settings.SaveSettingsPerWetDryCondition ? _wetdry_currentConditionDisplayName : ALL_WETDRYCONDITIONS_SAVE_NAME;
if ( _wetdry_conditionSaveName != oldWetDryConditionSaveName )
{
_wetdry_conditionChanged = true;
}
}
}
}