Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS has been phased out. To see alternatives please check here

Skip to content
Snippets Groups Projects
Commit 907a945d authored by Harald Martini's avatar Harald Martini
Browse files

Added VECTO3GUI2020 Project, added missing strings to XMLNames

renamed IEngineFuelDelcarationInputData to IEngineFuelDeclarationInputData
parent 4897a866
No related branches found
No related tags found
No related merge requests found
Showing
with 772 additions and 12 deletions

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
# Visual Studio Version 16
VisualStudioVersion = 16.0.31112.23
MinimumVisualStudioVersion = 10.0.40219.1
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "VECTO", "VECTO\VECTO.vbproj", "{AAC0F132-0A9F-45B3-B682-77AC9B24B352}"
ProjectSection(ProjectDependencies) = postProject
......@@ -72,6 +72,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PluginsDEV", "PluginsDEV",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VectoAPI", "..\VECTO_API_DEV\VectoAPI\VectoAPI.csproj", "{DD260CC4-7978-45E3-8646-AD4F5E6A8FA2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VECTO3GUI2020", "VECTO3GUI2020\VECTO3GUI2020.csproj", "{7E9172D4-07E3-4077-814E-7117AB2B3E22}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug PerformanceStats|Any CPU = Debug PerformanceStats|Any CPU
......@@ -864,6 +866,48 @@ Global
{DD260CC4-7978-45E3-8646-AD4F5E6A8FA2}.ReleaseTUG|x64.Build.0 = Release|Any CPU
{DD260CC4-7978-45E3-8646-AD4F5E6A8FA2}.ReleaseTUG|x86.ActiveCfg = Release|Any CPU
{DD260CC4-7978-45E3-8646-AD4F5E6A8FA2}.ReleaseTUG|x86.Build.0 = Release|Any CPU
{7E9172D4-07E3-4077-814E-7117AB2B3E22}.Debug PerformanceStats|Any CPU.ActiveCfg = Debug|Any CPU
{7E9172D4-07E3-4077-814E-7117AB2B3E22}.Debug PerformanceStats|Any CPU.Build.0 = Debug|Any CPU
{7E9172D4-07E3-4077-814E-7117AB2B3E22}.Debug PerformanceStats|x64.ActiveCfg = Debug|Any CPU
{7E9172D4-07E3-4077-814E-7117AB2B3E22}.Debug PerformanceStats|x64.Build.0 = Debug|Any CPU
{7E9172D4-07E3-4077-814E-7117AB2B3E22}.Debug PerformanceStats|x86.ActiveCfg = Debug|Any CPU
{7E9172D4-07E3-4077-814E-7117AB2B3E22}.Debug PerformanceStats|x86.Build.0 = Debug|Any CPU
{7E9172D4-07E3-4077-814E-7117AB2B3E22}.Debug PerformanceTrace|Any CPU.ActiveCfg = Debug|Any CPU
{7E9172D4-07E3-4077-814E-7117AB2B3E22}.Debug PerformanceTrace|Any CPU.Build.0 = Debug|Any CPU
{7E9172D4-07E3-4077-814E-7117AB2B3E22}.Debug PerformanceTrace|x64.ActiveCfg = Debug|Any CPU
{7E9172D4-07E3-4077-814E-7117AB2B3E22}.Debug PerformanceTrace|x64.Build.0 = Debug|Any CPU
{7E9172D4-07E3-4077-814E-7117AB2B3E22}.Debug PerformanceTrace|x86.ActiveCfg = Debug|Any CPU
{7E9172D4-07E3-4077-814E-7117AB2B3E22}.Debug PerformanceTrace|x86.Build.0 = Debug|Any CPU
{7E9172D4-07E3-4077-814E-7117AB2B3E22}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7E9172D4-07E3-4077-814E-7117AB2B3E22}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7E9172D4-07E3-4077-814E-7117AB2B3E22}.Debug|x64.ActiveCfg = Debug|Any CPU
{7E9172D4-07E3-4077-814E-7117AB2B3E22}.Debug|x64.Build.0 = Debug|Any CPU
{7E9172D4-07E3-4077-814E-7117AB2B3E22}.Debug|x86.ActiveCfg = Debug|Any CPU
{7E9172D4-07E3-4077-814E-7117AB2B3E22}.Debug|x86.Build.0 = Debug|Any CPU
{7E9172D4-07E3-4077-814E-7117AB2B3E22}.DebugTUG|Any CPU.ActiveCfg = Debug|Any CPU
{7E9172D4-07E3-4077-814E-7117AB2B3E22}.DebugTUG|Any CPU.Build.0 = Debug|Any CPU
{7E9172D4-07E3-4077-814E-7117AB2B3E22}.DebugTUG|x64.ActiveCfg = Debug|Any CPU
{7E9172D4-07E3-4077-814E-7117AB2B3E22}.DebugTUG|x64.Build.0 = Debug|Any CPU
{7E9172D4-07E3-4077-814E-7117AB2B3E22}.DebugTUG|x86.ActiveCfg = Debug|Any CPU
{7E9172D4-07E3-4077-814E-7117AB2B3E22}.DebugTUG|x86.Build.0 = Debug|Any CPU
{7E9172D4-07E3-4077-814E-7117AB2B3E22}.Deploy|Any CPU.ActiveCfg = Debug|Any CPU
{7E9172D4-07E3-4077-814E-7117AB2B3E22}.Deploy|Any CPU.Build.0 = Debug|Any CPU
{7E9172D4-07E3-4077-814E-7117AB2B3E22}.Deploy|x64.ActiveCfg = Debug|Any CPU
{7E9172D4-07E3-4077-814E-7117AB2B3E22}.Deploy|x64.Build.0 = Debug|Any CPU
{7E9172D4-07E3-4077-814E-7117AB2B3E22}.Deploy|x86.ActiveCfg = Debug|Any CPU
{7E9172D4-07E3-4077-814E-7117AB2B3E22}.Deploy|x86.Build.0 = Debug|Any CPU
{7E9172D4-07E3-4077-814E-7117AB2B3E22}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7E9172D4-07E3-4077-814E-7117AB2B3E22}.Release|Any CPU.Build.0 = Release|Any CPU
{7E9172D4-07E3-4077-814E-7117AB2B3E22}.Release|x64.ActiveCfg = Release|Any CPU
{7E9172D4-07E3-4077-814E-7117AB2B3E22}.Release|x64.Build.0 = Release|Any CPU
{7E9172D4-07E3-4077-814E-7117AB2B3E22}.Release|x86.ActiveCfg = Release|Any CPU
{7E9172D4-07E3-4077-814E-7117AB2B3E22}.Release|x86.Build.0 = Release|Any CPU
{7E9172D4-07E3-4077-814E-7117AB2B3E22}.ReleaseTUG|Any CPU.ActiveCfg = Release|Any CPU
{7E9172D4-07E3-4077-814E-7117AB2B3E22}.ReleaseTUG|Any CPU.Build.0 = Release|Any CPU
{7E9172D4-07E3-4077-814E-7117AB2B3E22}.ReleaseTUG|x64.ActiveCfg = Release|Any CPU
{7E9172D4-07E3-4077-814E-7117AB2B3E22}.ReleaseTUG|x64.Build.0 = Release|Any CPU
{7E9172D4-07E3-4077-814E-7117AB2B3E22}.ReleaseTUG|x86.ActiveCfg = Release|Any CPU
{7E9172D4-07E3-4077-814E-7117AB2B3E22}.ReleaseTUG|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......@@ -889,4 +933,7 @@ Global
{52430C51-892A-4D8E-9189-B6C9D09791C0} = {5DDEEEC2-743F-4395-B058-687B5773E3D2}
{DD260CC4-7978-45E3-8646-AD4F5E6A8FA2} = {C4D97EBF-BA80-4943-9D27-33179405D8D5}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B38F3172-132E-43F7-9C4B-5FDC3A28C051}
EndGlobalSection
EndGlobal
......@@ -120,5 +120,6 @@
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002EFormat_002ESettingsUpgrade_002EAlignmentTabFillStyleMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002EJavaScript_002ECodeStyle_002ESettingsUpgrade_002EJsParsFormattingSettingsUpgrader/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002EJavaScript_002ECodeStyle_002ESettingsUpgrade_002EJsWrapperSettingsUpgrader/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002EVB_002ECodeStyle_002ESettingsUpgrade_002EVBSpaceAfterUnaryMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002EXml_002ECodeStyle_002EFormatSettingsUpgrade_002EXmlMoveToCommonFormatterSettingsUpgrade/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=RESS/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
......@@ -341,9 +341,9 @@ Public Class Engine
End Get
End Property
Public ReadOnly Property Fuels As IList(Of IEngineFuelDelcarationInputData) Implements IEngineModeDeclarationInputData.Fuels
Public ReadOnly Property Fuels As IList(Of IEngineFuelDeclarationInputData) Implements IEngineModeDeclarationInputData.Fuels
Get
Dim retval As List(Of IEngineFuelDelcarationInputData) = New List(Of IEngineFuelDelcarationInputData)({PrimaryEngineFuel})
Dim retval As List(Of IEngineFuelDeclarationInputData) = New List(Of IEngineFuelDeclarationInputData)({PrimaryEngineFuel})
If (DualFuelInput) Then
retval.Add(SecondaryEngineFuel)
End If
......@@ -477,7 +477,7 @@ Public Class WHRData
End Class
Public Class EngineFuel
Implements IEngineFuelDelcarationInputData, IEngineFuelEngineeringInputData
Implements IEngineFuelDeclarationInputData, IEngineFuelEngineeringInputData
''' <summary>
''' WHTC Urban test results. Saved in input file.
......@@ -533,37 +533,37 @@ Public Class EngineFuel
WHTCEngineeringInput = 1
End Sub
Public ReadOnly Property WHTCMotorway As Double Implements IEngineFuelDelcarationInputData.WHTCMotorway
Public ReadOnly Property WHTCMotorway As Double Implements IEngineFuelDeclarationInputData.WHTCMotorway
Get
Return WHTCMotorwayInput
End Get
End Property
Public ReadOnly Property WHTCRural As Double Implements IEngineFuelDelcarationInputData.WHTCRural
Public ReadOnly Property WHTCRural As Double Implements IEngineFuelDeclarationInputData.WHTCRural
Get
Return WHTCRuralInput
End Get
End Property
Public ReadOnly Property WHTCUrban As Double Implements IEngineFuelDelcarationInputData.WHTCUrban
Public ReadOnly Property WHTCUrban As Double Implements IEngineFuelDeclarationInputData.WHTCUrban
Get
Return WHTCUrbanInput
End Get
End Property
Public ReadOnly Property ColdHotBalancingFactor As Double Implements IEngineFuelDelcarationInputData.ColdHotBalancingFactor
Public ReadOnly Property ColdHotBalancingFactor As Double Implements IEngineFuelDeclarationInputData.ColdHotBalancingFactor
Get
Return ColdHotBalancingFactorInput
End Get
End Property
Public ReadOnly Property CorrectionFactorRegPer As Double Implements IEngineFuelDelcarationInputData.CorrectionFactorRegPer
Public ReadOnly Property CorrectionFactorRegPer As Double Implements IEngineFuelDeclarationInputData.CorrectionFactorRegPer
Get
Return correctionFactorRegPerInput
End Get
End Property
Public ReadOnly Property FuelType As FuelType Implements IEngineFuelDelcarationInputData.FuelType
Public ReadOnly Property FuelType As FuelType Implements IEngineFuelDeclarationInputData.FuelType
Get
Return FuelTypeInput
End Get
......@@ -589,7 +589,7 @@ Public Class EngineFuel
End Set
End Property
Public ReadOnly Property FuelConsumptionMap As TableData Implements IEngineFuelDelcarationInputData.FuelConsumptionMap
Public ReadOnly Property FuelConsumptionMap As TableData Implements IEngineFuelDeclarationInputData.FuelConsumptionMap
Get
If Not File.Exists(_fuelConsumptionMapPath.FullPath) Then _
Throw New VectoException("FuelConsumptionMap is missing or invalid")
......
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="VECTO3GUI2020.Properties.Application" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="VECTO3GUI2020.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
<userSettings>
<VECTO3GUI2020.Properties.Application>
<setting name="Path" serializeAs="String">
<value />
</setting>
</VECTO3GUI2020.Properties.Application>
<VECTO3GUI2020.Properties.Settings>
<setting name="EngineeringMode" serializeAs="String">
<value>False</value>
</setting>
<setting name="DefaultFilePath" serializeAs="String">
<value>../../../VectoCore/VectoCoreTest/TestData/XML/XMLReaderDeclaration</value>
</setting>
</VECTO3GUI2020.Properties.Settings>
</userSettings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Ninject" publicKeyToken="c7192dc5380945e7" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.3.4.0" newVersion="3.3.4.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Reactive.Linq" publicKeyToken="94bc3704cddfc263" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.6000.0" newVersion="3.0.6000.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Reactive.Core" publicKeyToken="94bc3704cddfc263" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.6000.0" newVersion="3.0.6000.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
\ No newline at end of file
<Application x:Class="VECTO3GUI2020.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:VECTO3GUI2020">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!-- Add new ResourceDictionaries here-->
<ResourceDictionary Source="Resources/ViewModelBindings.xaml"/>
<ResourceDictionary Source="Resources/Converter.xaml"/>
<ResourceDictionary Source="Resources/GlobalStyles.xaml"/>
<ResourceDictionary Source="Resources/Colors.xaml"/>
<ResourceDictionary Source="DataGridStyles.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
using System.Windows;
using Ninject;
using VECTO3GUI2020.ViewModel.Interfaces;
using VECTO3GUI2020.ViewModel.Implementation;
using VECTO3GUI2020.Model.Interfaces;
using VECTO3GUI2020.Model;
using TUGraz.VectoCore;
using VECTO3GUI2020.Helper;
using VECTO3GUI2020.Model.Implementation;
using VECTO3GUI2020.Ninject;
using VECTO3GUI2020.Ninject.Vehicle;
namespace VECTO3GUI2020
{
public partial class App : Application
{
private IKernel container;
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
ConfigureContainer();
ConfigureMainWindow();
}
private void ConfigureContainer()
{
container = new StandardKernel(
new VectoNinjectModule(),
new JobEditModule(),
new ComponentModule(),
new DocumentModule(),
new XMLWriterFactoryModule()
) ;
container.Bind<IJobListViewModel>().To<JobListViewModel>();
container.Bind<IMainWindowViewModel>().To<MainWindowViewModel>();
container.Bind<IMainViewModel>().To<JobListViewModel>();
container.Bind<ISettingsViewModel>().To<SettingsViewModel>();
container.Bind<ISettingsModel>().To<SettingsModel>();
container.Bind<IDialogHelper>().To<DialogHelper>();
container.Bind<IWindowHelper>().To<WindowHelper>();
}
private void ConfigureMainWindow()
{
//Windows to test controls
//var testwindow = container.Get<Test>();
//testwindow.Show();
var mainwindow = container.Get<MainWindow>();
this.MainWindow = mainwindow;
this.MainWindow.Show();
}
}
}
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:VECTO3GUI2020" xmlns:Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero2">
</ResourceDictionary>
\ No newline at end of file
File added
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace VECTO3GUI2020.Helper.Converter
{
//https://stackoverflow.com/questions/9893825/mvvm-hiding-a-control-when-bound-property-is-not-present
public class AlwaysVisibleConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return Visibility.Visible;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
using System;
using System.Globalization;
using System.Windows.Data;
namespace VECTO3GUI2020.Helper.Converter
{
class JobTypeStringConverter : IValueConverter
{
/*
public string JobTypeToString(JobType jobtype)
{
switch (jobtype)
{
case JobType.CompletedBus:
return "Completed Bus";
case JobType.HeavyLorry:
return "Heavy Lorry";
case JobType.PrimaryBus:
return "Primary Bus";
case JobType.Unknown:
return "Unknown";
default:
return jobtype.ToString();
}
}
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (!(value is JobType))
{
return Binding.DoNothing;
}
JobType jobtype = (JobType)value;
return JobTypeToString(jobtype);
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
*/
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
using TUGraz.VectoCommon.Utils;
using SIUtils = VECTO3GUI2020.Util.SIUtils;
namespace VECTO3GUI2020.Helper.Converter
{
class LabledTextBoxConverter : IValueConverter
{
protected const double ToRpm = 60 / (2 * Math.PI);
protected const double ToCubicCentimeter = 1e6;
private object _originalobject;
public object OriginalObject
{
get { return _originalobject; }
set { _originalobject = value; }
}
#region Implementation of IValueConverter
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
OriginalObject = value;
if (value == null)
{
return DependencyProperty.UnsetValue;
}
if (!(value is SI))
{
return value;
//return DependencyProperty.UnsetValue;
//throw new Exception("Can only convert SI types!");
}
var siValue = value as SI;
var doubleVal = siValue.Value();
var conversionFactor = 1.0;
if (value is SI SIvalue)
{
if (SIvalue.UnitString == "1/s")
conversionFactor = ToRpm;
}
var stringParam = parameter as string;
int? decimals = null;
if (!string.IsNullOrEmpty(stringParam))
{
var args = stringParam.Split('|');
foreach (var arg in args)
{
GetDecimals(arg, ref decimals);
GetConversionFactor(ref conversionFactor, arg);
}
}
doubleVal *= conversionFactor;
return decimals == null ? doubleVal.ToString(culture) : doubleVal.ToString("F" + decimals.Value, culture);
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
targetType = OriginalObject.GetType();
if (!typeof(SI).IsAssignableFrom(targetType))
{
return value;
//return DependencyProperty.UnsetValue;
}
if (value == null)
{
return DependencyProperty.UnsetValue;
}
var stringParam = parameter as string;
int? decimals = null;
var conversionFactor = 1.0;
if (OriginalObject.GetType() == typeof(PerSecond))
{
conversionFactor = ToRpm;
}
if (!string.IsNullOrEmpty(stringParam))
{
var args = stringParam.Split('|');
foreach (var arg in args)
{
GetDecimals(arg, ref decimals);
GetConversionFactor(ref conversionFactor, arg);
}
}
double doubleVal;
var success = double.TryParse(value.ToString(), NumberStyles.Float, culture, out doubleVal);
if (!success)
{
return DependencyProperty.UnsetValue;
}
if (decimals != null)
{
doubleVal = Math.Round(doubleVal, decimals.Value, MidpointRounding.AwayFromZero);
}
doubleVal /= conversionFactor;
return SIUtils.CreateSIValue(targetType, doubleVal);
}
private void GetConversionFactor(ref double factor, string convertId)
{
switch (convertId.ToLower())
{
case "asrpm":
factor = ToRpm;
break;
case "ascubiccentimeter":
factor = ToCubicCentimeter;
break;
}
}
private void GetDecimals(string arg, ref int? decimals)
{
switch (arg.ToLower())
{
case "int":
decimals = 0;
break;
case "double2":
decimals = 2;
break;
case "double3":
decimals = 3;
break;
case "double4":
decimals = 4;
break;
}
}
#endregion
}
}
using System;
using System.Globalization;
using System.Windows.Data;
namespace VECTO3GUI2020.Helper.Converter
{
class LabledTextBoxLabelConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return value;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace VECTO3GUI2020.Helper.Converter
{
class NullToVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if(value == null)
{
return Visibility.Collapsed;
}
else
{
return Binding.DoNothing;
}
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
using System;
using System.Globalization;
using System.Windows.Data;
using TUGraz.VectoCommon.Utils;
namespace VECTO3GUI2020.Helper.Converter
{
class SIToUnitString : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if(value is SI SIValue)
{
if (SIValue.UnitString == "1/s")
{
return "rpm";
}
return SIValue.UnitString;
}
return Binding.DoNothing;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
using System;
using System.Globalization;
using System.Windows.Data;
using TUGraz.VectoCommon.Utils;
namespace VECTO3GUI2020.Helper.Converter
{
class SIValueToStringConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if(value is SI SIvalue)
{
return SIvalue.ToGUIFormat();
}
return Binding.DoNothing;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
namespace VECTO3GUI2020.Helper.Converter
{
class VehicleCategoryToStringConverter
{
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;
using System.Windows.Forms;
using Microsoft.WindowsAPICodePack.Dialogs;
using VECTO3GUI2020.Properties;
using MessageBox = System.Windows.MessageBox;
namespace VECTO3GUI2020.Helper
{
public class DialogHelper : IDialogHelper
{
private readonly string _defaultInitialDirectory = System.IO.Path.GetDirectoryName(
System.Reflection.Assembly.GetExecutingAssembly().Location);
#region File and Folder Dialogs
private string _xmlFilter = "XML Files (*.xml)|*.xml";
public string FileName { get; set; }
private string[] OpenFilesDialog(string filter, string initialDirectory, bool multiselect)
{
using (OpenFileDialog fd = new OpenFileDialog {
InitialDirectory = initialDirectory ?? _defaultInitialDirectory,
Multiselect = multiselect,
Filter = filter
}) {
var result = fd.ShowDialog();
if (result == DialogResult.OK)
{
return fd.FileNames;
}
}
return null;
}
public string OpenFileDialog(string filter = "All files (*.*)|*.*", string initialDirectory = null)
{
return OpenFilesDialog(filter, initialDirectory)?[0];
}
public string[] OpenFilesDialog(string filter, string initialDirectory)
{
return OpenFilesDialog(filter, initialDirectory, true);
}
public string[] OpenXMLFilesDialog(string initialDirectory)
{
return OpenFilesDialog(_xmlFilter, initialDirectory);
}
public string OpenXMLFileDialog(string initialDirectory)
{
return OpenFilesDialog(_xmlFilter, initialDirectory, false)?[0];
}
public string OpenFolderDialog(string initialDirectory = null)
{
using (var dialog = new CommonOpenFileDialog())
{
dialog.InitialDirectory = initialDirectory;
dialog.IsFolderPicker = true;
var result = dialog.ShowDialog();
if (result == CommonFileDialogResult.Ok)
{
return dialog.FileName;
}
}
return null;
}
#endregion
#region Messagebox
public MessageBoxResult ShowMessageBox(string messageBoxText,
string caption,
MessageBoxButton button,
MessageBoxImage icon)
{
return MessageBox.Show(messageBoxText, caption, button, icon);
}
public MessageBoxResult ShowMessageBox(string messageBoxTest, string caption)
{
return MessageBox.Show(messageBoxTest, caption);
}
public string SaveToDialog(string initialDirectory, string filter)
{
using (var saveFileDialog = new SaveFileDialog {
Filter = filter
}) {
saveFileDialog.InitialDirectory = initialDirectory ?? _defaultInitialDirectory;
return saveFileDialog.ShowDialog() == DialogResult.OK ? saveFileDialog.FileName : null;
}
}
public string SaveToXMLDialog(string initialDirectory)
{
return SaveToDialog(initialDirectory, _xmlFilter);
}
#endregion
}
public interface IDialogHelper
{
/// <summary>
/// Opens a dialog to open a file
/// </summary>
/// <param name="filter"></param>
/// <param name="initialDirectory">If no directory is specified the location of the assembly is used</param>
/// <returns></returns>
string OpenFileDialog(string filter = "All files (*.*)|*.*", string initialDirectory = null);
/// <summary>
/// Opens a dialog to open files
/// </summary>
/// <param name="filter"></param>
/// <param name="initialDirectory">If no directory is specified the location of the assembly is used</param>
/// <returns></returns>
string[] OpenFilesDialog(string filter = "All files (*.*|*.*", string initialDirectory = null);
/// <summary>
/// Opens a dialog to open a XML-file
/// </summary>
/// <param name="initialDirectory">If no directory is specified the location of the assembly is used</param>
/// <returns></returns>
string OpenXMLFileDialog(string initialDirectory = null);
/// <summary>
/// Opens a dialog to open XML-files
/// </summary>
/// <param name="initialDirectory">If no directory is specified the location of the assembly is used</param>
/// <returns></returns>
string[] OpenXMLFilesDialog(string initialDirectory = null);
/// <summary>
/// Opens a dialog to pick a folder, if no initialdirectory is specified the location of the assembly is used
/// </summary>
/// <param name="initialDirectory"></param>
/// <returns></returns>
string OpenFolderDialog(string initialDirectory = null);
/// <summary>
/// Displays a messagebox
/// </summary>
/// <param name="messageBoxText"></param>
/// <param name="caption"></param>
/// <param name="button"></param>
/// <param name="icon"></param>
/// <returns></returns>
MessageBoxResult ShowMessageBox(string messageBoxText,
string caption,
MessageBoxButton button,
MessageBoxImage icon);
/// <summary>
/// Displays a messagebox
/// </summary>
/// <param name="messageBoxTest"></param>
/// <param name="caption"></param>
/// <returns></returns>
MessageBoxResult ShowMessageBox(string messageBoxTest, string caption);
string SaveToDialog(string initialDirectory = null, string filter = "All files (*.*|*.*");
string SaveToXMLDialog(string initialDirectory = null);
}
}
namespace VECTO3GUI2020.Helper
{
public class Extension
{
}
}
\ No newline at end of file
namespace VECTO3GUI2020.Helper
{
public interface IWindowHelper
{
void ShowWindow(object viewModel);
}
}
\ No newline at end of file
using System.Windows;
using VECTO3GUI2020.ViewModel.Implementation.Common;
using VECTO3GUI2020.ViewModel.Interfaces.Common;
namespace VECTO3GUI2020.Helper
{
public class WindowHelper : IWindowHelper
{
public void ShowWindow(object viewModel)
{
var window = new Window {
Content = viewModel,
Width = 800,
Height = 600,
WindowStartupLocation = WindowStartupLocation.CenterScreen
};
if (viewModel is IViewModelBase vmBase) {
window.Title = vmBase.Title;
}
window.Show();
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment