MS Initialiserung windreamdll

This commit is contained in:
Digital Data - Marlon Schreiber 2018-08-15 15:41:26 +02:00
parent 7527d59b93
commit 037422186d
20 changed files with 1714 additions and 6 deletions

View File

@ -17,6 +17,8 @@ Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Modules.Windream", "Modules
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Services", "Services", "{7AF3F9C2-C939-4A08-95C1-0453207E298A}"
EndProject
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "TestGUI", "TestGUI\TestGUI.vbproj", "{93130E7D-A950-4CBD-A0D9-7A6FAF94DDC0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -35,6 +37,10 @@ Global
{4C86DF8F-A280-40D4-85B0-10B1BF66C15C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4C86DF8F-A280-40D4-85B0-10B1BF66C15C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4C86DF8F-A280-40D4-85B0-10B1BF66C15C}.Release|Any CPU.Build.0 = Release|Any CPU
{93130E7D-A950-4CBD-A0D9-7A6FAF94DDC0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{93130E7D-A950-4CBD-A0D9-7A6FAF94DDC0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{93130E7D-A950-4CBD-A0D9-7A6FAF94DDC0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{93130E7D-A950-4CBD-A0D9-7A6FAF94DDC0}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -43,6 +49,7 @@ Global
{5284F4E5-A6C1-4BCF-896F-3ABEA985B741} = {8FFE925E-8B84-45F1-93CB-32B1C96F41EB}
{903B2D7D-3B80-4BE9-8713-7447B704E1B0} = {3E2008C8-27B1-41DD-9B1A-0C4029F6AECC}
{4C86DF8F-A280-40D4-85B0-10B1BF66C15C} = {3E2008C8-27B1-41DD-9B1A-0C4029F6AECC}
{93130E7D-A950-4CBD-A0D9-7A6FAF94DDC0} = {8FFE925E-8B84-45F1-93CB-32B1C96F41EB}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C1BE4090-A0FD-48AF-86CB-39099D14B286}

View File

@ -0,0 +1,3 @@
Public Class ClassHelper
End Class

View File

@ -33,4 +33,7 @@
Public Const INDEX_FLAG_MASK = &HFFFFF000
Public Const INDEX_TYPE_VECTOR = &H1000
Public Const INDEX_TYPE_DEFAULT_VALUE = &H4000
'Single Index Types
Public Const WMObjectVariableValueTypeUndefined = 0
End Class

View File

@ -0,0 +1,36 @@
Public Class Helpers
Inherits Constants
Friend Shared Function Convert_VectorType(vType As Object, value As String)
Select Case vType
Case INDEX_TYPE_HASH ' 36865
'Umwandeln in String
Return CStr(value)
Case INDEX_TYPE_VECTOR_STRING '4097
'Umwandeln in String
Return CStr(value)
Case INDEX_TYPE_VECTOR_INTEGER '4098
'Umwandeln in Integer
value = value.ToString.Replace(" ", "")
Return CInt(value)
Case INDEX_TYPE_VECTOR_FLOAT '4099
Dim Str As String = value
Str = Str.ToString.Replace(" ", "")
'Umwandeln in Double
Return CDbl(Str.Replace(".", ","))
Case INDEX_TYPE_VECTOR_BOOLEAN '4100
'Umwandeln in Boolean
Return CBool(value)
Case INDEX_TYPE_VECTOR_DATE '4101
'Umwandeln in Date
Return CDate(value)
Case INDEX_TYPE_VECTOR_INTEGER_64BIT '4107
Return Convert.ToInt64(value)
Case INDEX_TYPE_VECTOR_DATE_TIME '4103
'Umwandeln in Datum Uhrzeit
Return value
Case Else
'Umwandeln in String
Return CStr(value)
End Select
End Function
End Class

View File

@ -43,8 +43,33 @@
<OptionInfer>On</OptionInfer>
</PropertyGroup>
<ItemGroup>
<Reference Include="Interop.WINDREAMLib">
<HintPath>P:\Visual Studio Projekte\Bibliotheken\windream\Interop.WINDREAMLib.dll</HintPath>
<EmbedInteropTypes>False</EmbedInteropTypes>
</Reference>
<Reference Include="Interop.WMOBRWSLib">
<HintPath>P:\Visual Studio Projekte\Bibliotheken\windream\Interop.WMOBRWSLib.dll</HintPath>
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="Interop.WMOSRCHLib">
<HintPath>P:\Visual Studio Projekte\Bibliotheken\windream\Interop.WMOSRCHLib.dll</HintPath>
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="Interop.WMOTOOLLib">
<HintPath>P:\Visual Studio Projekte\Bibliotheken\windream\Interop.WMOTOOLLib.dll</HintPath>
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.4.5.8\lib\net45\NLog.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Data" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Transactions" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
@ -63,8 +88,9 @@
<Import Include="System.Threading.Tasks" />
</ItemGroup>
<ItemGroup>
<Compile Include="ClassHelper.vb" />
<Compile Include="Constants.vb" />
<Compile Include="Session.vb" />
<Compile Include="Helpers.vb" />
<Compile Include="My Project\AssemblyInfo.vb" />
<Compile Include="My Project\Application.Designer.vb">
<AutoGen>True</AutoGen>
@ -80,6 +106,7 @@
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<Compile Include="Windream.vb" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="My Project\Resources.resx">
@ -99,6 +126,7 @@
<CustomToolNamespace>My</CustomToolNamespace>
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
</None>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
</Project>

View File

@ -1,5 +0,0 @@
Public Class Session
Public Sub New()
End Sub
End Class

View File

@ -0,0 +1,969 @@
Imports WINDREAMLib
Imports WINDREAMLib.WMCOMEvent
Imports WINDREAMLib.WMEntity
Imports WINDREAMLib.WMObjectEditMode
Imports WINDREAMLib.WMSearchOperator
Imports WINDREAMLib.WMSearchRelation
Imports WMOBRWSLib
Imports WMOSRCHLib
Public Class Windream
Inherits Constants
#Region "+++++ Variables +++++"
Private Shared Logger As NLog.Logger = NLog.LogManager.GetCurrentClassLogger
Public Shared CurrentSession As WMObject = Nothing
Public Shared CurrentSessionIsLoggedIn As Boolean = False
Private Shared CurrentObjecttypes As WINDREAMLib.WMObjects
Private Shared CurrentController As WMOSearchController
Private Shared CurrentWMConnect ' der Typ darf nicht festgelegt werden (warum auch immer... geht sonst nicht)
Public Shared CurrentWMServer As String
Private Shared WMDriveLetter As String = "W"
Private Shared _Session_Reconnect As Boolean = False
#End Region
#Region "+++++ Init +++++"
''' <summary>
''' Initializes windream and creates a windream session with the actual user
''' </summary>
''' <remarks></remarks>
Public Sub New(WMDRIVE As String, SessionReconnect As Boolean)
Try
WMDriveLetter = WMDRIVE
NewSession()
Catch ex As Exception
Logger.Error(ex)
End Try
End Sub
''' <summary>
''' Creates a windream session with the actual user
''' </summary>
''' <returns>Returns true when created, false if not</returns>
''' <remarks></remarks>
Public Shared Function NewSession()
Try
Dim wmbrwsr
wmbrwsr = CreateObject("WMOBrws.ServerBrowser")
'==================================================================
' get the current DMS-server to log in
'==================================================================
CurrentWMServer = wmbrwsr.GetCurrentServer
Logger.Info("ECMServer: " & CurrentWMServer)
Dim Connect
Try
Connect = CreateObject("Windream.WMConnect")
Catch ex As Exception
CurrentSession = Nothing
CurrentSessionIsLoggedIn = False
Logger.Error(ex)
Return False
End Try
'==================================================================
' create a session
'==================================================================
'Prüfen ob sich personifiziert angemeldet werden muss?
Try
CurrentSession = CreateObject("Windream.WMSession", CurrentWMServer)
Catch ex As Exception
CurrentSession = Nothing
CurrentSessionIsLoggedIn = False
Logger.Error(ex)
Return False
End Try
'==================================================================
' login session
'==================================================================
Try
Connect.LoginSession(CurrentSession)
If CurrentSession.aLoggedin Then
CurrentSessionIsLoggedIn = True
Try
CurrentSession.SwitchEvents(WMCOMEventWMSessionNeedIndex, False)
' der Parameter WMEntityDocument definiert, dass nur Dokumenttypen und keine
' Ordnertypen ausgelesen werden
CurrentObjecttypes = CurrentSession.GetWMObjectTypes(WINDREAMLib.WMEntity.WMEntityDocument)
Catch ex As Exception
Logger.Error(ex)
'clsLogger.Add("Could not get Objecttypes: " & ex.Message, True)
End Try
Return True
Else
CurrentSessionIsLoggedIn = False
Logger.Warn("Session could be built but user cannot be logged in!")
Return False
End If
Catch ex As Exception
If Not IsNothing(CurrentSession) Then
If CurrentSession.aLoggedin Then
Logger.Info("User is already logged in!....")
CurrentSessionIsLoggedIn = True
Else
CurrentSessionIsLoggedIn = False
End If
Return True
Else
Logger.Error(ex)
CurrentSession = Nothing
CurrentSessionIsLoggedIn = False
Return False
End If
End Try
Catch ex As Exception
CurrentSession = Nothing
CurrentSessionIsLoggedIn = False
Logger.Error(ex)
'clsLogger.Add("Unexpected Error in Create Session: " & ex.Message, True)
Return False
End Try
End Function
#End Region
#Region "+++++ New +++++"
Public Shared Function NewFile()
End Function
''' <summary>
''' Creates a folder in windream. All folder-parts will be checked
''' </summary>
''' <param name="folderpath">full path of new folder</param>
''' <returns>Returns true when folder was created, false if not</returns>
''' <remarks></remarks>
Public Shared Function NewFolder(ByVal folderpath As String)
Try
If folderpath.StartsWith("\") = False And folderpath.ToUpper.StartsWith(WMDriveLetter.ToUpper) Then
folderpath = folderpath.Substring(2)
End If
Dim folders() As String = folderpath.Split("\")
For Each folder As String In folders
Dim WMObject As WINDREAMLib.WMObject
If TestFolderExists(folder) = False Then
Try
WMObject = CurrentSession.GetNewWMObjectFS(WMEntityFolder, folder, WMObjectEditModeNoEdit)
Catch ex As Exception
Logger.Error(ex)
'clsLogger.Add("Could not create WMObject for folderpath '" & folder & "': " & ex.Message, True)
Return False
End Try
End If
Next
Return True
Catch ex As Exception
Logger.Error(ex)
'clsLogger.Add("Unexpected error in NewFolder: " & ex.Message, True)
Return False
End Try
End Function
''' <summary>
''' Indexes the file with the given values
''' </summary>
''' <param name="WMFile">full filepath</param>
''' <param name="indexname">Name of the index</param>
''' <param name="aValues">values as array</param>
''' <returns>Returns true when folder was created, false if not</returns>
''' <remarks></remarks>
Private Shared Function NewIndexFile(WMFile As String, ByVal indexname As String, ByVal aValues() As String)
If Not WMFile.StartsWith("\") And WMFile.ToUpper.StartsWith(WMDriveLetter.ToUpper) Then
WMFile = WMFile.Substring(2)
End If
Dim oWMFile As WINDREAMLib.WMObject
Try
oWMFile = CurrentSession.GetWMObjectByPath(WINDREAMLib.WMEntity.WMEntityDocument, WMFile) 'WINDREAMLib.WMEntity.WMEntityDocument
Catch ex As Exception
Logger.Error(ex)
'clsLogger.Add(">> Could not create oWMFile-Indexing file '" & WD_File & ": " & ex.Message, True)
Return False
End Try
Dim vektInsState As Integer = 1
Try
If Not oWMFile.aLocked Then
oWMFile.lock()
Else
Logger.Info("WMDoc is locked already!")
Return False
End If
If aValues.Length = 1 And aValues(0) = "" Then
Logger.Info("Indexvalue is empty - No indexing")
Return False
End If
Logger.Info("Indexing of index '" & indexname)
Dim oWMType
Try
' das entsprechende Attribut aus windream auslesen
Dim oAttribute = CurrentSession.GetWMObjectByName(WINDREAMLib.WMEntity.WMEntityAttribute, indexname)
' den Variablentyp (String, Integer, ...) auslesen
oWMType = oAttribute.getVariableValue("dwAttrType")
Catch ex As Exception
Logger.Error(ex)
Return False
End Try
' wenn in aValues an Position i ein Wert steht
Dim i As Integer = 0
Dim value = aValues(i)
Dim oWMValueConverted
Dim vektor As Boolean = False
'Den Typ des Index-Feldes auslesen
Logger.Info("type of windreamIndex: " & oWMType.ToString)
Select Case (oWMType)
Case INDEX_TYPE_STRING
oWMValueConverted = CStr(value)
Case INDEX_TYPE_INTEGER
value = value.ToString.Replace(" ", "")
value = value.ToString.Replace(" ", "")
oWMValueConverted = CInt(value)
Case INDEX_TYPE_FLOAT
value = value.ToString.Replace(" ", "")
oWMValueConverted = CDbl(value)
Case INDEX_TYPE_FIXED_POINT
value = value.ToString.Replace(" ", "")
oWMValueConverted = CDbl(value)
Case INDEX_TYPE_BOOLEAN
oWMValueConverted = CBool(value)
Case INDEX_TYPE_DATE
'Dim _date As Date = value
oWMValueConverted = value
Case INDEX_TYPE_TIME
oWMValueConverted = CDbl(value)
Case INDEX_TYPE_CURRENCY
'Wegen currency muß ein eigenes Objekt vom typ Variant erzeugt werden
Dim aValueWrapper As System.Runtime.InteropServices.CurrencyWrapper = New System.Runtime.InteropServices.CurrencyWrapper(CDec(value))
oWMValueConverted = aValueWrapper
Case INDEX_TYPE_TIME
'If ((value)) Then
' oWMValueConverted = CDate(value)
'Else
' oWMValueConverted = ""
'End If
'Dim _date As Date = value
oWMValueConverted = oWMValueConverted '*_date.ToShortTimeString
Case INDEX_TYPE_FLOAT
oWMValueConverted = CStr(value)
Case INDEX_TYPE_VARIANT
oWMValueConverted = CStr(value)
Case INDEX_TYPE_FULLTEXT
oWMValueConverted = CStr(value)
Case 4097
'Vektor alphanumerisch
vektor = True
Case 4098
'Vektor Numerisch
vektor = True
Case 4099
'Vektor Kommazahl
vektor = True
Case 4100
'Vektor Kommazahl
vektor = True
Case 4101
'Vektor Kommazahl
vektor = True
Case 4103
'Vektor DateTime
vektor = True
Case 4107
vektor = True
Case 36865
'Vektor Kommazahl
vektor = True
Case Else
oWMValueConverted = ""
End Select
If vektor = False Then
If oWMValueConverted.ToString Is Nothing = False Then
Logger.Info("Converted value is: " & oWMValueConverted.ToString)
End If
End If
'############################################################################################
'####################### Der eigentliche Indexierungsvorgang ################################
'############################################################################################
If vektor = False Then
Try
If oWMValueConverted.ToString Is Nothing = False Then
Logger.Info("Now: oWMFile.SetVariableValue(" & indexname & ", " & oWMValueConverted & ")")
oWMFile.SetVariableValue(indexname, CInt(oWMValueConverted))
'Die Datei speichern
oWMFile.Save()
Logger.Info("Index has been written!")
Else
Logger.Info("No indexvalue exists!")
End If
Catch ex As Exception
Logger.Error(ex)
oWMFile.Save()
oWMFile.unlock()
Return False
End Try
Else
Logger.Info("Vectorfield: Preparing of Array!")
Dim myArray()
Dim Anzahl As Integer = aValues.Length
'Vektorfeld wird mit EINEM Wert gefüllt
If Anzahl = 1 Then
Logger.Info("Vectorfield will be filled with ONE VALUE!")
ReDim myArray(0)
myArray(0) = Helpers.Convert_VectorType(oWMType, value)
'Jetzt überprüfen ob Werte in Vektorfeld angefügt oder überschrieben werden sollen
Logger.Info("Converted Value: " & myArray(0).ToString)
Dim VektorArray()
VektorArray = Return_VektorArray(oWMFile, indexname, myArray, oWMType)
If VektorArray Is Nothing = False Then
ReDim myArray(VektorArray.Length - 1)
Array.Copy(VektorArray, myArray, VektorArray.Length)
'Jetzt die Nachindexierung
oWMFile.SetVariableValue(indexname, myArray) '
Logger.Info("Vectorindex has been written!")
'Die Änderungen festsschreiben/speichern
oWMFile.Save()
End If
End If
End If
i += 1
oWMFile.unlock()
Logger.Info("...and unlock")
Return True
Catch ex As Exception
Logger.Error(ex)
oWMFile.Save()
oWMFile.unlock()
Return False
End Try
End Function
Private Shared Function NewLockWMFile(oWMFile As WMObject) As Boolean
Try
oWMFile.lock()
Return True
Catch ex As Exception
Logger.Error(ex)
Return False
End Try
End Function
''' <summary>
''' Sets the folder-objecttype.
''' </summary>
''' <param name="folderpath">full path of folder</param>
''' <param name="folderObjecttype">Obcjectype Name</param>
''' <returns>Returns true when Otype was set, false if not</returns>
''' <remarks></remarks>
Public Shared Function NewObjecttypeForFolder(folderpath As String, folderObjecttype As String)
Try
Dim result As Boolean = False
Dim WMFolder As WINDREAMLib.WMObject
If folderpath.StartsWith("\") = False And folderpath.ToUpper.StartsWith(WMDriveLetter.ToUpper) Then
folderpath = folderpath.Substring(2)
End If
If TestFolderExists(folderpath) = True Then
WMFolder = CurrentSession.GetWMObjectByPath(WMEntityFolder, folderpath)
Try
' die Datei sperren
WMFolder.lock()
Catch ex As Exception
' nichts tun (Datei ist bereits gesperrt)
End Try
' wenn der Datei noch kein Dokumenttyp zugewiesen wurde
If WMFolder.aObjectType.aName = "Standard" Then
' ihr den entsprechenden Dokumenttyp zuweisen
WMFolder.aObjectType = CurrentSession.GetWMObjectByName(WINDREAMLib.WMEntity.WMEntityObjectType, folderObjecttype)
' WMObject.aObjectType = Me.selectedProfile.Dokumenttyp
Logger.Info("Objecttype has been set")
result = True
Else
If WMFolder.aObjectType.aName <> "Standard" Then
Logger.Warn("An Objecttype has already been set!")
End If
End If
Try
WMFolder.Save()
Catch ex As Exception
' wenn es einen Fehler beim speichern gab, dann konnte auch kein Dokumenttyp gesetzt werden -> es kann also auch keine
' Indexierung stattfinden und die Indexierung muss nicht fortgesetzt werden
Return False
End Try
Try
WMFolder.unlock()
Catch ex As Exception
' wenn das entsperren nicht geklappt hat, dann war die Datei auch nicht gesperrt
End Try
Return result
End If
Catch ex As Exception
Logger.Error(ex)
Return False
End Try
End Function
''' <summary>
''' Creates a new version of the file
''' </summary>
''' <param name="WMPath">full path to the file</param>
''' <param name="Comment">Comment</param>
''' <returns>Returns true when version was created, false if not</returns>
''' <remarks></remarks>
Public Shared Function NewVersion(ByVal WMPath As String, ByVal Comment As String)
Try
If WMPath.StartsWith("\") = False And WMPath.ToUpper.StartsWith(WMDriveLetter.ToUpper) Then
WMPath = WMPath.Substring(2)
End If
Dim WMObject As WINDREAMLib.WMObject '= CreateObject("WINDREAMLib.WMObject") 'New WINDREAMLib.WMObject
Try
WMObject = CurrentSession.GetWMObjectByPath(WINDREAMLib.WMEntity.WMEntityDocument, WMPath) 'WINDREAMLib.WMEntity.WMEntityDocument
Catch ex As Exception
Logger.Warn("Could not create WMObject in Create_Version for file '" & WMPath & "': " & ex.Message)
Return False
End Try
WMObject.CreateVersion2(False, "HISTORY_New_From_Version", Comment)
Return True
Catch ex As Exception
Logger.Error(ex)
Return False
End Try
End Function
#End Region
#Region "+++++ Get +++++"
''' <summary>
''' Returns all choicelists
''' </summary>
''' <returns>choicelists as String-Array</returns>
''' <remarks></remarks>
Public Shared Function GetChoiceLists() As List(Of String)
Try
Dim oChoiceLists As WMObjects
Dim oChoiceList As IWMObject2
' den Objekttyp laden
oChoiceLists = CurrentSession.GetAllObjects(WMEntityChoiceList)
'Array für Indizes vorbereiten
Dim choiceLists As New List(Of String)
For j As Integer = 0 To oChoiceLists.Count() - 1
' aktuellee Liste ausleseb auslesen
oChoiceList = oChoiceLists.Item(j)
choiceLists.Add(oChoiceList.aName)
Next
Return choiceLists
Catch ex As Exception
Logger.Error(ex)
Return Nothing
End Try
End Function
''' <summary>
''' Returns all indices for an objecttype
''' </summary>
''' <param name="ObjecttypeName">Name of objecttype</param>
''' <returns>Name of containing indices as String-Array</returns>
''' <remarks></remarks>
Public Shared Function GetIndicesByObjecttype(ByVal ObjecttypeName As String) As String()
Try
Dim oObjectType As WMObject
Dim oIndexAttributes As WMObjectRelation
Dim oIndexAttribute As WMObject
Dim oIndex As WMObject
Dim oRelProperties As WMObjectRelation
' den Objekttyp laden
oObjectType = CurrentSession.GetWMObjectByName(WMEntityObjectType, ObjecttypeName)
' Beziehung zu Indizes des Objekttyp auslesen
oIndexAttributes = oObjectType.GetWMObjectRelationByName("TypeAttributes")
' Array für Indizes vorbereiten
Dim aIndexNames(oIndexAttributes.Count - 1) As String
' alle Indizes durchlaufen
For j As Integer = 0 To oIndexAttributes.Count - 1
' aktuellen Index auslesen
oIndexAttribute = oIndexAttributes.Item(j)
' Eigenschaften des Index auslesen
oRelProperties = oIndexAttribute.GetWMObjectRelationByName("Attribute")
' Index aus den Eigenschaften auslesen
oIndex = oRelProperties.Item(0)
' Indexname speichern
aIndexNames(j) = oIndex.aName
Next
' Indexarray zurückgeben
Return aIndexNames
Catch ex As Exception
Logger.Error(ex)
Return Nothing
End Try
End Function
''' <summary>
''' Returns all items of a choicelist
''' </summary>
''' <param name="NameChoicelist">name of choicelist</param>
''' <returns>items as String-Array</returns>
''' <remarks></remarks>
Public Function GetChoicelistItems(ByVal NameChoicelist As String) As Object
Try
'Dim oAttribute = Me.oSession.GetWMObjectByName(WINDREAMLib.WMEntity.WMEntityAttribute, indexname)
'Dim vType = oAttribute.getVariableValue("vItems")
'Return vType
Dim oChoiceList = CurrentSession.GetWMObjectByName(WMEntityChoiceList, NameChoicelist)
If Err.Number = 0 And TypeName(oChoiceList) <> "Nothing" Then
Dim Values = oChoiceList
Values = oChoiceList.GetVariableValue("vItems")
Dim anz As Integer = 0
For Each CLItem In Values
If oChoiceList.aName IsNot Nothing Then
anz += 1
End If
Next
Dim strListe(anz - 1)
Dim zahl As Integer = 0
For Each CLItem In Values
If oChoiceList.aName IsNot Nothing Then
strListe(zahl) = CLItem
zahl += 1
End If
Next
Return strListe
Else
Logger.Warn("WMchoicelist: " & NameChoicelist & " not found!")
Return Nothing
End If
Catch ex As Exception
Logger.Error(ex)
Return Nothing
End Try
End Function
''' <summary>
''' Returns all Objecttypes of current server as array of strings
''' </summary>
''' <returns>array(String) of all objecttypes</returns>
''' <remarks></remarks>
Public Function GetObjecttypesAsStrings() As String()
Try
Dim objektTypenStr(CurrentObjecttypes.Count) As String
For i As Integer = 0 To CurrentObjecttypes.Count
objektTypenStr(i) = CurrentObjecttypes.Item(i).aName
Next
Return objektTypenStr
Catch ex As Exception
Logger.Error(ex)
Return Nothing
End Try
End Function
''' <summary>
''' Returns the result of windream-search
''' </summary>
''' <param name="wdfLocation">filepath of windreamSearch-file</param>
''' <param name="NameIndexDocID">Name of the Docid Index </param>
''' <returns>Returns datatable</returns>
''' <remarks></remarks>
Public Shared Function GetSearchDocuments(ByVal wdfLocation As String, NameIndexDocID As String)
Dim dt As New DataTable
dt.Columns.Add("DOC_ID", GetType(Integer))
dt.Columns.Add("PATH", GetType(String))
Try
Dim ProfileName = wdfLocation.Substring(wdfLocation.LastIndexOf("\") + 1)
Dim ProfilePath = wdfLocation.Substring(0, wdfLocation.Length - ProfileName.Length)
CurrentController = New WMOSearchController
CurrentController.CheckSearchProfile(wdfLocation.ToLower)
Dim suchTyp = CurrentController.SearchProfileTargetProgID
Dim ExSettings As Object
Dim oSearch As Object
ExSettings = CurrentController.SearchProfileExSettings
If ExSettings = 0 Then ExSettings = 7
Dim srchQuick As WMOSRCHLib.WMQuickSearch = CreateObject("WMOSrch.WMQuickSearch")
Dim srchIndex As WMOSRCHLib.WMIndexSearch = CreateObject("WMOSrch.WMIndexSearch")
Dim srchObjectType As WMOSRCHLib.WMObjectTypeSearch = CreateObject("WMOSrch.WMObjectTypeSearch")
Dim suchTyp1 = suchTyp.ToString.ToUpper
'' Der öffentliche Member CheckSearchProfile für den Typ IWMQuickSearch7 wurde nicht gefunden. [Microsoft.VisualBasic] => GetSearchDocuments()
Select Case suchTyp.ToString.ToUpper
Case "WMOSRCH.WMQUICKSEARCH"
srchQuick.WMSession = CreateObject("Windream.WMSession", CurrentWMServer)
CurrentWMConnect.LoginSession(srchQuick.WMSession)
srchQuick.ClearSearch()
srchQuick.SearchProfilePath = ProfilePath
srchQuick.LoadSearchProfile(ProfileName)
oSearch = srchQuick.GetSearch()
Case "WMOSRCH.WMINDEXSEARCH"
srchIndex.WMSession = CreateObject("Windream.WMSession", CurrentWMServer)
CurrentWMConnect.LoginSession(srchIndex.WMSession)
srchIndex.ClearSearch()
srchIndex.SearchProfilePath = ProfilePath
srchIndex.LoadSearchProfile(ProfileName)
oSearch = srchIndex.GetSearch()
Case "WMOSRCH.WMOBJECTTYPESEARCH"
srchObjectType.WMSession = CreateObject("Windream.WMSession", CurrentWMServer)
CurrentWMConnect.LoginSession(srchObjectType.WMSession)
srchObjectType.ClearSearch()
srchObjectType.SearchProfilePath = ProfilePath
srchObjectType.LoadSearchProfile(ProfileName)
oSearch = srchObjectType.GetSearch()
Case Else
MsgBox("KEIN GÜLTIGER WINDREAM-SUCHTYP")
Return Nothing
End Select
Dim WMObjects As Object
WMObjects = oSearch.Execute
'If returnDT = True Then
If WMObjects.Count > 0 Then
For Each dok As WMObject In WMObjects
Dim path As String = dok.aPath
Dim DOC_ID = dok.GetVariableValue(NameIndexDocID)
dt.Rows.Add(DOC_ID, path)
Next
dt.AcceptChanges()
End If
Return dt
Catch ex As Exception
Logger.Error(ex)
Return dt
End Try
End Function
''' <summary>
''' Returns a windream-type as Integer.
''' </summary>
''' <param name="indexname">Name of indexfield</param>
''' <returns>Returns integer, which describes the type</returns>
''' <remarks></remarks>
Public Shared Function GetTypeOfIndexAsInt(ByVal indexname As String) As Integer
Try
Dim oAttribute = CurrentSession.GetWMObjectByName(WINDREAMLib.WMEntity.WMEntityAttribute, indexname)
Dim vType = oAttribute.getVariableValue("dwAttrType")
Return vType
Catch ex As Exception
Return Nothing
End Try
End Function
''' <summary>
''' Returns the value(s) for an index as a datatable
''' </summary>
''' <param name="WMFile">filepath of windream-file</param>
''' <param name="NameIndex">Name of the index </param>
''' <returns>Datatable</returns>
''' <remarks></remarks>
Public Shared Function GetValueforIndex(ByVal WMFile As String, ByVal NameIndex As String) As DataTable
Dim dt As New DataTable
dt.Columns.Add("RESULT", GetType(String))
Try
If Not WMFile.StartsWith("\") And WMFile.ToUpper.StartsWith(WMDriveLetter.ToUpper) Then
WMFile = WMFile.Substring(2)
End If
Dim WMObject As WINDREAMLib.WMObject '= CreateObject("WINDREAMLib.WMObject") 'New WINDREAMLib.WMObject
Try
WMObject = CurrentSession.GetWMObjectByPath(WINDREAMLib.WMEntity.WMEntityDocument, WMFile) 'WINDREAMLib.WMEntity.WMEntityDocument
Catch ex As Exception
Logger.Error(ex)
Return dt
End Try
Dim result = WMObject.GetVariableValue(NameIndex)
If IsNothing(result) Then
Return Nothing
Else
If result.GetType.ToString.Contains("System.Object") Then
For Each val As String In result
dt.Rows.Add(val)
Next
dt.AcceptChanges()
Else
dt.Rows.Add(result)
End If
End If
Return dt
Catch ex As Exception
Logger.Error(ex)
Return dt
End Try
End Function
''' <summary>
''' Returns the values for a vektorfield plus the new ones
''' </summary>
''' <param name="WMFile">filepath of windream-file</param>
''' <param name="NameIndex">Name of the index </param>
''' <returns>Returns value as Datatable</returns>
''' <remarks></remarks>
Public Shared Function Return_VektorArray(ByVal oDocument As WMObject, vktIndexName As String, arrIndexwerte As Object, vType As Object)
Try
Dim missing As Boolean = False
Dim valueCount As Integer = 0
Dim ValueArray()
'Jeden Wert des Vektorfeldes durchlaufen
Dim DT_RESULT = GetValueforIndex(oDocument.aPath, vktIndexName)
If DT_RESULT.Rows.Count > 0 Then
'Erst die aktuellen Werte speichern und schreiben
For Each row As DataRow In DT_RESULT.Rows
ReDim Preserve ValueArray(valueCount)
'Den Wert im Array speichern
ValueArray(valueCount) = Helpers.Convert_VectorType(vType, row.Item(0))
valueCount += 1
Next
'Jetzt die Neuen Werte auf Duplikate überprüfen
For Each NewValue As Object In arrIndexwerte
If NewValue Is Nothing = False Then
If ValueArray.Contains(NewValue) = False Then
'Das Array anpassen
ReDim Preserve ValueArray(valueCount)
'Den Wert im Array speichern
ValueArray(valueCount) = Helpers.Convert_VectorType(vType, NewValue)
valueCount += 1
Else
Logger.Info("Value '" & NewValue.ToString & "' already existing in vectorfield(1)")
End If
End If
Next
Else
Logger.Info(" vectorfield is empty....")
'Den/die Neuen Wert(e) anfügen
For Each NewValue As Object In arrIndexwerte
If NewValue Is Nothing = False Then
If ValueArray Is Nothing = False Then
If ValueArray.Contains(NewValue) = False Then
'Das Array anpassen
ReDim Preserve ValueArray(valueCount)
'Den Wert im Array speichern
ValueArray(valueCount) = Helpers.Convert_VectorType(vType, NewValue)
valueCount += 1
Else
Logger.Info("Value '" & NewValue.ToString & "' already existing in vectorfield(2)")
End If
Else 'Dererste Wert, also hinzufügen
'Das Array anpassen
ReDim Preserve ValueArray(valueCount)
'Den Wert im Array speichern
ValueArray(valueCount) = Helpers.Convert_VectorType(vType, NewValue)
valueCount += 1
End If
End If
Next
End If
Return ValueArray
Catch ex As Exception
Logger.Error(ex)
End Try
End Function
''' <summary>
''' Returns a WMObject if file exists
''' </summary>
''' <param name="WMPath">full path to the file</param>
''' <returns>Returns WMObject</returns>
''' <remarks></remarks>
Public Shared Function GetWMObjectForFile(ByVal WMPath As String) As WMObject
Try
If WMPath.StartsWith("\") = False And WMPath.ToUpper.StartsWith(WMDriveLetter.ToUpper) Then
WMPath = WMPath.Substring(2)
End If
Dim oWMObject As WINDREAMLib.WMObject
Try
oWMObject = CurrentSession.GetWMObjectByPath(WINDREAMLib.WMEntity.WMEntityDocument, WMPath)
Catch ex As Exception
Logger.Warn("Could not create WMObject for file '" & WMPath & "': " & ex.Message)
Return Nothing
End Try
Return oWMObject
Catch ex As Exception
Logger.Error(ex)
Return Nothing
End Try
End Function
#End Region
#Region "+++++ Test +++++"
''' <summary>
''' Checks if the folder exists
''' </summary>
''' <param name="folderpath">The path of the folder</param>
''' <returns>True if exists or false if not or error occured</returns>
''' <remarks></remarks>
Public Shared Function TestFolderExists(folderpath As String)
Try
If folderpath.StartsWith("\") = False And folderpath.ToUpper.StartsWith(WMDriveLetter.ToUpper) Then
folderpath = folderpath.Substring(2)
End If
Try
Dim exists = CurrentSession.WMObjectExists(WMEntityFolder, folderpath, 0, 0)
Return exists
Catch ex As Exception
Logger.Error(ex)
Return False
End Try
Catch ex As Exception
Return False
End Try
End Function
''' <summary>
''' Checks wether file exists in windream
''' </summary>
''' <param name="WMPath">full path to the file</param>
''' <returns>Returns true when file was deleted, false if not</returns>
''' <remarks></remarks>
Public Shared Function TestFileExists(ByVal WMPath As String)
Try
If WMPath.StartsWith("\") = False And WMPath.ToUpper.StartsWith(WMDriveLetter.ToUpper) Then
WMPath = WMPath.Substring(2)
End If
Try
Dim WMObject As WINDREAMLib.WMObject = CurrentSession.GetWMObjectByPath(WINDREAMLib.WMEntity.WMEntityDocument, WMPath)
Catch ex As Exception
Logger.Warn("Could not create WMObject for file '" & WMPath & "' - so it is not existing")
Return False
End Try
Return True
Catch ex As Exception
Logger.Error(ex)
Return False
End Try
End Function
#End Region
#Region "+++++ Remove +++++"
''' <summary>
''' Deletes a file in windream
''' </summary>
''' <param name="WMPath">full path to the file</param>
''' <returns>Returns true when file was deleted, false if not</returns>
''' <remarks></remarks>
Public Shared Function RemFile(ByVal WMPath As String)
Try
If WMPath.StartsWith("\") = False And WMPath.ToUpper.StartsWith(WMDriveLetter.ToUpper) Then
WMPath = WMPath.Substring(2)
End If
Dim oWMObject = GetWMObjectForFile(WMPath)
If IsNothing(oWMObject) = False Then
oWMObject.Delete()
Return True
Else
Return False
End If
Catch ex As Exception
Logger.Error(ex)
Return False
End Try
End Function
''' <summary>
''' Removes the vektorlink from windream
''' </summary>
''' <param name="WMPath">full path to the file</param>
''' <param name="vktIndexName">Indexname of Vektor-Index</param>
''' <param name="deleteValue">Value which is to be deleted</param>
''' <returns>Returns true when indexing was successfull, false if not</returns>
''' <remarks></remarks>
Public Shared Function REMOVE_VEKTOR_LINK(ByVal WMPath As String, vktIndexName As String, deleteValue As String)
Try
Logger.Info("Removing Value '" & deleteValue & "' of Index '" & vktIndexName & "' " & WMPath)
Dim oWMFile As WINDREAMLib.WMObject = GetWMObjectForFile(WMPath)
If IsNothing(oWMFile) Then
Logger.Warn("Exit from REMOVE_VEKTOR_LINK...")
Return False
End If
Dim containsvalue As Boolean = False
Dim ValueArray()
'Jeden Wert des Vektorfeldes durchlaufen
Dim WMValue = oWMFile.GetVariableValue(vktIndexName)
If WMValue Is Nothing = False Then
'Nochmals prüfen ob wirklich Array
If WMValue.GetType.ToString.Contains("System.Object") Then
' das entsprechende Attribut aus windream auslesen
Dim oAttribute = CurrentSession.GetWMObjectByName(WINDREAMLib.WMEntity.WMEntityAttribute, vktIndexName)
' den Variablentyp (String, Integer, ...) auslesen
Dim vType = oAttribute.getVariableValue("dwAttrType")
Dim Anzahl As Integer = 0
For Each WDValue As Object In WMValue
If WDValue Is Nothing = False Then
If WDValue = deleteValue Then
containsvalue = True
Logger.Info("The Index contains the value to be deleted!")
End If
If WDValue <> deleteValue Then
'Erst die ALten Werte schreiben
ReDim Preserve ValueArray(Anzahl)
'Den Wert im Array speichern
ValueArray(Anzahl) = Helpers.Convert_VectorType(vType, WDValue)
Anzahl += 1
End If
End If
Next
Else
Logger.Warn("Index is not a vector")
Return False
End If
Else
Logger.Warn("oWMObject is nothing")
Return True
End If
If containsvalue = True Then 'And Not IsNothing(ValueArray)
If NewLockWMFile(oWMFile) = False Then
Return False
End If
'Indexiern des Vektorfeldes
oWMFile.SetVariableValue(vktIndexName, ValueArray)
' die Indexinformationen des Dokuments speichern
oWMFile.Save()
Logger.Info("The new vectorvalues were saved!")
' Unlock in einem unbehandelten Try-Block um Fehler abzufangen,
Try
' die Sperrung des Dokuments aufheben
oWMFile.unlock()
Catch ex As Exception
' nichts tun (Datei war nicht gesperrt)
End Try
'Zurückgeben
Return True
Else
Logger.Info("containsvalue is not true")
Return True
End If
Catch ex As Exception
Logger.Error(ex)
Return False
End Try
End Function
#End Region
End Class

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="NLog" version="4.5.8" targetFramework="net461" />
</packages>

6
TestGUI/App.config Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
</configuration>

62
TestGUI/Form1.Designer.vb generated Normal file
View File

@ -0,0 +1,62 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
Inherits System.Windows.Forms.Form
'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Wird vom Windows Form-Designer benötigt.
Private components As System.ComponentModel.IContainer
'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich.
'Das Bearbeiten ist mit dem Windows Form-Designer möglich.
'Das Bearbeiten mit dem Code-Editor ist nicht möglich.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.Button1 = New System.Windows.Forms.Button()
Me.Button2 = New System.Windows.Forms.Button()
Me.SuspendLayout()
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(12, 78)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(267, 23)
Me.Button1.TabIndex = 0
Me.Button1.Text = "windream instanzieren"
Me.Button1.UseVisualStyleBackColor = True
'
'Button2
'
Me.Button2.Location = New System.Drawing.Point(12, 12)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(267, 23)
Me.Button2.TabIndex = 1
Me.Button2.Text = "Logger initialisieren"
Me.Button2.UseVisualStyleBackColor = True
'
'Form1
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(800, 450)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.Button1)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)
End Sub
Friend WithEvents Button1 As Button
Friend WithEvents Button2 As Button
End Class

120
TestGUI/Form1.resx Normal file
View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

7
TestGUI/Form1.vb Normal file
View File

@ -0,0 +1,7 @@
Imports Modules.Windream
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim WM As New Windream("W", True)
End Sub
End Class

View File

@ -0,0 +1,38 @@
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.42000
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Namespace My
'NOTE: This file is auto-generated; do not modify it directly. To make changes,
' or if you encounter build errors in this file, go to the Project Designer
' (go to Project Properties or double-click the My Project node in
' Solution Explorer), and make changes on the Application tab.
'
Partial Friend Class MyApplication
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
Public Sub New()
MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
Me.IsSingleInstance = false
Me.EnableVisualStyles = true
Me.SaveMySettingsOnExit = true
Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses
End Sub
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
Protected Overrides Sub OnCreateMainForm()
Me.MainForm = Global.TestGUI.Form1
End Sub
End Class
End Namespace

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<MySubMain>true</MySubMain>
<MainForm>Form1</MainForm>
<SingleInstance>false</SingleInstance>
<ShutdownMode>0</ShutdownMode>
<EnableVisualStyles>true</EnableVisualStyles>
<AuthenticationMode>0</AuthenticationMode>
<ApplicationType>0</ApplicationType>
<SaveMySettingsOnExit>true</SaveMySettingsOnExit>
</MyApplicationData>

View File

@ -0,0 +1,35 @@
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
' Allgemeine Informationen über eine Assembly werden über die folgenden
' Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
' die einer Assembly zugeordnet sind.
' Werte der Assemblyattribute überprüfen
<Assembly: AssemblyTitle("TestGUI")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("TestGUI")>
<Assembly: AssemblyCopyright("Copyright © 2018")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(False)>
'Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird.
<Assembly: Guid("0e6f4684-9ce1-4369-9b46-c4055164acf0")>
' Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
'
' Hauptversion
' Nebenversion
' Buildnummer
' Revision
'
' Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.0.0.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>

62
TestGUI/My Project/Resources.Designer.vb generated Normal file
View File

@ -0,0 +1,62 @@
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.42000
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Namespace My.Resources
'This class was auto-generated by the StronglyTypedResourceBuilder
'class via a tool like ResGen or Visual Studio.
'To add or remove a member, edit your .ResX file then rerun ResGen
'with the /str option, or rebuild your VS project.
'''<summary>
''' A strongly-typed resource class, for looking up localized strings, etc.
'''</summary>
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0"), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
Friend Module Resources
Private resourceMan As Global.System.Resources.ResourceManager
Private resourceCulture As Global.System.Globalization.CultureInfo
'''<summary>
''' Returns the cached ResourceManager instance used by this class.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
Get
If Object.ReferenceEquals(resourceMan, Nothing) Then
Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("TestGUI.Resources", GetType(Resources).Assembly)
resourceMan = temp
End If
Return resourceMan
End Get
End Property
'''<summary>
''' Overrides the current thread's CurrentUICulture property for all
''' resource lookups using this strongly typed resource class.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend Property Culture() As Global.System.Globalization.CultureInfo
Get
Return resourceCulture
End Get
Set(ByVal value As Global.System.Globalization.CultureInfo)
resourceCulture = value
End Set
End Property
End Module
End Namespace

View File

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

73
TestGUI/My Project/Settings.Designer.vb generated Normal file
View File

@ -0,0 +1,73 @@
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.42000
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Namespace My
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0"), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Partial Friend NotInheritable Class MySettings
Inherits Global.System.Configuration.ApplicationSettingsBase
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings)
#Region "My.Settings Auto-Save Functionality"
#If _MyType = "WindowsForms" Then
Private Shared addedHandler As Boolean
Private Shared addedHandlerLockObject As New Object
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
If My.Application.SaveMySettingsOnExit Then
My.Settings.Save()
End If
End Sub
#End If
#End Region
Public Shared ReadOnly Property [Default]() As MySettings
Get
#If _MyType = "WindowsForms" Then
If Not addedHandler Then
SyncLock addedHandlerLockObject
If Not addedHandler Then
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
addedHandler = True
End If
End SyncLock
End If
#End If
Return defaultInstance
End Get
End Property
End Class
End Namespace
Namespace My
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
Friend Module MySettingsProperty
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
Friend ReadOnly Property Settings() As Global.TestGUI.My.MySettings
Get
Return Global.TestGUI.My.MySettings.Default
End Get
End Property
End Module
End Namespace

View File

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" UseMySettingsClassName="true">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

125
TestGUI/TestGUI.vbproj Normal file
View File

@ -0,0 +1,125 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{93130E7D-A950-4CBD-A0D9-7A6FAF94DDC0}</ProjectGuid>
<OutputType>WinExe</OutputType>
<StartupObject>TestGUI.My.MyApplication</StartupObject>
<RootNamespace>TestGUI</RootNamespace>
<AssemblyName>TestGUI</AssemblyName>
<FileAlignment>512</FileAlignment>
<MyType>WindowsForms</MyType>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\Debug\</OutputPath>
<DocumentationFile>TestGUI.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<DefineDebug>false</DefineDebug>
<DefineTrace>true</DefineTrace>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DocumentationFile>TestGUI.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
</PropertyGroup>
<PropertyGroup>
<OptionExplicit>On</OptionExplicit>
</PropertyGroup>
<PropertyGroup>
<OptionCompare>Binary</OptionCompare>
</PropertyGroup>
<PropertyGroup>
<OptionStrict>Off</OptionStrict>
</PropertyGroup>
<PropertyGroup>
<OptionInfer>On</OptionInfer>
</PropertyGroup>
<ItemGroup>
<Reference Include="Modules.Windream">
<HintPath>..\Modules.Windream\bin\Debug\Modules.Windream.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
</ItemGroup>
<ItemGroup>
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />
<Import Include="System.Collections" />
<Import Include="System.Collections.Generic" />
<Import Include="System.Data" />
<Import Include="System.Drawing" />
<Import Include="System.Diagnostics" />
<Import Include="System.Windows.Forms" />
<Import Include="System.Linq" />
<Import Include="System.Xml.Linq" />
<Import Include="System.Threading.Tasks" />
</ItemGroup>
<ItemGroup>
<Compile Include="Form1.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.vb">
<DependentUpon>Form1.vb</DependentUpon>
<SubType>Form</SubType>
</Compile>
<Compile Include="My Project\AssemblyInfo.vb" />
<Compile Include="My Project\Application.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Application.myapp</DependentUpon>
</Compile>
<Compile Include="My Project\Resources.Designer.vb">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="My Project\Settings.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="My Project\Resources.resx">
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
<CustomToolNamespace>My.Resources</CustomToolNamespace>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="My Project\Application.myapp">
<Generator>MyApplicationCodeGenerator</Generator>
<LastGenOutput>Application.Designer.vb</LastGenOutput>
</None>
<None Include="My Project\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<CustomToolNamespace>My</CustomToolNamespace>
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
</None>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
</Project>