Skip to content

Commit efe7503

Browse files
V1.0.1.3 Updates
- Added ability to set a DEC offset from power on state to home and to slew there (requires V1.9.16 firmware) on button press (see Settings Dialog) - Swapped out the application settings logic so settings don't get lost between builds. - State of Show DEC limits toggle is now persisted. - Changed all black or dark text to light red for better readability.
1 parent cb36ecc commit efe7503

17 files changed

+375
-295
lines changed

OATControl/App.config

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@
4949
<setting name="KeepMiniControlOnTop" serializeAs="String">
5050
<value>False</value>
5151
</setting>
52+
<setting name="DECHomeOffset" serializeAs="String">
53+
<value>0</value>
54+
</setting>
5255
</OATControl.Properties.Settings>
5356
</userSettings>
5457
</configuration>

OATControl/App.xaml.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System.Threading;
55
using System.Windows.Threading;
66
using OATCommunications.Utilities;
7+
using OATControl.Properties;
78

89
namespace OATControl
910
{
@@ -19,6 +20,7 @@ public App()
1920
AppDomain.CurrentDomain.UnhandledException += App.UnhandledException;
2021

2122
this.DispatcherUnhandledException += new DispatcherUnhandledExceptionEventHandler(App.AppDispatcherUnhandledException);
23+
//AppSettings.Instance.Upgrade();
2224
}
2325

2426
protected override void OnStartup(StartupEventArgs e)

OATControl/DlgChooseOat.xaml.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ public DlgChooseOat(MountVM mountViewModel, Action<string, Action<CommandRespons
8080
_mountViewModel = mountViewModel;
8181
_rollOffsetHistory = new List<double>(5);
8282
_pitchOffsetHistory = new List<double>(5);
83-
_latitude = Settings.Default.SiteLatitude;
84-
_longitude = Settings.Default.SiteLongitude;
85-
_altitude = Settings.Default.SiteAltitude;
83+
_latitude = AppSettings.Instance.SiteLatitude;
84+
_longitude = AppSettings.Instance.SiteLongitude;
85+
_altitude = AppSettings.Instance.SiteAltitude;
8686

8787
CurrentStep = Steps.Idle;
8888
_rescanCommand = new DelegateCommand(() => { CommunicationHandlerFactory.DiscoverDevices(); }, () => (_currentStep == Steps.Idle) || (_currentStep == Steps.WaitForBaudrate));
@@ -376,10 +376,10 @@ private void AdvanceStateMachine()
376376
GPSStatus = "Sync'd! Setting OAT location...";
377377
Task.Run(() => _mountViewModel.SetSiteLatitude(Latitude)).Wait();
378378
Task.Run(() => _mountViewModel.SetSiteLongitude(Longitude)).Wait();
379-
Settings.Default.SiteLatitude = Latitude;
380-
Settings.Default.SiteLongitude = Longitude;
381-
Settings.Default.SiteAltitude = Altitude;
382-
Settings.Default.Save();
379+
AppSettings.Instance.SiteLatitude = Latitude;
380+
AppSettings.Instance.SiteLongitude = Longitude;
381+
AppSettings.Instance.SiteAltitude = Altitude;
382+
AppSettings.Instance.Save();
383383
CurrentStep = Steps.Completed;
384384
break;
385385

@@ -560,9 +560,9 @@ private async void ProcessStateMachine(object sender, EventArgs e)
560560
await Task.Delay(400);
561561
}
562562

563-
Settings.Default.SiteLatitude = latitude;
564-
Settings.Default.SiteLongitude = longitude;
565-
Settings.Default.Save();
563+
AppSettings.Instance.SiteLatitude = latitude;
564+
AppSettings.Instance.SiteLongitude = longitude;
565+
AppSettings.Instance.Save();
566566
CurrentStep = Steps.Completed;
567567
}
568568
}

OATControl/DlgRunPolarAlignment.xaml.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public DlgRunPolarAlignment(Action<string, Action<CommandResponse>> sendCommand)
5050
await SendCommandAsync($":Sr02:59:09#,n");
5151

