Skip to content

Commit

Permalink
Removed ChromeWindow from all windows resources and added sidereal tr…
Browse files Browse the repository at this point in the history
…acking to the Plot.
  • Loading branch information
rmorgan001 committed Mar 28, 2022
1 parent 25d96fd commit 16ce4ed
Show file tree
Hide file tree
Showing 14 changed files with 132 additions and 60 deletions.
3 changes: 1 addition & 2 deletions GS.Server/Main/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
Height="{Binding WindowHeight, Mode=TwoWay}"
Width="{Binding WindowWidth, Mode=TwoWay}"
Left="{Binding WindowLeft, Mode=TwoWay}"
Top="{Binding WindowTop, Mode=TwoWay}"
MinHeight="100" MinWidth="200" AllowsTransparency="True">
Top="{Binding WindowTop, Mode=TwoWay}" MinHeight="100" MinWidth="200" AllowsTransparency="True">
<Window.Resources>
<DataTemplate DataType="{x:Type skyTelescope:SkyTelescopeVM}">
<skyTelescope:SkyTelescopeV />
Expand Down
4 changes: 2 additions & 2 deletions GS.Server/Plot/PlotV.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
</wpf:CartesianChart.AxisX>
<wpf:CartesianChart.AxisY>
<wpf:Axis Title="{Binding Scale, Mode=TwoWay}" FontSize="15" Foreground="DarkGray" ShowLabels="True" DisableAnimations="True"
LabelFormatter="{Binding FormatterY, Mode=OneTime}" MaxValue="{Binding AxisYMax, Mode=TwoWay}" MinValue="{Binding AxisYMin, Mode=TwoWay}"
LabelFormatter="{Binding FormatterY}" MaxValue="{Binding AxisYMax, Mode=TwoWay}" MinValue="{Binding AxisYMin, Mode=TwoWay}"
Unit="{Binding AxisYUnit, Mode=TwoWay}">
<wpf:Axis.Sections>
<wpf:AxisSection Value="0" StrokeThickness="1" Stroke="DarkGray" DisableAnimations="True"/>
Expand All @@ -152,7 +152,7 @@
<DataTemplate DataType="plot:TitleItem">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Path=TitleName}" Foreground="{Binding Path=Fill}" FontSize="18" />
<TextBlock Text="{Binding Path=Value, StringFormat=N2}" Foreground="{Binding Path=Fill}" FontSize="18" Margin="5,0,0,0" />
<TextBlock Text="{Binding Path=Value}" Foreground="{Binding Path=Fill}" FontSize="18" Margin="5,0,0,0" />
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
Expand Down
107 changes: 83 additions & 24 deletions GS.Server/Plot/PlotVM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,28 +130,50 @@ private void ProcessValues1(MonitorEntry entry)
steps -= zero;
}

TitleItem item;
switch (Scale)
{
case ChartScale.Degrees:
point.Value = Conversions.ArcSec2Deg(steps / raStepsPerSecond);
Values1.Add(point);
item = TitleItems.FirstOrDefault(x => x.TitleName == Values1Title);
if (item != null)
{
item.Value = Numbers.TruncateD(point.Value, 2);
}
break;
case ChartScale.Arcsecs:
point.Value = steps / raStepsPerSecond;
point.Value = steps;
Values1.Add(point);
item = TitleItems.FirstOrDefault(x => x.TitleName == Values1Title);
if (item != null)
{
item.Value = point.Value;
var fpoint = Values1.FirstOrDefault();
var lpoint = Values1.LastOrDefault();
if (fpoint != null && lpoint != null)
{
var tspan = lpoint.DateTime - fpoint.DateTime;
var vspan = Math.Abs(lpoint.Value - fpoint.Value);
var rate = vspan / raStepsPerSecond / Math.Abs(tspan.TotalSeconds);
item.Value = Numbers.TruncateD(rate, 3);
}
}
break;
case ChartScale.Steps:
point.Value = steps;
Values1.Add(point);
item = TitleItems.FirstOrDefault(x => x.TitleName == Values1Title);
if (item != null)
{
item.Value = Numbers.TruncateD(point.Value, 0);
}
break;
default:
return;
}
if (IsLogging) ChartLogging.LogPoint(BaseLogName,ChartType.Plot, point);

Values1.Add(point);
if (Values1.Count > MaxPoints) Values1.RemoveAt(0);

var item = TitleItems.FirstOrDefault(x => x.TitleName == Values1Title);
if (item == null) return;
item.Value = point.Value;
if (IsLogging){ChartLogging.LogPoint(BaseLogName,ChartType.Plot, point);}
if (Values1.Count > MaxPoints){Values1.RemoveAt(0);}
}

