- aggiunta EffectorWindow con TitleBar

- Utilizzata EffectorWindow per MultipleCopyWnd
- Utilizzata BaseWindow per ProcessManagerV
- aggiunto titolo a TitleBar
- aggiunto modulo Converters
This commit is contained in:
Emmanuele Sassi
2025-02-26 15:01:11 +01:00
parent 54e2f27a44
commit dcaef9eaa9
9 changed files with 290 additions and 135 deletions
@@ -47,6 +47,9 @@
</PropertyGroup>
<PropertyGroup />
<ItemGroup>
<Reference Include="EgwWPFBaseLib">
<HintPath>..\..\..\EgwWPFBaseLib\EgwWPFBaseLib\bin\Debug\EgwWPFBaseLib.dll</HintPath>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
@@ -84,7 +87,7 @@
<Compile Include="Constants\ConstGen.vb" />
<Compile Include="Constants\ConstIni.vb" />
<Compile Include="Constants\PluginConstIni.vb" />
<Compile Include="EgtWindow\EgtWindow.vb" />
<Compile Include="EffectorWindow\EffectorWindow.vb" />
<Compile Include="MultipleCopyWnd\MultipleCopyWndV.xaml.vb">
<DependentUpon>MultipleCopyWndV.xaml</DependentUpon>
</Compile>
@@ -110,6 +113,7 @@
<DependentUpon>TitleBarV.xaml</DependentUpon>
</Compile>
<Compile Include="Utility\Command.vb" />
<Compile Include="Utility\Converters.vb" />
<Compile Include="Utility\ExecProcessManager.vb" />
<Compile Include="Utility\GenInterface.vb" />
<Compile Include="Utility\IdNameStruct.vb" />
@@ -154,9 +158,7 @@
<Resource Include="Resources\Effector.ico" />
<Resource Include="Resources\EgalwareLogo.png" />
</ItemGroup>
<ItemGroup>
<Folder Include="EffectorWindow\" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
<PropertyGroup>
<PostBuildEvent>copy $(TargetPath) c:\EgtData\Effector\Plugin\Effector.Plugin.DoorArreda\Effector.Plugin.Lib.dll
@@ -0,0 +1,42 @@
' Follow steps 1a or 1b and then 2 to use this custom control in a XAML file.
'
' Step 1a) Using this custom control in a XAML file that exists in the current project.
' Add this XmlNamespace attribute to the root element of the markup file where it is
' to be used:
'
' xmlns:MyNamespace="clr-namespace:Effector.Plugin.Lib"
'
'
' Step 1b) Using this custom control in a XAML file that exists in a different project.
' Add this XmlNamespace attribute to the root element of the markup file where it is
' to be used:
'
' xmlns:MyNamespace="clr-namespace:Effector.Plugin.Lib;assembly=Effector.Plugin.Lib"
'
' You will also need to add a project reference from the project where the XAML file lives
' to this project and Rebuild to avoid compilation errors:
'
' Right click on the target project in the Solution Explorer and
' "Add Reference"->"Projects"->[Browse to and select this project]
'
'
' Step 2)
' Go ahead and use your control in the XAML file. Note that Intellisense in the
' XML editor does not currently work on custom controls and its child elements.
'
' <MyNamespace:EffectorWindow/>
'
Imports System.Windows.Controls.Primitives
Imports EgwWPFBaseLib
Public Class EffectorWindow
Inherits EgwWPFBaseLib.EgtWindow
Shared Sub New()
'This OverrideMetadata call tells the system that this element wants to provide a style that is different than its base class.
'This style is defined in themes\generic.xaml
DefaultStyleKeyProperty.OverrideMetadata(GetType(EffectorWindow), new FrameworkPropertyMetadata(GetType(EffectorWindow)))
End Sub
End Class
@@ -1,109 +1,8 @@
<local:EgtWindow x:Class="EffectorWindowV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Effector.Plugin.Lib"
TitleBarHeight="40">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="{Binding TitleBarHeight, RelativeSource={RelativeSource AncestorType={x:Type Lib:EgtWindow}}}"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Border Grid.Column="0"
Grid.ColumnSpan="6"
BorderThickness="0"
BorderBrush="{StaticResource Effector_Blue}"
Background="{StaticResource Effector_Blue}"/>
<Image Grid.Column="0"
MinWidth="{Binding ActualHeight, RelativeSource={RelativeSource Self}}"
Source="/Resources/Effector.ico"/>
<ContentControl Grid.Column="1"
Content="{Binding ContentMenu}"/>
<TextBlock Grid.Column="2"
Margin="4 0 0 0"
VerticalAlignment="Center"
HorizontalAlignment="Center"
FontSize="14"
Text="{Binding sTitle}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Style.Triggers>
<DataTrigger Binding="{Binding IsActive, RelativeSource={RelativeSource AncestorType=Window}}" Value="False">
<Setter Property="Foreground" Value="{DynamicResource WindowTitleBarInactiveText}" />
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<Button Grid.Column="3"
Click="OnMinimizeButtonClick"
RenderOptions.EdgeMode="Aliased"
Style="{StaticResource TitleBar_Button}">
<Path Width="46"
Height="32"
Data="M 18,15 H 28"
Stroke="{Binding Path=Foreground,
RelativeSource={RelativeSource AncestorType={x:Type Button}}}"
StrokeThickness="1" />
</Button>
<Button Name="MaximizeBtn"
Grid.Column="4"
Click="OnMaximizeRestoreButtonClick">
<Button.Style>
<Style TargetType="Button" BasedOn="{StaticResource TitleBar_Button}">
<Style.Resources>
<Grid x:Key="max">
<Path Width="46"
Height="32"
Data="M 18.5,12.5 H 25.5 V 19.5 H 18.5 Z M 20.5,12.5 V 10.5 H 27.5 V 17.5 H 25.5"
Stroke="{Binding Path=Foreground,
RelativeSource={RelativeSource AncestorType={x:Type Button}}}"
StrokeThickness="1" />
</Grid>
<Grid x:Key="normal">
<Path Width="46"
Height="32"
Data="M 18.5,10.5 H 27.5 V 19.5 H 18.5 Z"
Stroke="{Binding Path=Foreground,
RelativeSource={RelativeSource AncestorType={x:Type Button}}}"
StrokeThickness="1" />
</Grid>
</Style.Resources>
<Style.Triggers>
<DataTrigger Binding="{Binding WindowState, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:EffectorWindowV}}}" Value="Maximized">
<Setter Property="Content" Value="{StaticResource max}" />
</DataTrigger>
<DataTrigger Binding="{Binding WindowState, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:EffectorWindowV}}}" Value="Normal">
<Setter Property="Content" Value="{StaticResource normal}" />
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
<Button Grid.Column="5"
Click="OnCloseButtonClick"
Style="{StaticResource TitleBar_Button}">
<Path Width="46"
Height="32"
Data="M 18,11 27,20 M 18,20 27,11"
Stroke="{Binding Path=Foreground,
RelativeSource={RelativeSource AncestorType={x:Type Button}}}"
StrokeThickness="1" />
</Button>
</Grid>
<ContentPresenter Grid.Row="1"/>
</Grid>
</local:EgtWindow>
<EgwWPFBaseLib:EgtWindow x:Class="EffectorWindowV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgwWPFBaseLib="clr-namespace:EgwWPFBaseLib;assembly=EgwWPFBaseLib"
xmlns:local="clr-namespace:Effector.Plugin.Lib"
TitleBarHeight="40"
Style="{StaticResource Effector_Window}">
</EgwWPFBaseLib:EgtWindow>
@@ -1,18 +1,19 @@
<local:EgtWindow x:Class="MultipleCopyWndV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Effector.Plugin.Lib"
TitleBarHeight="30"
WindowStartupLocation="CenterOwner"
ShowInTaskbar="False"
SizeToContent="WidthAndHeight">
<EgwWPFBaseLib:EgtWindow x:Class="MultipleCopyWndV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:EgwWPFBaseLib="clr-namespace:EgwWPFBaseLib;assembly=EgwWPFBaseLib"
xmlns:local="clr-namespace:Effector.Plugin.Lib"
TitleBarHeight="30"
WindowStartupLocation="CenterOwner"
ShowInTaskbar="False"
SizeToContent="WidthAndHeight">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="{Binding TitleBarHeight, RelativeSource={RelativeSource AncestorType={x:Type local:EgtWindow}}}"/>
<RowDefinition Height="{Binding TitleBarHeight, RelativeSource={RelativeSource AncestorType={x:Type EgwWPFBaseLib:EgtWindow}}}"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<local:TitleBar/>
<!--<local:TitleBar/>-->
<Grid Grid.Row="1"
Margin="5">
<Grid.RowDefinitions>
@@ -47,4 +48,4 @@
</Grid>
</Grid>
</local:EgtWindow>
</EgwWPFBaseLib:EgtWindow>
@@ -1,14 +1,15 @@
<local:EgtWindow x:Class="ProcessManagerV"
<EgwWPFBaseLib:EgtWindow x:Class="ProcessManagerV"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Effector.Plugin.Lib"
xmlns:EgwWPFBaseLib="clr-namespace:EgwWPFBaseLib;assembly=EgwWPFBaseLib"
TitleBarHeight="30"
WindowStartupLocation="CenterOwner"
ShowInTaskbar="False"
SizeToContent="WidthAndHeight">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="{Binding TitleBarHeight, RelativeSource={RelativeSource AncestorType={x:Type local:EgtWindow}}}"/>
<RowDefinition Height="{Binding TitleBarHeight, RelativeSource={RelativeSource AncestorType={x:Type EgwWPFBaseLib:EgtWindow}}}"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<local:TitleBar/>
@@ -64,4 +65,4 @@
</StackPanel>
</Grid>
</local:EgtWindow>
</EgwWPFBaseLib:EgtWindow>
+145 -8
View File
@@ -1,14 +1,75 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:local="clr-namespace:Effector.Plugin.Lib">
xmlns:local="clr-namespace:Effector.Plugin.Lib"
xmlns:EgwWPFBaseLib="clr-namespace:EgwWPFBaseLib;assembly=EgwWPFBaseLib">
<local:CaptionHeightConverter x:Key="CaptionHeightConverter"/>
<EgwWPFBaseLib:CaptionHeightConverter x:Key="CaptionHeightConverter"/>
<Style TargetType="{x:Type local:EgtWindow}" BasedOn="{StaticResource {x:Type Window}}">
<!--#region COLORS -->
<!--#e8eef5-->
<Color x:Key="Effector_LightBlue_Color" R="232" G="238" B="245" A="255"/>
<SolidColorBrush x:Key="Effector_LightBlue" Color="{StaticResource Effector_LightBlue_Color}" />
<!--#afc5d6-->
<Color x:Key="Effector_Blue_Color" R="175" G="197" B="214" A="255"/>
<SolidColorBrush x:Key="Effector_Blue" Color="{StaticResource Effector_Blue_Color}" />
<!--#749fc4-->
<Color x:Key="Effector_DarkBlue_Color" R="116" G="159" B="196" A="255"/>
<SolidColorBrush x:Key="Effector_DarkBlue" Color="{StaticResource Effector_DarkBlue_Color}" />
<!--#92bde3-->
<Color x:Key="Effector_LightBlue_Status_Color" R="146" G="189" B="227" A="255"/>
<SolidColorBrush x:Key="Effector_LightBlue_Status" Color="{StaticResource Effector_LightBlue_Status_Color}" />
<!--#5682a6-->
<Color x:Key="Effector_Blue_Status_Color" R="86" G="130" B="166" A="255"/>
<SolidColorBrush x:Key="Effector_Blue_Status" Color="{StaticResource Effector_Blue_Status_Color}" />
<!--#cd5c5c-->
<Color x:Key="Effector_Red_Status_Color" R="205" G="92" B="92" A="255"/>
<SolidColorBrush x:Key="Effector_Red_Status" Color="{StaticResource Effector_Red_Status_Color}" />
<!--#b1cbaa-->
<Color x:Key="Effector_Green_Status_Color" R="177" G="203" B="170" A="255"/>
<SolidColorBrush x:Key="Effector_Green_Status" Color="{StaticResource Effector_Green_Status_Color}" />
<!--#9c9c9c-->
<Color x:Key="Effector_Gray_Status_Color" R="156" G="156" B="156" A="255"/>
<SolidColorBrush x:Key="Effector_Gray_Status" Color="{StaticResource Effector_Gray_Status_Color}" />
<!--#ffd932-->
<Color x:Key="Effector_Yellow_Status_Color" R="255" G="217" B="50" A="255"/>
<SolidColorBrush x:Key="Effector_Yellow_Status" Color="{StaticResource Effector_Yellow_Status_Color}" />
<!--#6398c7-->
<Color x:Key="Effector_LightBlue_SelStatus_Color" R="99" G="152" B="199" A="255"/>
<SolidColorBrush x:Key="Effector_LightBlue_SelStatus" Color="{StaticResource Effector_LightBlue_SelStatus_Color}" />
<!--#4b677e-->
<Color x:Key="Effector_Blue_SelStatus_Color" R="75" G="103" B="126" A="255"/>
<SolidColorBrush x:Key="Effector_Blue_SelStatus" Color="{StaticResource Effector_Blue_SelStatus_Color}" />
<!--#a94444-->
<Color x:Key="Effector_Red_SelStatus_Color" R="169" G="68" B="68" A="255"/>
<SolidColorBrush x:Key="Effector_Red_SelStatus" Color="{StaticResource Effector_Red_SelStatus_Color}" />
<!--#89aa81-->
<Color x:Key="Effector_Green_SelStatus_Color" R="137" G="170" B="129" A="255"/>
<SolidColorBrush x:Key="Effector_Green_SelStatus" Color="{StaticResource Effector_Green_SelStatus_Color}" />
<!--#7d7d7d-->
<Color x:Key="Effector_Gray_SelStatus_Color" R="125" G="125" B="125" A="255"/>
<SolidColorBrush x:Key="Effector_Gray_SelStatus" Color="{StaticResource Effector_Gray_SelStatus_Color}" />
<!--#dcb718-->
<Color x:Key="Effector_Yellow_SelStatus_Color" R="220" G="183" B="24" A="255"/>
<SolidColorBrush x:Key="Effector_Yellow_SelStatus" Color="{StaticResource Effector_Yellow_SelStatus_Color}" />
<!--#e5ebf1-->
<Color x:Key="Effector_White_SelStatus_Color" R="229" G="235" B="241" A="255"/>
<SolidColorBrush x:Key="Effector_White_SelStatus" Color="{StaticResource Effector_Yellow_SelStatus_Color}" />
<!--#endregion COLORS-->
<!--#region CUSTOMCONTROLS -->
<Style TargetType="{x:Type local:EffectorWindow}" BasedOn="{StaticResource {x:Type EgwWPFBaseLib:EgtWindow}}">
<Setter Property="Background" Value="White"/>
<Setter Property="TitleBarHeight" Value="40"/>
<Setter Property="WindowChrome.WindowChrome">
<Setter.Value>
<WindowChrome CaptionHeight="{Binding TitleBarHeight, RelativeSource={RelativeSource AncestorType={x:Type local:EgtWindow}}}"
<WindowChrome CaptionHeight="{Binding TitleBarHeight, RelativeSource={RelativeSource AncestorType={x:Type EgwWPFBaseLib:EgtWindow}}}"
GlassFrameThickness="0"
CornerRadius="0"
ResizeBorderThickness="{x:Static SystemParameters.WindowResizeBorderThickness}"/>
@@ -16,12 +77,31 @@
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Window}">
<ControlTemplate TargetType="{x:Type EgwWPFBaseLib:EgtWindow}">
<Border BorderThickness="0"
BorderBrush="LightGray"
Background="{TemplateBinding Background}">
<ContentPresenter Grid.Row="1"
Content="{TemplateBinding Content}"/>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="{Binding TitleBarHeight, RelativeSource={RelativeSource AncestorType={x:Type EgwWPFBaseLib:EgtWindow}}}"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<!--<Border Grid.ColumnSpan="6"
Style="{StaticResource TitleBar_Border}"/>
<Image MinWidth="{Binding ActualHeight, RelativeSource={RelativeSource Self}}"
Source="/Resources/Effector.ico"/>
<ContentControl Grid.Column="1"
Content="{Binding ContentMenu}"/>
<TextBlock Grid.Column="2"
Text="{Binding sTitle}"
Margin="20,0,20,0"
Style="{StaticResource TitleBar_TextBlock}">
</TextBlock>-->
<local:TitleBar Title="{TemplateBinding Title}"/>
<ContentPresenter Grid.Row="1"
Content="{TemplateBinding Content}"/>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
@@ -30,7 +110,7 @@
<Trigger Property="WindowState" Value="Maximized">
<Setter Property="WindowChrome.WindowChrome">
<Setter.Value>
<WindowChrome CaptionHeight="{Binding TitleBarHeight, RelativeSource={RelativeSource AncestorType={x:Type local:EgtWindow}}, Converter={StaticResource CaptionHeightConverter}}"
<WindowChrome CaptionHeight="{Binding TitleBarHeight, RelativeSource={RelativeSource AncestorType={x:Type EgwWPFBaseLib:EgtWindow}}, Converter={StaticResource CaptionHeightConverter}}"
GlassFrameThickness="0"
CornerRadius="0"
ResizeBorderThickness="{x:Static SystemParameters.WindowResizeBorderThickness}"/>
@@ -53,4 +133,61 @@
</Style.Triggers>
</Style>
<!--#endregion CUSTOMCONTROLS-->
<!--#region USERCONTROL -->
<!--#endregion USERCONTROL-->
<!--#region STILES -->
<!--<Style x:Key="TitleBar_Border" TargetType="{x:Type Border}">
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Background" Value="{StaticResource Effector_Blue}" />
</Style>
<Style x:Key="TitleBar_TextBlock" TargetType="{x:Type TextBlock}">
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="FontSize" Value="14" />
<Style.Triggers>
<DataTrigger Binding="{Binding IsActive, RelativeSource={RelativeSource AncestorType=Window}}" Value="False">
<Setter Property="Foreground" Value="{DynamicResource WindowTitleBarInactiveText}" />
</DataTrigger>
</Style.Triggers>
</Style>
<Style x:Key="TitleBar_Button" TargetType="Button">
<Setter Property="Foreground" Value="White" />
<Setter Property="Padding" Value="0" />
<Setter Property="WindowChrome.IsHitTestVisibleInChrome" Value="True" />
<Setter Property="IsTabStop" Value="False" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="border"
Background="Transparent"
BorderThickness="0"
SnapsToDevicePixels="true">
<ContentPresenter x:Name="contentPresenter"
Margin="0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Focusable="False"
RecognizesAccessKey="True" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="border" Property="Background" Value="{DynamicResource MouseOverOverlayBackgroundBrush}" />
</Trigger>
<Trigger Property="IsPressed" Value="true">
<Setter TargetName="border" Property="Background" Value="{DynamicResource PressedOverlayBackgroundBrush}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>-->
<!--#endregion STILES-->
</ResourceDictionary>
@@ -18,4 +18,21 @@
MinWidth="{Binding ActualHeight, RelativeSource={RelativeSource Self}}"
Source="/Resources/Effector.ico"/>
<ContentControl Grid.Column="1"/>
<TextBlock Grid.Column="2"
Margin="4 0 0 0"
VerticalAlignment="Center"
HorizontalAlignment="Center"
FontSize="14"
Text="{Binding sTitle}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Style.Triggers>
<DataTrigger Binding="{Binding IsActive, RelativeSource={RelativeSource AncestorType=Window}}" Value="False">
<Setter Property="Foreground" Value="{DynamicResource WindowTitleBarInactiveText}" />
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</Grid>
@@ -1,3 +1,39 @@
Public Class TitleBar
' Proprietà che permette di attivare e disattivare lo spostamento della finestra
Public Shared ReadOnly TitleProperty As DependencyProperty = DependencyProperty.Register("Title", GetType(String), GetType(TitleBar), New PropertyMetadata(""))
Public Property Title() As Boolean
Get
Return CBool(GetValue(TitleProperty))
End Get
Set(ByVal value As Boolean)
SetValue(TitleProperty, value)
End Set
End Property
' Proprietà che permette di attivare e disattivare lo spostamento della finestra
Public Shared ReadOnly IsMinimizableProperty As DependencyProperty = DependencyProperty.Register("IsMinimizable", GetType(Boolean), GetType(TitleBar), New PropertyMetadata(True))
Public Property IsMinimizable() As Boolean
Get
Return CBool(GetValue(IsMinimizableProperty))
End Get
Set(ByVal value As Boolean)
SetValue(IsMinimizableProperty, value)
End Set
End Property
' Proprietà che permette di attivare e disattivare il bottone di chiusura della finestra
Public Shared ReadOnly IsClosableProperty As DependencyProperty = DependencyProperty.Register("IsClosable", GetType(Boolean), GetType(TitleBar), New PropertyMetadata(True))
Public Property IsClosable() As Boolean
Get
Return CBool(GetValue(IsClosableProperty))
End Get
Set(ByVal value As Boolean)
SetValue(IsClosableProperty, value)
If Not value Then
IsMinimizable = False
End If
End Set
End Property
End Class
+20
View File
@@ -0,0 +1,20 @@
Public Module Converters
ReadOnly dtLuaMinValue As New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)
Public Function ConvertDateTimeToString(dtValue As DateTime) As String
If dtValue < dtLuaMinValue.AddDays(1) Then
Return ""
ElseIf dtValue > DateTime.Today Then
Dim d = dtValue.ToString("T")
Return dtValue.ToString("T")
Else
Return dtValue.ToString("d T")
End If
End Function
Public Function ConvertDateTimeToLuaInteger(dtValue As DateTime) As Integer
Return Math.Floor((dtValue.ToUniversalTime - dtLuaMinValue).TotalSeconds)
End Function
End Module