Skip to content

Commit

Permalink
update versions
Browse files Browse the repository at this point in the history
  • Loading branch information
HendrikMennen committed Nov 6, 2024
1 parent 6c1ce09 commit 4703b12
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 19 deletions.
8 changes: 4 additions & 4 deletions build/props/Base.props
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<StudioVersion>0.20.5.0</StudioVersion>
<CoreVersion>0.30.3.0</CoreVersion>
<UniversalFpgaProjectSystemVersion>0.30.3.0</UniversalFpgaProjectSystemVersion>
<EssentialsVersion>0.9.0</EssentialsVersion>
<StudioVersion>0.20.6.0</StudioVersion>
<CoreVersion>0.30.4.0</CoreVersion>
<UniversalFpgaProjectSystemVersion>0.40.0.0</UniversalFpgaProjectSystemVersion>
<EssentialsVersion>0.10.0</EssentialsVersion>
<Version>$(CoreVersion)</Version>
<Authors>Hendrik Mennen</Authors>
<Company>One Ware</Company>
Expand Down
2 changes: 1 addition & 1 deletion src/OneWare.Essentials/Models/Setting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public class ComboBoxSearchSetting(string title, string description, object defa

public class SliderSetting : TitledSetting
{
public SliderSetting(string title, string description, object defaultValue, double min, double max, double step) : base(
public SliderSetting(string title, string description, double defaultValue, double min, double max, double step) : base(
title, description, defaultValue)
{
Min = min;
Expand Down
4 changes: 2 additions & 2 deletions src/OneWare.Essentials/Services/ISettingsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ public void RegisterTitledFolderPath(string category, string subCategory, string
public void RegisterTitledFilePath(string category, string subCategory, string key, string title, string description,
string defaultValue, string? watermark, string? startDir, Func<string, bool>? validate, params FilePickerFileType[] fileTypes);

public void RegisterTitledSlider<T>(string category, string subCategory, string key, string title, string description,
T defaultValue, double min, double max, double step);
public void RegisterTitledSlider(string category, string subCategory, string key, string title, string description,
double defaultValue, double min, double max, double step);

public void RegisterTitledCombo<T>(string category, string subCategory, string key, string title,
string description,
Expand Down
6 changes: 2 additions & 4 deletions src/OneWare.Settings/SettingsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,9 @@ public void RegisterTitledFilePath(string category, string subCategory, string k
new FilePathSetting(title, description, defaultValue, watermark, startDir, validate, filters));
}

public void RegisterTitledSlider<T>(string category, string subCategory, string key, string title,
string description,
T defaultValue, double min, double max, double step)
public void RegisterTitledSlider(string category, string subCategory, string key, string title,
string description, double defaultValue, double min, double max, double step)
{
if (defaultValue == null) throw new NullReferenceException(nameof(defaultValue));
AddSetting(category, subCategory, key, new SliderSetting(title, description, defaultValue, min, max, step));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using OneWare.Essentials.Models;
using DynamicData.Binding;
using OneWare.Essentials.Models;

namespace OneWare.Settings.ViewModels.SettingTypes;

Expand All @@ -7,7 +8,18 @@ public class SliderSettingViewModel : TitledSettingViewModel
public SliderSettingViewModel(SliderSetting setting) : base(setting)
{
Setting = setting;

setting.WhenValueChanged(x => x.Value).Subscribe(x =>
{
OnPropertyChanged(nameof(TextBoxValue));
});
}

public new SliderSetting Setting { get; }

public double TextBoxValue
{
get => (double) Setting.Value;
set => Setting.Value = value < Setting.Min ? Setting.Min : value > Setting.Max ? Setting.Max : value;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<DockPanel>
<TextBox DockPanel.Dock="Right"
Width="100"
Text="{Binding Setting.Value}" />
Text="{Binding TextBoxValue}" />
<Slider DockPanel.Dock="Left"
Minimum="{Binding Setting.Min}"
Maximum="{Binding Setting.Max}"
Expand Down
12 changes: 6 additions & 6 deletions src/OneWare.SourceControl/ViewModels/SourceControlViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ public SourceControlViewModel(ILogger logger, ISettingsService settingsService,
DeleteRemoteDialogAsyncCommand = new AsyncRelayCommand(DeleteRemoteDialogAsync);
SetUserIdentityAsyncCommand = new AsyncRelayCommand<bool>(SetUserIdentityAsync);

settingsService.GetSettingObservable<int>("SourceControl_AutoFetchDelay")
settingsService.GetSettingObservable<double>("SourceControl_AutoFetchDelay")
.Subscribe(SetupFetchTimer);

settingsService.GetSettingObservable<int>("SourceControl_PollChangesDelay")
settingsService.GetSettingObservable<double>("SourceControl_PollChangesDelay")
.Subscribe(SetupPollTimer);

projectExplorerService
Expand Down Expand Up @@ -296,11 +296,11 @@ await Task.Run(() =>

#region General

private void SetupFetchTimer(int seconds)
private void SetupFetchTimer(double seconds)
{
if (_timer != null && Math.Abs(_timer.Interval.TotalSeconds - seconds) < 1) return;
_timer?.Stop();
_timer = new DispatcherTimer(new TimeSpan(0, 0, seconds), DispatcherPriority.Normal, FetchTimerCallback);
_timer = new DispatcherTimer(new TimeSpan(0, 0, (int)seconds), DispatcherPriority.Normal, FetchTimerCallback);
_timer.Start();
}

Expand All @@ -309,11 +309,11 @@ private void FetchTimerCallback(object? sender, EventArgs args)
if (_settingsService.GetSettingValue<bool>("SourceControl_AutoFetchEnable")) _ = FetchAsync();
}

private void SetupPollTimer(int seconds)
private void SetupPollTimer(double seconds)
{
if (_timer != null && Math.Abs(_timer.Interval.TotalSeconds - seconds) < 1) return;
_timer?.Stop();
_timer = new DispatcherTimer(new TimeSpan(0, 0, seconds), DispatcherPriority.Normal, PollTimerCallback);
_timer = new DispatcherTimer(new TimeSpan(0, 0, (int)seconds), DispatcherPriority.Normal, PollTimerCallback);
_timer.Start();
}

Expand Down

0 comments on commit 4703b12

Please sign in to comment.