/// <summary>
Expand All @@ -170,30 +192,51 @@ private void ProcessValues2(MonitorEntry entry)
var zero = Conversions.Deg2ArcSec(90) * decStepsPerSecond;
steps -= zero;
}

TitleItem item;
switch (Scale)
{
case ChartScale.Degrees:
point.Value = Conversions.ArcSec2Deg(steps / decStepsPerSecond);
Values2.Add(point);
item = TitleItems.FirstOrDefault(x => x.TitleName == Values2Title);
if (item != null)
{
item.Value = Numbers.TruncateD(point.Value, 2);
}
break;
case ChartScale.Arcsecs:
point.Value = steps / decStepsPerSecond;
point.Value = steps;
Values2.Add(point);
item = TitleItems.FirstOrDefault(x => x.TitleName == Values2Title);
if (item != null)
{
item.Value = point.Value;
var fpoint = Values2.FirstOrDefault();
var lpoint = Values2.LastOrDefault();
if (fpoint != null && lpoint != null)
{
var tspan = lpoint.DateTime - fpoint.DateTime;
var vspan = Math.Abs(lpoint.Value - fpoint.Value);
var rate = vspan / decStepsPerSecond / Math.Abs(tspan.TotalSeconds);
item.Value = Numbers.TruncateD(rate, 3);
}
}
break;
case ChartScale.Steps:
point.Value = steps;
Values2.Add(point);
item = TitleItems.FirstOrDefault(x => x.TitleName == Values2Title);
if (item != null)
{
item.Value = Numbers.TruncateD(point.Value, 2);
}
break;
default:
return;
}

if (IsLogging) ChartLogging.LogPoint(BaseLogName,ChartType.Plot, point);

Values2.Add(point);
if (Values2.Count > MaxPoints) Values2.RemoveAt(0);

var item = TitleItems.FirstOrDefault(x => x.TitleName == Values2Title);
if (item == null) return;
item.Value = point.Value;
if (IsLogging){ChartLogging.LogPoint(BaseLogName,ChartType.Plot, point);}
if (Values2.Count > MaxPoints){Values2.RemoveAt(0);}
}

/// <summary>
Expand Down Expand Up @@ -222,11 +265,11 @@ private void LoadDefaults()
_xAxisTimer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(1) };
_xAxisTimer.Tick += XAxisTimer_Tick;

MaxPointsRange = new List<double>(Numbers.InclusiveRange(1000, 50000, 1000));
MaxPointsRange = new List<double>(Numbers.InclusiveRange(500, 50000, 500));
MaxPoints = 5000;

FormatterX = value => new DateTime((long)value).ToString("HH:mm:ss");
FormatterY = value => value.ToString("N2");
FormatterY = value => value.ToString("N0");

AxisXUnit = TimeSpan.FromSeconds(1).Ticks; //AxisXUnit = 10000000
AxisYUnit = .5;
Expand Down Expand Up @@ -536,6 +579,7 @@ private void StartChart()
ResizeAxes();
ChartsQuality(ChartQuality);
TitleItems.Clear();
SetScale(Scale);

raStepsPerSecond = Conversions.StepPerArcSec(SkyServer.StepsPerRevolution[0]);
decStepsPerSecond = Conversions.StepPerArcSec(SkyServer.StepsPerRevolution[1]);
Expand All @@ -556,19 +600,34 @@ private void StartChart()
if (titleItem != null) TitleItems.Add(titleItem);
}
}

private void ChartsQuality(Quality chartQuality)
{
Values1.WithQuality(chartQuality);
Values2.WithQuality(chartQuality);
}

private void SetScale(ChartScale scale)
{
switch (scale)
{
case ChartScale.Arcsecs:
FormatterY = value => value.ToString("N0");
break;
case ChartScale.Degrees:
FormatterY = value => value.ToString("N2");
break;
case ChartScale.Steps:
FormatterY = value => value.ToString("N0");
break;
default:
FormatterY = value => value.ToString("N0");
break;
}
}
private void SetXAxisLimits(DateTime now)
{
AxisXMax = now.Ticks + AxisXUnit * 2;
AxisXMin = now.Ticks - AxisXUnit * AxisXSeconds;
}

