diff --git a/Samples/Directory.Packages.props b/Samples/Directory.Packages.props
new file mode 100644
index 0000000000..3f24827b01
--- /dev/null
+++ b/Samples/Directory.Packages.props
@@ -0,0 +1,13 @@
+
+
+ true
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Samples/MvvmSample.Wpf/MvvmSample.Wpf/App.xaml.cs b/Samples/MvvmSample.Wpf/MvvmSample.Wpf/App.xaml.cs
index 41c001cc97..9b9bf71e09 100644
--- a/Samples/MvvmSample.Wpf/MvvmSample.Wpf/App.xaml.cs
+++ b/Samples/MvvmSample.Wpf/MvvmSample.Wpf/App.xaml.cs
@@ -16,7 +16,7 @@ protected override void RegisterTypes(IContainerRegistry containerRegistry)
protected override Window CreateShell()
{
- return new MainWindow();
+ return Container.Resolve();
}
}
}
diff --git a/Samples/MvvmSample.Wpf/MvvmSample.Wpf/Converters/UnitToStringConverter.cs b/Samples/MvvmSample.Wpf/MvvmSample.Wpf/Converters/UnitToStringConverter.cs
index 04dcdb901e..f7f2806f73 100644
--- a/Samples/MvvmSample.Wpf/MvvmSample.Wpf/Converters/UnitToStringConverter.cs
+++ b/Samples/MvvmSample.Wpf/MvvmSample.Wpf/Converters/UnitToStringConverter.cs
@@ -6,7 +6,7 @@
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Markup;
-using CommonServiceLocator;
+using Prism.Ioc;
using UnitsNet;
using WpfMVVMSample.Settings;
@@ -22,7 +22,7 @@ public UnitToStringConverter()
{
if (!DesignerProperties.GetIsInDesignMode(new DependencyObject()))
{
- _settings = ServiceLocator.Current.GetInstance();
+ _settings = Prism.Ioc.ContainerLocator.Container.Resolve();
}
}
diff --git a/Samples/MvvmSample.Wpf/MvvmSample.Wpf/MainWindow.xaml.cs b/Samples/MvvmSample.Wpf/MvvmSample.Wpf/MainWindow.xaml.cs
index e0d2d6299d..2245d7f9cf 100644
--- a/Samples/MvvmSample.Wpf/MvvmSample.Wpf/MainWindow.xaml.cs
+++ b/Samples/MvvmSample.Wpf/MvvmSample.Wpf/MainWindow.xaml.cs
@@ -1,17 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
-using System.Windows.Shapes;
+using System.Windows;
namespace WpfMVVMSample
{
diff --git a/Samples/MvvmSample.Wpf/MvvmSample.Wpf/MainWindowViewModel.cs b/Samples/MvvmSample.Wpf/MvvmSample.Wpf/MainWindowViewModel.cs
index bb9a26aafd..0019962e88 100644
--- a/Samples/MvvmSample.Wpf/MvvmSample.Wpf/MainWindowViewModel.cs
+++ b/Samples/MvvmSample.Wpf/MvvmSample.Wpf/MainWindowViewModel.cs
@@ -1,14 +1,5 @@
-using Prism.Commands;
-using Prism.Mvvm;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using Prism.Mvvm;
using UnitsNet;
-using UnitsNet.Units;
-using WpfMVVMSample.Converters;
-using WpfMVVMSample.Properties;
using WpfMVVMSample.Settings;
namespace WpfMVVMSample
diff --git a/Samples/MvvmSample.Wpf/MvvmSample.Wpf/MvvmSample.Wpf.csproj b/Samples/MvvmSample.Wpf/MvvmSample.Wpf/MvvmSample.Wpf.csproj
index 05e93234d6..cb757e1ceb 100644
--- a/Samples/MvvmSample.Wpf/MvvmSample.Wpf/MvvmSample.Wpf.csproj
+++ b/Samples/MvvmSample.Wpf/MvvmSample.Wpf/MvvmSample.Wpf.csproj
@@ -1,163 +1,25 @@
-
-
-
+
- Debug
- AnyCPU
- {B72F9215-70FF-4155-89BC-9A02CC550447}
+ net48
WinExe
WpfMVVMSample
- MvvmSample.Wpf
- v4.8
- 512
- {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- 4
- true
-
-
-
- AnyCPU
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- AnyCPU
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
+ false
+ true
+ true
-
- ..\..\packages\Unity.5.8.11\lib\net47\CommonServiceLocator.dll
-
-
- ..\..\packages\Prism.Core.7.1.0.431\lib\net45\Prism.dll
-
-
- ..\..\packages\Prism.Unity.7.1.0.431\lib\net45\Prism.Unity.Wpf.dll
-
-
- ..\..\packages\Prism.Wpf.7.1.0.431\lib\net45\Prism.Wpf.dll
-
-
+
+
+
+
-
- ..\..\packages\System.Configuration.ConfigurationManager.4.5.0\lib\net461\System.Configuration.ConfigurationManager.dll
-
-
-
-
- ..\..\packages\System.Security.AccessControl.4.5.0\lib\net461\System.Security.AccessControl.dll
-
-
- ..\..\packages\System.Security.Permissions.4.5.0\lib\net461\System.Security.Permissions.dll
-
-
- ..\..\packages\System.Security.Principal.Windows.4.5.1\lib\net461\System.Security.Principal.Windows.dll
-
-
- ..\..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll
-
-
- ..\..\packages\Prism.Wpf.7.1.0.431\lib\net45\System.Windows.Interactivity.dll
-
-
-
-
-
-
-
-
- 4.0
-
-
- ..\..\packages\UnitsNet.5.9.0\lib\netstandard2.0\UnitsNet.dll
-
-
- ..\..\packages\Unity.Abstractions.3.3.1\lib\net47\Unity.Abstractions.dll
-
-
- ..\..\packages\Unity.5.8.11\lib\net47\Unity.Configuration.dll
-
-
- ..\..\packages\Unity.Container.5.8.11\lib\net47\Unity.Container.dll
-
-
- ..\..\packages\Unity.5.8.11\lib\net47\Unity.Interception.dll
-
-
- ..\..\packages\Unity.5.8.11\lib\net47\Unity.Interception.Configuration.dll
-
-
- ..\..\packages\Unity.5.8.11\lib\net47\Unity.RegistrationByConvention.dll
-
-
- ..\..\packages\Unity.5.8.11\lib\net47\Unity.ServiceLocation.dll
-
-
-
-
-
-
-
- MSBuild:Compile
- Designer
-
-
-
-
- MSBuild:Compile
- Designer
-
-
- App.xaml
- Code
-
-
-
- MainWindow.xaml
- Code
-
-
-
-
-
- Code
-
-
- True
- True
- Resources.resx
-
-
- True
- Settings.settings
- True
-
-
- ResXFileCodeGenerator
- Resources.Designer.cs
-
-
-
- SettingsSingleFileGenerator
- Settings.Designer.cs
-
+
-
+
-
\ No newline at end of file
diff --git a/Samples/MvvmSample.Wpf/MvvmSample.Wpf/packages.config b/Samples/MvvmSample.Wpf/MvvmSample.Wpf/packages.config
deleted file mode 100644
index c7e5ee450f..0000000000
--- a/Samples/MvvmSample.Wpf/MvvmSample.Wpf/packages.config
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Samples/Samples.sln b/Samples/Samples.sln
index 2101631750..84ba089fe6 100644
--- a/Samples/Samples.sln
+++ b/Samples/Samples.sln
@@ -9,6 +9,13 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MvvmSample.Wpf", "MvvmSampl
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitConverter.Console", "UnitConverter.Console\UnitConverter.Console.csproj", "{B3141011-CEF2-46DE-B3DD-7FECD0D6108C}"
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_Files", "_Files", "{D3B39B9C-CE85-4929-A268-1AEBD945127C}"
+ ProjectSection(SolutionItems) = preProject
+ build.bat = build.bat
+ Directory.Packages.props = Directory.Packages.props
+ msbuild.cmd = msbuild.cmd
+ EndProjectSection
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
diff --git a/Samples/UnitConverter.Console/UnitConverter.Console.csproj b/Samples/UnitConverter.Console/UnitConverter.Console.csproj
index 21a2269189..3f3de72140 100644
--- a/Samples/UnitConverter.Console/UnitConverter.Console.csproj
+++ b/Samples/UnitConverter.Console/UnitConverter.Console.csproj
@@ -1,14 +1,14 @@
-
- Exe
- net7.0
- enable
- enable
-
+
+ Exe
+ net8.0
+ enable
+ enable
+
-
-
-
+
+
+
-
+
\ No newline at end of file
diff --git a/Samples/UnitConverter.Wpf/UnitConverter.Wpf/App.xaml b/Samples/UnitConverter.Wpf/UnitConverter.Wpf/App.xaml
index 0601f215a0..86dd63140b 100644
--- a/Samples/UnitConverter.Wpf/UnitConverter.Wpf/App.xaml
+++ b/Samples/UnitConverter.Wpf/UnitConverter.Wpf/App.xaml
@@ -8,10 +8,8 @@
-
-
-
-
+
+
diff --git a/Samples/UnitConverter.Wpf/UnitConverter.Wpf/IMainWindowVm.cs b/Samples/UnitConverter.Wpf/UnitConverter.Wpf/IMainWindowVm.cs
index d727ec84a3..c2ed86fb67 100644
--- a/Samples/UnitConverter.Wpf/UnitConverter.Wpf/IMainWindowVm.cs
+++ b/Samples/UnitConverter.Wpf/UnitConverter.Wpf/IMainWindowVm.cs
@@ -1,4 +1,4 @@
-using System.Collections.ObjectModel;
+using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Windows.Input;
using UnitsNet.Samples.UnitConverter.Wpf.Properties;
@@ -23,8 +23,8 @@ public interface IMainWindowVm : INotifyPropertyChanged
string FromHeader { get; }
string ToHeader { get; }
- decimal FromValue { get; set; }
- decimal ToValue { get; }
+ double FromValue { get; set; }
+ double ToValue { get; }
ICommand SwapCommand { get; }
}
}
diff --git a/Samples/UnitConverter.Wpf/UnitConverter.Wpf/MainWindow.xaml b/Samples/UnitConverter.Wpf/UnitConverter.Wpf/MainWindow.xaml
index 26fcdf48f5..81d8491452 100644
--- a/Samples/UnitConverter.Wpf/UnitConverter.Wpf/MainWindow.xaml
+++ b/Samples/UnitConverter.Wpf/UnitConverter.Wpf/MainWindow.xaml
@@ -7,12 +7,15 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:wpf="clr-namespace:UnitsNet.Samples.UnitConverter.Wpf"
mc:Ignorable="d"
- Title="UnitsNet - WPF unit converter sample app" Height="350" Width="525"
+ WindowStartupLocation="CenterScreen"
+ Title="UnitsNet - WPF unit converter sample app" Height="800" Width="800"
+ d:DesignHeight="600" d:DesignWidth="600"
d:DataContext="{d:DesignInstance wpf:MainWindowDesignVm, IsDesignTimeCreatable=True}">
+
@@ -29,7 +32,7 @@
SelectionChanged="Selector_OnSelectionChanged" />
-
+
-
+
-
-
-
-
-
-
+
-
-
-
+
diff --git a/Samples/UnitConverter.Wpf/UnitConverter.Wpf/MainWindowDesignVM.cs b/Samples/UnitConverter.Wpf/UnitConverter.Wpf/MainWindowDesignVM.cs
index 0e2f9d4483..89f47de952 100644
--- a/Samples/UnitConverter.Wpf/UnitConverter.Wpf/MainWindowDesignVM.cs
+++ b/Samples/UnitConverter.Wpf/UnitConverter.Wpf/MainWindowDesignVM.cs
@@ -1,4 +1,4 @@
-using System.Collections.Generic;
+using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
@@ -30,8 +30,8 @@ public MainWindowDesignVm()
public string FromHeader { get; } = "Value [cm]";
public string ToHeader { get; } = "Result [dm]";
- public decimal FromValue { get; set; } = 14.5m;
- public decimal ToValue { get; } = 1.45m;
+ public double FromValue { get; set; } = 14.5;
+ public double ToValue { get; } = 1.45;
public ICommand SwapCommand { get; } = new RoutedCommand();
diff --git a/Samples/UnitConverter.Wpf/UnitConverter.Wpf/MainWindowVM.cs b/Samples/UnitConverter.Wpf/UnitConverter.Wpf/MainWindowVM.cs
index 1abd00b8ea..a959ab87aa 100644
--- a/Samples/UnitConverter.Wpf/UnitConverter.Wpf/MainWindowVM.cs
+++ b/Samples/UnitConverter.Wpf/UnitConverter.Wpf/MainWindowVM.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
@@ -17,7 +17,7 @@ namespace UnitsNet.Samples.UnitConverter.Wpf
public sealed class MainWindowVm : IMainWindowVm
{
private readonly ObservableCollection _units;
- private decimal _fromValue;
+ private double _fromValue;
[CanBeNull] private UnitListItem _selectedFromUnit;
@@ -25,7 +25,7 @@ public sealed class MainWindowVm : IMainWindowVm
[CanBeNull] private UnitListItem _selectedToUnit;
- private decimal _toValue;
+ private double _toValue;
public MainWindowVm()
{
@@ -38,7 +38,7 @@ public MainWindowVm()
FromValue = 1;
SwapCommand = new DelegateCommand(Swap);
- OnSelectedQuantity(Length.Info.Name);
+ SelectedQuantity = Length.Info.Name;
}
public ICommand SwapCommand { get; }
@@ -90,24 +90,22 @@ public UnitListItem SelectedToUnit
public string ToHeader => $"Result [{SelectedToUnit?.Abbreviation}]";
- public decimal FromValue
+ public double FromValue
{
get => _fromValue;
set
{
- if (value == _fromValue) return;
_fromValue = value;
OnPropertyChanged();
UpdateResult();
}
}
- public decimal ToValue
+ public double ToValue
{
get => _toValue;
private set
{
- if (value == _toValue) return;
_toValue = value;
OnPropertyChanged();
}
@@ -118,7 +116,7 @@ private set
private void Swap()
{
UnitListItem oldToUnit = SelectedToUnit;
- decimal oldToValue = ToValue;
+ var oldToValue = ToValue;
// Setting these will change ToValue
SelectedToUnit = SelectedFromUnit;
@@ -131,11 +129,9 @@ private void UpdateResult()
{
if (SelectedFromUnit == null || SelectedToUnit == null) return;
- double convertedValue = UnitsNet.UnitConverter.Convert(FromValue,
+ ToValue = UnitsNet.UnitConverter.Convert(FromValue,
SelectedFromUnit.UnitEnumValue,
SelectedToUnit.UnitEnumValue);
-
- ToValue = Convert.ToDecimal(convertedValue);
}
private void OnSelectedQuantity(string quantityName)
diff --git a/Samples/UnitConverter.Wpf/UnitConverter.Wpf/UnitConverter.Wpf.csproj b/Samples/UnitConverter.Wpf/UnitConverter.Wpf/UnitConverter.Wpf.csproj
index 46938addba..29bc3a93e2 100644
--- a/Samples/UnitConverter.Wpf/UnitConverter.Wpf/UnitConverter.Wpf.csproj
+++ b/Samples/UnitConverter.Wpf/UnitConverter.Wpf/UnitConverter.Wpf.csproj
@@ -1,126 +1,30 @@
-
-
-
+
- Debug
- AnyCPU
- {D04EE35D-496A-4C83-A369-09B9B2BEAEEC}
+ net48
WinExe
UnitsNet.Samples.UnitConverter.Wpf
- UnitConverter.Wpf
- v4.8
- 512
- {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- 4
- true
-
-
-
- AnyCPU
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- AnyCPU
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
+ false
+ true
+ true
logo-512.ico
-
- ..\..\packages\ControlzEx.3.0.2.4\lib\net462\ControlzEx.dll
-
-
- ..\..\packages\MahApps.Metro.1.6.5\lib\net47\MahApps.Metro.dll
-
-
-
-
- ..\..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll
-
-
- ..\..\packages\ControlzEx.3.0.2.4\lib\net462\System.Windows.Interactivity.dll
-
-
-
-
-
-
-
-
- 4.0
-
-
- ..\..\packages\UnitsNet.5.9.0\lib\netstandard2.0\UnitsNet.dll
-
-
-
-
-
-
-
- MSBuild:Compile
- Designer
-
-
-
- MSBuild:Compile
- Designer
-
-
- App.xaml
- Code
-
-
-
-
- MainWindow.xaml
- Code
-
+
+
+
-
-
-
-
- Code
-
-
- True
- True
- Resources.resx
-
-
- True
- Settings.settings
- True
-
-
- ResXFileCodeGenerator
- Resources.Designer.cs
-
-
-
- SettingsSingleFileGenerator
- Settings.Designer.cs
-
+
+
-
+
+
-
+
-
+
\ No newline at end of file
diff --git a/Samples/UnitConverter.Wpf/UnitConverter.Wpf/UnitListItem.cs b/Samples/UnitConverter.Wpf/UnitConverter.Wpf/UnitListItem.cs
index 555fc3195d..3892c639cb 100644
--- a/Samples/UnitConverter.Wpf/UnitConverter.Wpf/UnitListItem.cs
+++ b/Samples/UnitConverter.Wpf/UnitConverter.Wpf/UnitListItem.cs
@@ -14,7 +14,7 @@ public UnitListItem(Enum val)
UnitEnumValue = val;
UnitEnumValueInt = Convert.ToInt32(val);
UnitEnumType = val.GetType();
- Abbreviation = UnitAbbreviationsCache.Default.GetDefaultAbbreviation(UnitEnumType, UnitEnumValueInt);
+ Abbreviation = UnitsNetSetup.Default.UnitAbbreviations.GetDefaultAbbreviation(UnitEnumType, UnitEnumValueInt);
Text = $"{val} [{Abbreviation}]";
}
diff --git a/Samples/UnitConverter.Wpf/UnitConverter.Wpf/packages.config b/Samples/UnitConverter.Wpf/UnitConverter.Wpf/packages.config
deleted file mode 100644
index 6a2293dbe8..0000000000
--- a/Samples/UnitConverter.Wpf/UnitConverter.Wpf/packages.config
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file