5252
// Move DEC to twice Polaris Dec
53-
if (Settings.Default.SiteLatitude > 0) // Northern hemisphere
53+
if (AppSettings.Instance.SiteLatitude > 0) // Northern hemisphere
5454
{
5555
await SendCommandAsync($":Sd+88*42:12#,n");
5656
}
@@ -63,7 +63,7 @@ public DlgRunPolarAlignment(Action<string, Action<CommandResponse>> sendCommand)
6363
else if (_state == 3)
6464
{
6565
// Sync the mount to Polaris coordinates
66-
if (Settings.Default.SiteLatitude > 0) // Northern hemisphere
66+
if (AppSettings.Instance.SiteLatitude > 0) // Northern hemisphere
6767
{
6868
await SendCommandAsync($":SY+89*21:06.02:59:09#,n");
6969
}

OATControl/MainWindow.xaml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,12 @@
3535
<Setter Property="FontWeight" Value="Bold" />
3636
<Setter Property="FontSize" Value="20" />
3737
<Setter Property="MinWidth" Value="50" />
38-
</Style>
38+
<Setter Property="Foreground" Value="#B00" />
39+
</Style>
3940
<Style x:Key="NumericBorder" TargetType="Controls:NumericUpDown" >
4041
<Setter Property="FontSize" Value="14" />
4142
<Setter Property="MinWidth" Value="50" />
42-
</Style>
43+
</Style>
4344
<Style x:Key="DockBlockStatus" TargetType="DockPanel" >
4445
<Setter Property="Background" Value="{StaticResource AccentColorBrush}" />
4546
<Setter Property="Margin" Value="2" />
@@ -57,7 +58,7 @@
5758
<Setter Property="Margin" Value="2" />
5859
<Setter Property="VerticalAlignment" Value="Center" />
5960
<Setter Property="HorizontalAlignment" Value="Center" />
60-
<Style.Triggers>
61+
<Style.Triggers>
6162
<DataTrigger Binding="{Binding}" Value="True">
6263
<Setter Property="Foreground" Value="#FFB0B0B0" />
6364
</DataTrigger>
@@ -67,7 +68,7 @@
6768
<Setter Property="BorderBrush" Value="{StaticResource AccentBaseColorBrush}" />
6869
<Setter Property="BorderThickness" Value="1" />
6970
<Setter Property="Background" Value="{StaticResource AccentColorBrush3}" />
70-
<Setter Property="Foreground" Value="#FF201010" />
71+
<Setter Property="Foreground" Value="#FF000000" />
7172
<Setter Property="FontWeight" Value="Bold" />
7273
<Setter Property="FontSize" Value="14" />
7374
<Setter Property="Template">
@@ -105,15 +106,17 @@
105106
<Setter Property="VerticalAlignment" Value="Center" />
106107
<Setter Property="FontWeight" Value="Bold" />
107108
<Setter Property="FontSize" Value="28" />
108-
</Style>
109+
<Setter Property="Foreground" Value="#F00" />
110+
</Style>
109111
<Style x:Key="TextBlockHeading" TargetType="TextBlock" BasedOn="{StaticResource MetroTextBlock}">
110112
<Setter Property="VerticalAlignment" Value="Center" />
111113
<Setter Property="FontWeight" Value="Bold" />
112114
<Setter Property="FontSize" Value="20" />
113115
<Setter Property="Margin" Value="2,0" />
114116
<Setter Property="Padding" Value="6,0" />
115117
<Setter Property="HorizontalAlignment" Value="Left" />
116-
</Style>
118+
<Setter Property="Foreground" Value="#B00" />
119+
</Style>
117120
<Style x:Key="TextBlockLabel" TargetType="TextBlock" BasedOn="{StaticResource TextBlockHeading}">
118121
<Setter Property="Padding" Value="2,0" />
119122
<Setter Property="HorizontalAlignment" Value="Left" />
@@ -336,7 +339,7 @@
336339
Value="{Binding DECStepperDegrees, Mode=OneWay}"
337340
MarkerValue="{Binding DECStepperTargetDegrees, Mode=OneWay}"
338341
Padding="0"
339-
ShowLimits="{Binding ElementName=ShowLimits,Path=IsChecked}"
342+
ShowLimits="{Binding ShowDECLimits}"
340343
AxisLabel="DEC Axis"
341344
TickMajorSpacing="30"
342345
TickMinorSpacing="10"

OATControl/MainWindow.xaml.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,18 @@ public MainWindow()
3636
protected override void OnInitialized(EventArgs e)
3737
{
3838
base.OnInitialized(e);
39-
if (Settings.Default.WindowPos.X != -1)
39+
if (AppSettings.Instance.WindowPos.X != -1)
4040
{
41-
this.Left = Math.Max(0, Math.Min(Settings.Default.WindowPos.X, System.Windows.SystemParameters.VirtualScreenWidth - 100));
42-
this.Top = Math.Max(0, Math.Min(Settings.Default.WindowPos.Y, System.Windows.SystemParameters.VirtualScreenHeight- 100));
41+
this.Left = Math.Max(0, Math.Min(AppSettings.Instance.WindowPos.X, System.Windows.SystemParameters.VirtualScreenWidth - 100));
42+
this.Top = Math.Max(0, Math.Min(AppSettings.Instance.WindowPos.Y, System.Windows.SystemParameters.VirtualScreenHeight- 100));
4343
}
4444
}
4545
protected override void OnClosing(CancelEventArgs e)
4646
{
4747
mountVm.Disconnect();
4848
base.OnClosing(e);
49-
Settings.Default.WindowPos = new System.Drawing.Point((int)Math.Max(0, this.Left), (int)Math.Max(0, this.Top));
50-
Settings.Default.Save();
49+
AppSettings.Instance.WindowPos = new Point((int)Math.Max(0, this.Left), (int)Math.Max(0, this.Top));
50+
AppSettings.Instance.Save();
5151
}
5252

5353
private void TextBox_GotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)