private GColumnSeries NewGColumnSeries(string title, IChartValues values, ChartValueSet set, double pointSize, Brush color, int scaleAt)
{
var series = new GColumnSeries
Expand Down
9 changes: 2 additions & 7 deletions GS.Server/Windows/ButtonsControlV.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,12 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="clr-namespace:GS.Server.Controls"
xmlns:windows="clr-namespace:GS.Server.Windows"
xmlns:md="http://materialdesigninxaml.net/winfx/xaml/themes"
mc:Ignorable="d" TextElement.FontSize="14" ResizeMode="NoResize"
WindowStyle="None" TextOptions.TextFormattingMode="Display" Height="307" Width="145"
xmlns:md="http://materialdesigninxaml.net/winfx/xaml/themes" mc:Ignorable="d" TextElement.FontSize="14" ResizeMode="CanResizeWithGrip" WindowStyle="None" TextOptions.TextFormattingMode="Display" Height="307" Width="145"
FontFamily="pack://application:,,,/MaterialDesignThemes.Wpf;component/Resources/Roboto/#Roboto"
Title="{StaticResource hcHc}" FontStretch="Normal" Topmost="{Binding TopMost}"
d:DataContext="{d:DesignInstance windows:ButtonsControlVM, IsDesignTimeCreatable=True}"
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
WindowState="{Binding WindowStates}" WindowStartupLocation="CenterOwner">
<WindowChrome.WindowChrome>
<WindowChrome ResizeBorderThickness="6" CaptionHeight="30" CornerRadius="3" GlassFrameThickness="2"/>
</WindowChrome.WindowChrome>
WindowState="{Binding WindowStates}" ContentRendered="MainWindow_OnContentRendered" WindowStartupLocation="CenterOwner" AllowsTransparency="True" >
<Window.TaskbarItemInfo>
<TaskbarItemInfo Description="{StaticResource titleName}" />
</Window.TaskbarItemInfo>
Expand Down
9 changes: 8 additions & 1 deletion GS.Server/Windows/ButtonsControlV.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace GS.Server.Windows
using System;

namespace GS.Server.Windows
{
/// <summary>
/// Interaction logic for Window1.xaml
Expand All @@ -10,5 +12,10 @@ public ButtonsControlV()
DataContext = new ButtonsControlVM();
InitializeComponent();
}

private void MainWindow_OnContentRendered(object sender, EventArgs e)
{
MouseLeftButtonDown += delegate { DragMove(); };
}
}
}
9 changes: 3 additions & 6 deletions GS.Server/Windows/HandControlV.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="clr-namespace:GS.Server.Controls"
xmlns:windows="clr-namespace:GS.Server.Windows"
xmlns:md="http://materialdesigninxaml.net/winfx/xaml/themes"
mc:Ignorable="d" TextElement.FontSize="14" ResizeMode="NoResize" WindowStyle="None"
xmlns:md="http://materialdesigninxaml.net/winfx/xaml/themes" mc:Ignorable="d" TextElement.FontSize="14" ResizeMode="CanResizeWithGrip" WindowStyle="None"
TextOptions.TextFormattingMode="Display" Height="220" Width="330" FontFamily="pack://application:,,,/MaterialDesignThemes.Wpf;component/Resources/Roboto/#Roboto"
Title="{StaticResource hcHc}" FontStretch="Normal" Topmost="{Binding TopMost}"
d:DataContext="{d:DesignInstance windows:HandControlVM, IsDesignTimeCreatable=True}"
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
WindowState="{Binding WindowStates}" WindowStartupLocation="CenterOwner">
<WindowChrome.WindowChrome>
<WindowChrome ResizeBorderThickness="6" CaptionHeight="30" CornerRadius="5" GlassFrameThickness="1"/>
</WindowChrome.WindowChrome>
WindowState="{Binding WindowStates}" WindowStartupLocation="CenterOwner"
AllowsTransparency="True" ContentRendered="MainWindow_OnContentRendered">
<Window.TaskbarItemInfo>
<TaskbarItemInfo Description="{StaticResource hcHc}" />
</Window.TaskbarItemInfo>
Expand Down
9 changes: 8 additions & 1 deletion GS.Server/Windows/HandControlV.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace GS.Server.Windows
using System;

namespace GS.Server.Windows
{
/// <summary>
/// Interaction logic for Window1.xaml
Expand All @@ -10,5 +12,10 @@ public HandControlV()
DataContext = new HandControlVM();
InitializeComponent();
}

