Skip to content

Commit

Permalink
FIx issue stopping update to latest version of ScottPlot
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisPulman committed Sep 13, 2024
1 parent 50ef425 commit 89244cb
Show file tree
Hide file tree
Showing 37 changed files with 942 additions and 959 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<!--<Compile Update="**\*.cs" DependentUpon="I%(Filename).cs" />-->
<PackageReference Include="Nerdbank.GitVersioning" Version="3.6.143" PrivateAssets="all" Condition="!Exists('packages.config')" />
<PackageReference Include="stylecop.analyzers" Version="1.2.0-beta.556" PrivateAssets="all" />
<PackageReference Include="Roslynator.Analyzers" Version="4.12.4" PrivateAssets="All" />
<PackageReference Include="Roslynator.Analyzers" Version="4.12.5" PrivateAssets="All" />
<AdditionalFiles Include="$(MSBuildThisFileDirectory)stylecop.json" Link="stylecop.json" />
</ItemGroup>
</Project>
1 change: 1 addition & 0 deletions src/CrissCross.MAUI/CrissCross.MAUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CompiledBindings.MAUI" Version="1.0.18" />
<PackageReference Include="ReactiveUI.Maui" Version="$(ReactiveUIVersion)" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
Expand Down
2 changes: 1 addition & 1 deletion src/CrissCross.WPF.Plot/CrissCross.WPF.Plot.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<PackageReference Include="ReactiveList" Version="2.0.3" />
<PackageReference Include="ReactiveMarbles.ObservableEvents.SourceGenerator" Version="1.3.1" PrivateAssets="all" />
<PackageReference Include="ReactiveUI.SourceGenerators" Version="1.0.3" PrivateAssets="all" />
<PackageReference Include="ScottPlot.WPF" Version="5.0.37" />
<PackageReference Include="ScottPlot.WPF" Version="5.0.39" />
</ItemGroup>