OATControl/MiniController.xaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,14 @@
3131
<Setter Property="HorizontalAlignment" Value="Stretch" />
3232
<Setter Property="TextAlignment" Value="Center" />
3333
<Setter Property="Background" Value="{StaticResource AccentColorBrush2}" />
34+
<Setter Property="Foreground" Value="#F00" />
3435
</Style>
3536
<Style x:Key="TextBlockLabelTiny" TargetType="TextBlock" BasedOn="{StaticResource TextBlockLabelSmall}">
3637
<Setter Property="FontSize" Value="10" />
38+
<Setter Property="Foreground" Value="#E00" />
3739
</Style>
3840
<Style x:Key="TextBlockLabelTinyLabel" TargetType="TextBlock" BasedOn="{StaticResource TextBlockLabelTiny}">
39-
<Setter Property="Foreground" Value="#C20" />
41+
<Setter Property="Foreground" Value="#B00" />
4042
</Style>
4143
<Style x:Key="ToggleButtonState" TargetType="ToggleButton" >
4244
<Setter Property="Width" Value="16" />

OATControl/MiniController.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ protected override void OnKeyDown(KeyEventArgs e)
6363

6464
protected override void OnClosing(CancelEventArgs e)
6565
{
66-
Settings.Default.MiniControllerPos = new System.Drawing.Point((int)this.Left, (int)this.Top);
66+
AppSettings.Instance.MiniControllerPos = new Point((int)this.Left, (int)this.Top);
6767
base.OnClosing(e);
6868
}
6969
protected override void OnKeyUp(KeyEventArgs e)

OATControl/OATControl Setup.iss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
33

44
#define MyAppName "OATControl"
5-
#define MyAppVersion "1.0.1.1"
5+
#define MyAppVersion "1.0.1.3"
66
#define MyAppPublisher "OpenAstroTech"
77
#define MyAppURL "https://wiki.openastrotech.com/"
88
#define MyAppExeName "OATControl.exe"

OATControl/OATControl.csproj

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@
109109
<Compile Include="TargetChooser.xaml.cs">
110110
<DependentUpon>TargetChooser.xaml</DependentUpon>
111111
</Compile>
112+
<Compile Include="ViewModels\AppSettings.cs" />
112113
<Compile Include="ViewModels\DelegateCommand.cs" />
113114
<Compile Include="ViewModels\MountVM.cs" />
114115
<Compile Include="ViewModels\PointOfInterest.cs" />
@@ -189,20 +190,11 @@
189190
<DesignTime>True</DesignTime>
190191
<DependentUpon>Resources.resx</DependentUpon>
191192
</Compile>
192-
<Compile Include="Properties\Settings.Designer.cs">
193-
<AutoGen>True</AutoGen>
194-
<DependentUpon>Settings.settings</DependentUpon>
195-
<DesignTimeSharedInput>True</DesignTimeSharedInput>
196-
</Compile>
197193
<EmbeddedResource Include="Properties\Resources.resx">
198194
<Generator>ResXFileCodeGenerator</Generator>
199195
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
200196
</EmbeddedResource>
201197
<None Include="packages.config" />
202-
<None Include="Properties\Settings.settings">
203-
<Generator>SettingsSingleFileGenerator</Generator>
204-
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
205-
</None>
206198
</ItemGroup>
207199
<ItemGroup>
208200
<None Include="App.config" />

0 commit comments

Comments
 (0)