Monorepo/GUIs.Common/frmWorkflow_Adhoc_start.vb

124 lines
4.7 KiB
VB.net

Imports DigitalData.Modules.ZooFlow
Imports DigitalData.Modules.Logging
Imports DigitalData.GUIs.Common.Base
Imports DigitalData.Modules.ZooFlow.Constants
Imports DigitalData.Modules.EDMI.API
Imports DevExpress.XtraEditors
Imports System.Drawing
Imports DigitalData.Modules.EDMI.API.EDMIServiceReference
Public Class frmWorkflow_Adhoc_start
Private ReadOnly Property LogConfig As LogConfig
Private ReadOnly Property Logger As Logger
Private Property OperationMode As OperationMode
Private ReadOnly Environment As Environment
Private ReadOnly AdHocWorkflow As AdHocWorkflow
Private Client As Client
Private IsLoading As Boolean = True
Public Sub New(pLogConfig As LogConfig, pEnvironment As Environment, pAdhocWorkflow As AdHocWorkflow)
' Dieser Aufruf ist für den Designer erforderlich.
InitializeComponent()
Environment = pEnvironment
AdHocWorkflow = pAdhocWorkflow
LogConfig = pLogConfig
Logger = pLogConfig.GetLogger()
End Sub
Private Function GetOperationMode() As OperationMode
Dim oOperationMode As OperationMode
If Environment.Service.Client.IsOnline AndAlso Environment.Service.Address <> String.Empty Then
oOperationMode = OperationMode.WithAppServer
Else
oOperationMode = OperationMode.NoAppServer
End If
Return oOperationMode
End Function
Private Function InitAppServer() As Boolean
Dim oServerAddress = Client.ParseServiceAddress(Environment.Service.Client.ServerAddress)
Dim oAddress As String = oServerAddress.Item1
Dim oPort As Integer = oServerAddress.Item2
Client = New Client(LogConfig, oAddress, oPort)
If Not Client.Connect() Then
Logger.Warn("Client could not connect to Service at [{0}]", Environment.Service.Address)
Return False
End If
Return True
End Function
Private Sub frmWorkflow_Adhoc_start_Load(sender As Object, e As EventArgs) Handles Me.Load
Try
' Operation mode is either guessed from service settings
' or explictly set from OperationModeOverride in Params
OperationMode = GetOperationMode()
If OperationMode = OperationMode.WithAppServer Or OperationMode = OperationMode.ZooFlow Then
If InitAppServer() = False Then
Me.Close()
End If
End If
' Initialize Viewer with GDPicture.NET License
' Hide options relating to a filepath for zooflow
If OperationMode = OperationMode.ZooFlow Then
' RibbonPageGroupFilesystem.Visible = False
End If
If OperationMode = OperationMode.NoAppServer Then
' RibbonPageGroupCheckInOut.Visible = False
' RibbonPageGroupWorkflow.Visible = False
' RibbonPageGroupAttribute.Visible = False
Else
' RibbonPageGroupFilesystem.Visible = False
End If
Dim oDatatableUserselect As DataTable
Dim oSQL = $"SELECT NAME + ', ' + PRENAME AS FULLNAME,EMAIL,USERNAME FROM TBDD_USER"
Dim oResult As GetDatatableResponse = Nothing
If OperationMode = OperationMode.ZooFlow Or OperationMode = OperationMode.WithAppServer Then
oResult = Client.GetDatatableFromECM(oSQL)
If oResult.OK = False Then
Throw New ApplicationException(oResult.ErrorMessage)
Else
oDatatableUserselect = oResult.Table
End If
Else
oDatatableUserselect = Environment.Database.GetDatatable(oSQL)
End If
If OperationMode = OperationMode.NoAppServer Then
' panelContainerStatus.Visibility = Docking.DockVisibility.Hidden
End If
' Hide the complete Navigation Ribbon Group if desired
Catch ex As Exception
Logger.Error(ex)
MsgBox(ex.Message, MsgBoxStyle.OkOnly, "Error while loading form:")
Finally
IsLoading = False
End Try
End Sub
Private Sub SimpleButton1_Click(sender As Object, e As EventArgs) Handles SimpleButton1.Click
ListBoxControl1.Items.Add(New ListItem() With {
.Name = "Marlon Schreiber",
.email = "m.schreiber@digitaldata.works"
})
ListBoxControl1.Items.Add(New ListItem() With {
.Name = "Jonathan Jenne",
.email = "j.jenner@digitaldata.works"
})
End Sub
Private Class ListItem
Public Name As String
Public email As String
End Class
End Class