- primo commit

This commit is contained in:
Emmanuele Sassi
2025-02-07 12:32:14 +01:00
parent d1910ff83a
commit 139b805055
78 changed files with 4099 additions and 0 deletions
@@ -0,0 +1,67 @@
<local: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"
TitleBarHeight="30"
WindowStartupLocation="CenterOwner"
ShowInTaskbar="False"
SizeToContent="WidthAndHeight">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="{Binding TitleBarHeight, RelativeSource={RelativeSource AncestorType={x:Type local:EgtWindow}}}"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<local:TitleBar/>
<StackPanel Grid.Row="1">
<Grid HorizontalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="30"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Text="Arguments Queue Count: "/>
<TextBlock Grid.Column="1"
Text="{Binding ArgumentsQueue}"/>
<TextBlock Grid.Row="1"
Text="ResultQueue: "/>
<TextBlock Grid.Column="1"
Grid.Row="1"
Text="{Binding ResultQueue}"/>
</Grid>
<!--<DataGrid ItemsSource="{Binding ThreadList}"
AutoGenerateColumns="False">
<DataGrid.Columns>
<DataGridTextColumn Header="Process Status"
Binding="{Binding ProcessStatus}"/>
<DataGridTextColumn Header="Curr Request Id"
Binding="{Binding CurrRequest.nId}"/>
<DataGridTextColumn Header="Curr Request Args"
Binding="{Binding CurrRequest.sArgs}"/>
<DataGridTextColumn Header="Process Result"
Binding="{Binding nProcResult}"/>
</DataGrid.Columns>
</DataGrid>-->
<ItemsControl ItemsSource="{Binding ThreadList}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding ProcessStatus}"/>
<TextBlock Text="{Binding CurrRequest.nId}"/>
<TextBlock Text="{Binding CurrRequest.sArgs}"/>
<TextBlock Text="{Binding nProcResult}"/>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<ProgressBar Value="{Binding dProgress_Value, Mode=OneWay}"
Minimum="0"
Maximum="{Binding dProgress_Maximum}"
Height="20"
Width="250"/>
</StackPanel>
</Grid>
</local:EgtWindow>
@@ -0,0 +1,19 @@
Public Class ProcessManagerV
Private WithEvents m_ProcessManagerVM As ProcessManagerVM
Sub New(Owner As Window, ProcessManagerVM As ProcessManagerVM)
'MyBase.New(Owner)
Me.Owner = Owner
' This call is required by the designer.
InitializeComponent()
Me.DataContext = ProcessManagerVM
' Assegno al riferimento locale al VM il VM preso dal DataContext
m_ProcessManagerVM = ProcessManagerVM
End Sub
'Private Sub CloseWindow(bDialogResult As Boolean) Handles m_ProcessManagerVM.m_CloseWindow
' Me.DialogResult = bDialogResult
'End Sub
End Class
@@ -0,0 +1,75 @@
Imports System.Windows.Threading
Imports System.Collections.ObjectModel
Public Class ProcessManagerVM
Inherits VMBase
Private m_nTaskQuantity As Integer = 3
Private m_UpdateDataTimer As New DispatcherTimer
Public ReadOnly Property UpdateDataTimer As DispatcherTimer
Get
Return m_UpdateDataTimer
End Get
End Property
Private m_ExecProcessManager As ExecProcessManager
Public ReadOnly Property ExecProcessManager As ExecProcessManager
Get
Return m_ExecProcessManager
End Get
End Property
Public ReadOnly Property ArgumentsQueue As String
Get
Return m_ExecProcessManager.ArgumentsQueueCount.ToString()
End Get
End Property
Public ReadOnly Property ResultQueue As String
Get
Return m_ExecProcessManager.ArgumentsResultQueueCount.ToString()
End Get
End Property
Public ReadOnly Property ThreadList As ObservableCollection(Of ThreadData)
Get
If Not IsNothing(m_ExecProcessManager.ThreadDataList) Then
Return New ObservableCollection(Of ThreadData)(m_ExecProcessManager.ThreadDataList.ToList())
Else
Return New ObservableCollection(Of ThreadData)
End If
End Get
End Property
Private m_dProgress_Value As Double
Public ReadOnly Property dProgress_Value As Double
Get
Return (m_dProgress_Maximum - m_nTaskQuantity - m_ExecProcessManager.ArgumentsQueueCount) '/ m_dProgress_Maximum * 100
End Get
End Property
Private m_dProgress_Maximum As Double
Public ReadOnly Property dProgress_Maximum As Double
Get
Return m_dProgress_Maximum
End Get
End Property
Sub New(ExecProcessManager As ExecProcessManager)
m_ExecProcessManager = ExecProcessManager
m_dProgress_Maximum = m_ExecProcessManager.ArgumentsQueueCount + m_nTaskQuantity
m_UpdateDataTimer.Interval = New TimeSpan(0, 0, 1)
AddHandler m_UpdateDataTimer.Tick, AddressOf UpdateDataTimer_Tick
m_UpdateDataTimer.Start()
End Sub
Private Sub UpdateDataTimer_Tick(sender As Object, e As EventArgs)
NotifyPropertyChanged(NameOf(ArgumentsQueue))
NotifyPropertyChanged(NameOf(ResultQueue))
NotifyPropertyChanged(NameOf(ThreadList))
NotifyPropertyChanged(NameOf(dProgress_Value))
End Sub
End Class