private void MainWindow_OnContentRendered(object sender, EventArgs e)
{
MouseLeftButtonDown += delegate { DragMove(); };
}
}
}
9 changes: 2 additions & 7 deletions GS.Server/Windows/MessageControlV.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,12 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="clr-namespace:GS.Server.Controls"
xmlns:windows="clr-namespace:GS.Server.Windows"
mc:Ignorable="d" TextElement.FontSize="14" ResizeMode="NoResize"
WindowStyle="None" TextOptions.TextFormattingMode="Display"
xmlns:windows="clr-namespace:GS.Server.Windows" mc:Ignorable="d" TextElement.FontSize="14" ResizeMode="CanResizeWithGrip" WindowStyle="None" TextOptions.TextFormattingMode="Display"
FontFamily="pack://application:,,,/MaterialDesignThemes.Wpf;component/Resources/Roboto/#Roboto"
Title="{StaticResource hcHc}" FontStretch="Normal" Topmost="{Binding TopMost}"
d:DataContext="{d:DesignInstance windows:MessageControlVM, IsDesignTimeCreatable=True}" TextElement.Foreground="{DynamicResource MaterialDesignBody}"
SizeToContent="WidthAndHeight" MinHeight="100" MinWidth="300"
WindowState="{Binding WindowStates}" WindowStartupLocation="CenterOwner">
<WindowChrome.WindowChrome>
<WindowChrome ResizeBorderThickness="6" CaptionHeight="30" CornerRadius="3" GlassFrameThickness="2"/>
</WindowChrome.WindowChrome>
WindowState="{Binding WindowStates}" WindowStartupLocation="CenterOwner" AllowsTransparency="True" ContentRendered="MainWindow_OnContentRendered">
<Window.TaskbarItemInfo>
<TaskbarItemInfo Description="{StaticResource titleName}" />
</Window.TaskbarItemInfo>
Expand Down
9 changes: 8 additions & 1 deletion GS.Server/Windows/MessageControlV.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace GS.Server.Windows
using System;

namespace GS.Server.Windows
{
/// <summary>
/// Interaction logic for Window1.xaml
Expand All @@ -10,5 +12,10 @@ public MessageControlV(string caption, string msg)
DataContext = new MessageControlVM(caption, msg);
InitializeComponent();
}

private void MainWindow_OnContentRendered(object sender, EventArgs e)
{
MouseLeftButtonDown += delegate { DragMove(); };
}
}
}
5 changes: 1 addition & 4 deletions GS.Server/Windows/ModelV.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@
FontFamily="pack://application:,,,/MaterialDesignThemes.Wpf;component/Resources/Roboto/#Roboto" Title="{StaticResource 3dModel}" FontStretch="Normal" Topmost="{Binding TopMost}"
d:DataContext="{d:DesignInstance windows:ModelVM, IsDesignTimeCreatable=True}"
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
WindowState="{Binding WindowStates}" WindowStartupLocation="CenterOwner">
<WindowChrome.WindowChrome>
<WindowChrome ResizeBorderThickness="6" CaptionHeight="30" CornerRadius="5" GlassFrameThickness="1"/>
</WindowChrome.WindowChrome>
WindowState="{Binding WindowStates}" WindowStartupLocation="CenterOwner" AllowsTransparency="True" ContentRendered="MainWindow_OnContentRendered">
<Window.TaskbarItemInfo>
<TaskbarItemInfo Description="{StaticResource 3dModel}" />
</Window.TaskbarItemInfo>
Expand Down
9 changes: 8 additions & 1 deletion GS.Server/Windows/ModelV.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace GS.Server.Windows
using System;

namespace GS.Server.Windows
{
/// <summary>
/// Interaction logic for Window1.xaml
Expand All @@ -10,5 +12,10 @@ public ModelV()
DataContext = new ModelVM();
InitializeComponent();
}

private void MainWindow_OnContentRendered(object sender, EventArgs e)
{
MouseLeftButtonDown += delegate { DragMove(); };
}
}
}
5 changes: 1 addition & 4 deletions GS.Server/Windows/SpiralV.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@
d:DataContext="{d:DesignInstance windows:SpiralVM, IsDesignTimeCreatable=True}"
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
Height="400" Width="430" Loaded="SpiralV_OnLoaded" SizeChanged="SpiralV_OnSizeChanged"
WindowState="{Binding WindowState}" WindowStartupLocation="CenterOwner">
<WindowChrome.WindowChrome>
<WindowChrome ResizeBorderThickness="6" CaptionHeight="30" CornerRadius="5" GlassFrameThickness="1"/>
</WindowChrome.WindowChrome>
WindowState="{Binding WindowState}" WindowStartupLocation="CenterOwner" AllowsTransparency="True" ContentRendered="MainWindow_OnContentRendered">
<Window.TaskbarItemInfo>
<TaskbarItemInfo Description="{StaticResource 1021SpiralSearch}"/>
</Window.TaskbarItemInfo>
Expand Down
5 changes: 5 additions & 0 deletions GS.Server/Windows/SpiralV.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ public SpiralV()
InitializeComponent();
}

private void MainWindow_OnContentRendered(object sender, EventArgs e)
{
MouseLeftButtonDown += delegate { DragMove(); };
}

private void LoadPoints()
{
var icons = new List<PackIcon>
Expand Down
Binary file modified Resources/Installer/ASCOMGSServer1043Setup.exe
Binary file not shown.

0 comments on commit 16ce4ed

Please sign in to comment.