<ItemGroup>
Expand Down
9 changes: 6 additions & 3 deletions src/CrissCross.WPF.Plot/Live/StreamerUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -263,13 +263,16 @@ public void UpdateStream(IObservable<(string? Name, IList<double>? Value, IList<
var datetime = new List<double>(data.DateTime.ToList().ConvertAll(x => new DateTime(Convert.ToInt64(x)).ToOADate()));
var coord = datetime.Zip(values, (d, v) => new Coordinates(d, v));
ItemName = data.Name;
Streamer!.Data.Clear();
Streamer.Add(coord);
Streamer?.Data.Coordinates.Clear();
foreach (var co in coord)
{
Streamer?.Data.Add(co);
}
// UPDATE X AXIS
if (ManualScale || AutoScale)
{
Plot.Plot.Axes.SetLimitsX(doublelimits, doublenow, Streamer.Axes.XAxis);
Plot.Plot.Axes.SetLimitsX(doublelimits, doublenow, Streamer!.Axes.XAxis);
}
}
Expand Down
15 changes: 7 additions & 8 deletions src/CrissCross.WPF.UI/Controls/Border/Border.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
// ReactiveUI Association Incorporated licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

namespace CrissCross.WPF.UI.Controls
{
/// <summary>
/// Extended <see cref="System.Windows.Controls.Border"/>.
/// </summary>
/// <seealso cref="System.Windows.Controls.Border" />
public class Border : System.Windows.Controls.Border;
}
namespace CrissCross.WPF.UI.Controls;

/// <summary>
/// Extended <see cref="System.Windows.Controls.Border"/>.
/// </summary>
/// <seealso cref="System.Windows.Controls.Border" />
public class Border : System.Windows.Controls.Border;
1 change: 0 additions & 1 deletion src/CrissCross.WPF.UI/Controls/Button/Button.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// ReactiveUI Association Incorporated licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using System.Windows.Controls;
using CrissCross.WPF.UI.Converters;

namespace CrissCross.WPF.UI.Controls;
Expand Down
15 changes: 7 additions & 8 deletions src/CrissCross.WPF.UI/Controls/Calendar/Calendar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
// ReactiveUI Association Incorporated licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

namespace CrissCross.WPF.UI.Controls
{
/// <summary>
/// Extended <see cref="System.Windows.Controls.Calendar"/>.
/// </summary>
/// <seealso cref="System.Windows.Controls.Calendar" />
public class Calendar : System.Windows.Controls.Calendar;
}
namespace CrissCross.WPF.UI.Controls;

/// <summary>
/// Extended <see cref="System.Windows.Controls.Calendar"/>.
/// </summary>
/// <seealso cref="System.Windows.Controls.Calendar" />
public class Calendar : System.Windows.Controls.Calendar;
15 changes: 7 additions & 8 deletions src/CrissCross.WPF.UI/Controls/CheckBox/CheckBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
// ReactiveUI Association Incorporated licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

namespace CrissCross.WPF.UI.Controls
{
/// <summary>
/// Extended <see cref="System.Windows.Controls.CheckBox"/>.
/// </summary>
/// <seealso cref="System.Windows.Controls.CheckBox" />
public class CheckBox : System.Windows.Controls.CheckBox;
}
namespace CrissCross.WPF.UI.Controls;

/// <summary>
/// Extended <see cref="System.Windows.Controls.CheckBox"/>.
/// </summary>
/// <seealso cref="System.Windows.Controls.CheckBox" />
public class CheckBox : System.Windows.Controls.CheckBox;
15 changes: 7 additions & 8 deletions src/CrissCross.WPF.UI/Controls/ComboBox/ComboBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
// ReactiveUI Association Incorporated licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

namespace CrissCross.WPF.UI.Controls
{
/// <summary>
/// Extended <see cref="System.Windows.Controls.ComboBox"/>.
/// </summary>
/// <seealso cref="System.Windows.Controls.ComboBox" />
public class ComboBox : System.Windows.Controls.ComboBox;
}
namespace CrissCross.WPF.UI.Controls;

/// <summary>
/// Extended <see cref="System.Windows.Controls.ComboBox"/>.
/// </summary>
/// <seealso cref="System.Windows.Controls.ComboBox" />
public class ComboBox : System.Windows.Controls.ComboBox;
233 changes: 116 additions & 117 deletions src/CrissCross.WPF.UI/Controls/DateTimePicker/DateTimePicker.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,146 +6,145 @@
using System.Windows.Controls.Primitives;
using System.Windows.Input;

namespace CrissCross.WPF.UI
namespace CrissCross.WPF.UI;

/// <summary>
/// Interaction logic for DateTimePicker.xaml.
/// </summary>
public partial class DateTimePicker : UserControl
{
/// <summary>
/// Interaction logic for DateTimePicker.xaml.
/// The selected date property.
/// </summary>
public partial class DateTimePicker : UserControl
{
/// <summary>
/// The selected date property.
/// </summary>
public static readonly DependencyProperty SelectedDateProperty = DependencyProperty.Register(
nameof(SelectedDate),
public static readonly DependencyProperty SelectedDateProperty = DependencyProperty.Register(
nameof(SelectedDate),
typeof(DateTime),
typeof(DateTimePicker),
new FrameworkPropertyMetadata(DateTime.Now, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));

/// <summary>
/// The display date start property.
/// </summary>
public static readonly DependencyProperty DisplayDateStartProperty =
DependencyProperty.Register(
nameof(DisplayDateStart),
typeof(DateTime),
typeof(DateTimePicker),
new FrameworkPropertyMetadata(DateTime.Now, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));

/// <summary>
/// The display date start property.
/// </summary>
public static readonly DependencyProperty DisplayDateStartProperty =
DependencyProperty.Register(
nameof(DisplayDateStart),
typeof(DateTime),
typeof(DateTimePicker),
new PropertyMetadata(DateTime.MinValue, DateChanged));

/// <summary>
/// The display date end property.
/// </summary>
public static readonly DependencyProperty DisplayDateEndProperty =
DependencyProperty.Register(
nameof(DisplayDateEnd),
typeof(DateTime),
typeof(DateTimePicker),
new PropertyMetadata(DateTime.Now, DateChanged));

private const string DateTimeFormat = "dd.MM.yyyy HH:mm";

/// <summary>
/// Initializes a new instance of the <see cref="DateTimePicker"/> class.
/// </summary>
public DateTimePicker()
{
InitializeComponent();
CalDisplay.SelectedDatesChanged += CalDisplay_SelectedDatesChanged;
CalDisplay.SelectedDate = DateTime.Now;
}
new PropertyMetadata(DateTime.MinValue, DateChanged));

/// <summary>
/// Gets or sets the selected date.
/// </summary>
/// <value>
/// The selected date.
/// </value>
public DateTime SelectedDate
{
get => (DateTime)GetValue(SelectedDateProperty);
set => SetValue(SelectedDateProperty, value);
}
/// <summary>
/// The display date end property.
/// </summary>
public static readonly DependencyProperty DisplayDateEndProperty =
DependencyProperty.Register(
nameof(DisplayDateEnd),
typeof(DateTime),
typeof(DateTimePicker),
new PropertyMetadata(DateTime.Now, DateChanged));

/// <summary>
/// Gets or sets the display date start.
/// </summary>
/// <value>
/// The display date start.
/// </value>
public DateTime DisplayDateStart
{
get => (DateTime)GetValue(DisplayDateStartProperty);
set => SetValue(DisplayDateStartProperty, value);
}
private const string DateTimeFormat = "dd.MM.yyyy HH:mm";

/// <summary>
/// Gets or sets the display date end.
/// </summary>
/// <value>
/// The display date end.
/// </value>
public DateTime DisplayDateEnd
{
get => (DateTime)GetValue(DisplayDateEndProperty);
set => SetValue(DisplayDateEndProperty, value);
}
/// <summary>
/// Initializes a new instance of the <see cref="DateTimePicker"/> class.
/// </summary>
public DateTimePicker()
{
InitializeComponent();
CalDisplay.SelectedDatesChanged += CalDisplay_SelectedDatesChanged;
CalDisplay.SelectedDate = DateTime.Now;
}

/// <summary>
/// Gets or sets the selected date.
/// </summary>
/// <value>
/// The selected date.
/// </value>
public DateTime SelectedDate
{
get => (DateTime)GetValue(SelectedDateProperty);
set => SetValue(SelectedDateProperty, value);
}

/// <summary>
/// Gets or sets the display date start.
/// </summary>
/// <value>
/// The display date start.
/// </value>
public DateTime DisplayDateStart
{
get => (DateTime)GetValue(DisplayDateStartProperty);
set => SetValue(DisplayDateStartProperty, value);
}

/// <summary>
/// Gets or sets the display date end.
/// </summary>
/// <value>
/// The display date end.
/// </value>
public DateTime DisplayDateEnd
{
get => (DateTime)GetValue(DisplayDateEndProperty);
set => SetValue(DisplayDateEndProperty, value);
}

private static void DateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
private static void DateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (d is DateTimePicker dateTimePicker)
{
if (d is DateTimePicker dateTimePicker)
if (dateTimePicker.DisplayDateStart > dateTimePicker.DisplayDateEnd)
{
if (dateTimePicker.DisplayDateStart > dateTimePicker.DisplayDateEnd)
{
dateTimePicker.DisplayDateEnd = dateTimePicker.DisplayDateStart;
}

if (dateTimePicker.DisplayDateStart > dateTimePicker.SelectedDate)
{
dateTimePicker.SelectedDate = dateTimePicker.DisplayDateStart;
}

if (dateTimePicker.DisplayDateEnd < dateTimePicker.SelectedDate)
{
dateTimePicker.SelectedDate = dateTimePicker.DisplayDateEnd;
}

dateTimePicker.CalDisplay_SelectedDatesChanged(null, EventArgs.Empty);
dateTimePicker.DisplayDateEnd = dateTimePicker.DisplayDateStart;
}
}

private void CalDisplay_SelectedDatesChanged(object? sender, EventArgs e)
{
var hours = (Hours?.SelectedItem as ComboBoxItem)?.Content?.ToString() ?? "0";
var minutes = (Min?.SelectedItem as ComboBoxItem)?.Content?.ToString() ?? "0";
var timeSpan = TimeSpan.Parse(hours + ":" + minutes);
if (CalDisplay.SelectedDate.Value.Date == DateTime.Today.Date && timeSpan.CompareTo(DateTime.Now.TimeOfDay) < 0)
if (dateTimePicker.DisplayDateStart > dateTimePicker.SelectedDate)
{
timeSpan = TimeSpan.FromHours(DateTime.Now.Hour + 1);
dateTimePicker.SelectedDate = dateTimePicker.DisplayDateStart;
}

var date = CalDisplay.SelectedDate.Value.Date + timeSpan;
DateDisplay.Text = date.ToString(DateTimeFormat);
SelectedDate = date;
}
if (dateTimePicker.DisplayDateEnd < dateTimePicker.SelectedDate)
{
dateTimePicker.SelectedDate = dateTimePicker.DisplayDateEnd;
}

private void SaveTime_Click(object sender, RoutedEventArgs e)
{
CalDisplay_SelectedDatesChanged(SaveTime, EventArgs.Empty);
PopUpCalendarButton.IsChecked = false;
dateTimePicker.CalDisplay_SelectedDatesChanged(null, EventArgs.Empty);
}
}

private void Time_SelectionChanged(object sender, SelectionChangedEventArgs e)
private void CalDisplay_SelectedDatesChanged(object? sender, EventArgs e)
{
var hours = (Hours?.SelectedItem as ComboBoxItem)?.Content?.ToString() ?? "0";
var minutes = (Min?.SelectedItem as ComboBoxItem)?.Content?.ToString() ?? "0";
var timeSpan = TimeSpan.Parse(hours + ":" + minutes);
if (CalDisplay.SelectedDate.Value.Date == DateTime.Today.Date && timeSpan.CompareTo(DateTime.Now.TimeOfDay) < 0)
{
CalDisplay_SelectedDatesChanged(sender, e);
timeSpan = TimeSpan.FromHours(DateTime.Now.Hour + 1);
}

private void CalDisplay_PreviewMouseUp(object sender, MouseButtonEventArgs e)
var date = CalDisplay.SelectedDate.Value.Date + timeSpan;
DateDisplay.Text = date.ToString(DateTimeFormat);
SelectedDate = date;
}

private void SaveTime_Click(object sender, RoutedEventArgs e)
{
CalDisplay_SelectedDatesChanged(SaveTime, EventArgs.Empty);
PopUpCalendarButton.IsChecked = false;
}

private void Time_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
CalDisplay_SelectedDatesChanged(sender, e);
}

private void CalDisplay_PreviewMouseUp(object sender, MouseButtonEventArgs e)
{
// that it's not necessary to click twice after opening the calendar https://stackoverflow.com/q/6024372
if (Mouse.Captured is CalendarItem)
{
// that it's not necessary to click twice after opening the calendar https://stackoverflow.com/q/6024372
if (Mouse.Captured is CalendarItem)
{
Mouse.Capture(null);
}
Mouse.Capture(null);
}
}
}
Loading

0 comments on commit 89244cb

Please sign in to comment.