From dcaef9eaa992c4ec39da71e5a78cb38bd30240b9 Mon Sep 17 00:00:00 2001 From: Emmanuele Sassi Date: Wed, 26 Feb 2025 15:01:11 +0100 Subject: [PATCH] - aggiunta EffectorWindow con TitleBar - Utilizzata EffectorWindow per MultipleCopyWnd - Utilizzata BaseWindow per ProcessManagerV - aggiunto titolo a TitleBar - aggiunto modulo Converters --- .../Effector.Plugin.Lib.vbproj | 10 +- .../EffectorWindow/EffectorWindow.vb | 42 +++++ .../EffectorWindow/EffectorWindowV.xaml | 117 +------------- .../MultipleCopyWnd/MultipleCopyWndV.xaml | 23 +-- .../ProcessManager/ProcessManagerV.xaml | 7 +- Effector.Plugin.Lib/Themes/Generic.xaml | 153 +++++++++++++++++- Effector.Plugin.Lib/TitleBar/TitleBarV.xaml | 17 ++ .../TitleBar/TitleBarV.xaml.vb | 36 +++++ Effector.Plugin.Lib/Utility/Converters.vb | 20 +++ 9 files changed, 290 insertions(+), 135 deletions(-) create mode 100644 Effector.Plugin.Lib/EffectorWindow/EffectorWindow.vb create mode 100644 Effector.Plugin.Lib/Utility/Converters.vb diff --git a/Effector.Plugin.Lib/Effector.Plugin.Lib.vbproj b/Effector.Plugin.Lib/Effector.Plugin.Lib.vbproj index c9932c2..97a69ab 100644 --- a/Effector.Plugin.Lib/Effector.Plugin.Lib.vbproj +++ b/Effector.Plugin.Lib/Effector.Plugin.Lib.vbproj @@ -47,6 +47,9 @@ + + ..\..\..\EgwWPFBaseLib\EgwWPFBaseLib\bin\Debug\EgwWPFBaseLib.dll + @@ -84,7 +87,7 @@ - + MultipleCopyWndV.xaml @@ -110,6 +113,7 @@ TitleBarV.xaml + @@ -154,9 +158,7 @@ - - - + copy $(TargetPath) c:\EgtData\Effector\Plugin\Effector.Plugin.DoorArreda\Effector.Plugin.Lib.dll diff --git a/Effector.Plugin.Lib/EffectorWindow/EffectorWindow.vb b/Effector.Plugin.Lib/EffectorWindow/EffectorWindow.vb new file mode 100644 index 0000000..1dca163 --- /dev/null +++ b/Effector.Plugin.Lib/EffectorWindow/EffectorWindow.vb @@ -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. +' +' +' + +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 diff --git a/Effector.Plugin.Lib/EffectorWindow/EffectorWindowV.xaml b/Effector.Plugin.Lib/EffectorWindow/EffectorWindowV.xaml index b1390f1..140b45b 100644 --- a/Effector.Plugin.Lib/EffectorWindow/EffectorWindowV.xaml +++ b/Effector.Plugin.Lib/EffectorWindow/EffectorWindowV.xaml @@ -1,109 +1,8 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + diff --git a/Effector.Plugin.Lib/MultipleCopyWnd/MultipleCopyWndV.xaml b/Effector.Plugin.Lib/MultipleCopyWnd/MultipleCopyWndV.xaml index 2b0fd0c..8da3514 100644 --- a/Effector.Plugin.Lib/MultipleCopyWnd/MultipleCopyWndV.xaml +++ b/Effector.Plugin.Lib/MultipleCopyWnd/MultipleCopyWndV.xaml @@ -1,18 +1,19 @@ - + - + - + @@ -47,4 +48,4 @@ - + diff --git a/Effector.Plugin.Lib/ProcessManager/ProcessManagerV.xaml b/Effector.Plugin.Lib/ProcessManager/ProcessManagerV.xaml index 0918a67..7f9c94f 100644 --- a/Effector.Plugin.Lib/ProcessManager/ProcessManagerV.xaml +++ b/Effector.Plugin.Lib/ProcessManager/ProcessManagerV.xaml @@ -1,14 +1,15 @@ - - + @@ -64,4 +65,4 @@ - + diff --git a/Effector.Plugin.Lib/Themes/Generic.xaml b/Effector.Plugin.Lib/Themes/Generic.xaml index 7886ec9..1c35146 100644 --- a/Effector.Plugin.Lib/Themes/Generic.xaml +++ b/Effector.Plugin.Lib/Themes/Generic.xaml @@ -1,14 +1,75 @@  + xmlns:local="clr-namespace:Effector.Plugin.Lib" + xmlns:EgwWPFBaseLib="clr-namespace:EgwWPFBaseLib;assembly=EgwWPFBaseLib"> - + - + + + + + + + + + + + diff --git a/Effector.Plugin.Lib/TitleBar/TitleBarV.xaml b/Effector.Plugin.Lib/TitleBar/TitleBarV.xaml index 7aab6f0..04a5650 100644 --- a/Effector.Plugin.Lib/TitleBar/TitleBarV.xaml +++ b/Effector.Plugin.Lib/TitleBar/TitleBarV.xaml @@ -18,4 +18,21 @@ MinWidth="{Binding ActualHeight, RelativeSource={RelativeSource Self}}" Source="/Resources/Effector.ico"/> + + + + + + diff --git a/Effector.Plugin.Lib/TitleBar/TitleBarV.xaml.vb b/Effector.Plugin.Lib/TitleBar/TitleBarV.xaml.vb index ee0dbae..c8eb039 100644 --- a/Effector.Plugin.Lib/TitleBar/TitleBarV.xaml.vb +++ b/Effector.Plugin.Lib/TitleBar/TitleBarV.xaml.vb @@ -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 diff --git a/Effector.Plugin.Lib/Utility/Converters.vb b/Effector.Plugin.Lib/Utility/Converters.vb new file mode 100644 index 0000000..403f178 --- /dev/null +++ b/Effector.Plugin.Lib/Utility/Converters.vb @@ -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