First create solution
This commit is contained in:
@@ -0,0 +1,148 @@
|
||||
Imports System
|
||||
Imports System.ComponentModel
|
||||
|
||||
Imports DevExpress.Xpo
|
||||
Imports DevExpress.Data.Filtering
|
||||
|
||||
Imports DevExpress.ExpressApp
|
||||
Imports DevExpress.Persistent.Base
|
||||
Imports DevExpress.Persistent.BaseImpl
|
||||
Imports DevExpress.Persistent.Validation
|
||||
Imports DevExpress.ExpressApp.ConditionalAppearance
|
||||
|
||||
Public Enum eEditMode
|
||||
eCentralXML = 0
|
||||
eUserXML = 1
|
||||
End Enum
|
||||
<Appearance("ListViewCustomization - Hide SQLServer when eEditMode = 0", AppearanceItemType.ViewItem, "eEditMode = 0", TargetItems:="SQLServer", visibility:=Editors.ViewItemVisibility.Hide)> _
|
||||
<Appearance("ListViewCustomization - Hide SQLDatabase when eEditMode = 0", AppearanceItemType.ViewItem, "eEditMode = 0", TargetItems:="SQLDatabase", visibility:=Editors.ViewItemVisibility.Hide)> _
|
||||
<Appearance("ListViewCustomization - Hide SQLUser when eEditMode = 0", AppearanceItemType.ViewItem, "eEditMode = 0", TargetItems:="SQLUser", visibility:=Editors.ViewItemVisibility.Hide)> _
|
||||
<Appearance("ListViewCustomization - Hide SQLPassword when eEditMode = 0", AppearanceItemType.ViewItem, "eEditMode = 0", TargetItems:="SQLPassword", visibility:=Editors.ViewItemVisibility.Hide)> _
|
||||
<Appearance("ListViewCustomization - Hide SQLType when eEditMode = 0", AppearanceItemType.ViewItem, "eEditMode = 0", TargetItems:="SQLType", visibility:=Editors.ViewItemVisibility.Hide)> _
|
||||
<Appearance("ListViewCustomization - Hide User when eEditMode = 0", AppearanceItemType.ViewItem, "eEditMode = 0", TargetItems:="User", visibility:=Editors.ViewItemVisibility.Hide)> _
|
||||
<Appearance("ListViewCustomization - Hide XMLFileName when eEditMode = 1", AppearanceItemType.ViewItem, "eEditMode = 1", TargetItems:="XMLFileName", visibility:=Editors.ViewItemVisibility.Hide)> _
|
||||
<Appearance("ListViewCustomization - Hide aListViewModelManager_FileBrowser when eEditMode = 1", AppearanceItemType.Action, " eEditMode = 1", TargetItems:="aListViewModelManager_FileBrowser", visibility:=Editors.ViewItemVisibility.Hide)> _
|
||||
<DefaultClassOptions()> _
|
||||
<NonPersistent()> _
|
||||
<CreatableItem(False)> _
|
||||
<NavigationItem(False)> _
|
||||
Public Class ListViewCustomization
|
||||
Inherits BaseObject
|
||||
|
||||
Private _eEditMode As eEditMode
|
||||
Private _SQLServer As String
|
||||
Private _SQLDatabase As String
|
||||
Private _SQLUser As String
|
||||
Private _SQLPassword As String
|
||||
Private _SQLType As eSQLType
|
||||
Private _XMLFileName As String
|
||||
Private _User As User
|
||||
|
||||
Public Sub New(ByVal session As Session)
|
||||
MyBase.New(session)
|
||||
End Sub
|
||||
Public Overrides Sub AfterConstruction()
|
||||
MyBase.AfterConstruction()
|
||||
XMLFileName = ""
|
||||
eEditMode = eEditMode.eCentralXML
|
||||
SQLType = eSQLType.MSSQL
|
||||
End Sub
|
||||
|
||||
<ImmediatePostData()> _
|
||||
Property eEditMode As eEditMode
|
||||
Get
|
||||
Return _eEditMode
|
||||
End Get
|
||||
Set(value As eEditMode)
|
||||
SetPropertyValue("eEditMode", _eEditMode, value)
|
||||
End Set
|
||||
End Property
|
||||
Property SQLServer As String
|
||||
Get
|
||||
Return _SQLServer
|
||||
End Get
|
||||
Set(value As String)
|
||||
SetPropertyValue("SQLServer", _SQLServer, value)
|
||||
End Set
|
||||
End Property
|
||||
Property SQLDatabase As String
|
||||
Get
|
||||
Return _SQLDatabase
|
||||
End Get
|
||||
Set(value As String)
|
||||
SetPropertyValue("SQLDatabase", _SQLDatabase, value)
|
||||
End Set
|
||||
End Property
|
||||
Property SQLUser As String
|
||||
Get
|
||||
Return _SQLUser
|
||||
End Get
|
||||
Set(value As String)
|
||||
SetPropertyValue("SQLUser", _SQLUser, value)
|
||||
End Set
|
||||
End Property
|
||||
Property SQLPassword As String
|
||||
Get
|
||||
Return _SQLPassword
|
||||
End Get
|
||||
Set(value As String)
|
||||
SetPropertyValue("SQLPassword", _SQLPassword, value)
|
||||
End Set
|
||||
End Property
|
||||
Property SQLType As eSQLType
|
||||
Get
|
||||
Return _SQLType
|
||||
End Get
|
||||
Set(value As eSQLType)
|
||||
SetPropertyValue("SQLType", _SQLType, value)
|
||||
End Set
|
||||
End Property
|
||||
Property XMLFileName As String
|
||||
Get
|
||||
Return _XMLFileName
|
||||
End Get
|
||||
Set(value As String)
|
||||
SetPropertyValue("XMLFileName", _XMLFileName, value)
|
||||
End Set
|
||||
End Property
|
||||
<ImmediatePostData(True), DataSourceProperty("XMLDatabaseUser", DataSourcePropertyIsNullMode.SelectNothing)>
|
||||
Property User As User
|
||||
Get
|
||||
Return _User
|
||||
End Get
|
||||
Set(value As User)
|
||||
SetPropertyValue("User", _User, value)
|
||||
End Set
|
||||
End Property
|
||||
Private ReadOnly Property XMLDatabaseUser As XPCollection(Of User)
|
||||
Get
|
||||
Dim _UserCollection As XPCollection(Of User) = Nothing
|
||||
Dim _Session As New Session
|
||||
Try
|
||||
_Session.ConnectionString = GetConnectionString()
|
||||
_Session.Connect()
|
||||
If _Session.IsConnected Then
|
||||
_UserCollection = New XPCollection(Of User)(_Session)
|
||||
End If
|
||||
Catch ex As Exception
|
||||
Finally
|
||||
If _Session.IsConnected Then _Session.Disconnect()
|
||||
End Try
|
||||
|
||||
Return _UserCollection
|
||||
End Get
|
||||
End Property
|
||||
Private Function GetConnectionString()
|
||||
Dim _ConnectionString As String = ""
|
||||
Select Case SQLType
|
||||
Case eSQLType.MSSQL
|
||||
_ConnectionString = DevExpress.Xpo.DB.MSSqlConnectionProvider.GetConnectionString(SQLServer, SQLUser, SQLPassword, SQLDatabase)
|
||||
Case eSQLType.MySQL
|
||||
_ConnectionString = DevExpress.Xpo.DB.MySqlConnectionProvider.GetConnectionString(SQLServer, SQLUser, SQLPassword, SQLDatabase)
|
||||
Case eSQLType.PostgreSQL
|
||||
_ConnectionString = DevExpress.Xpo.DB.PostgreSqlConnectionProvider.GetConnectionString(SQLServer, SQLUser, SQLPassword, SQLDatabase)
|
||||
End Select
|
||||
|
||||
Return _ConnectionString
|
||||
End Function
|
||||
End Class
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
Partial Class ListViewModelManagerVC
|
||||
|
||||
<System.Diagnostics.DebuggerNonUserCode()> _
|
||||
Public Sub New(ByVal Container As System.ComponentModel.IContainer)
|
||||
MyClass.New()
|
||||
|
||||
'Required for Windows.Forms Class Composition Designer support
|
||||
Container.Add(Me)
|
||||
|
||||
End Sub
|
||||
|
||||
'Component overrides dispose to clean up the component list.
|
||||
<System.Diagnostics.DebuggerNonUserCode()> _
|
||||
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
|
||||
If disposing AndAlso components IsNot Nothing Then
|
||||
components.Dispose()
|
||||
End If
|
||||
MyBase.Dispose(disposing)
|
||||
End Sub
|
||||
|
||||
'Required by the Component Designer
|
||||
Private components As System.ComponentModel.IContainer
|
||||
|
||||
'NOTE: The following procedure is required by the Component Designer
|
||||
'It can be modified using the Component Designer.
|
||||
'Do not modify it using the code editor.
|
||||
<System.Diagnostics.DebuggerStepThrough()> _
|
||||
Private Sub InitializeComponent()
|
||||
Me.components = New System.ComponentModel.Container()
|
||||
Me.aManageListViewModel = New DevExpress.ExpressApp.Actions.PopupWindowShowAction(Me.components)
|
||||
Me.aListViewModelManager_FileBrowser = New DevExpress.ExpressApp.Actions.SimpleAction(Me.components)
|
||||
'
|
||||
'aManageListViewModel
|
||||
'
|
||||
Me.aManageListViewModel.AcceptButtonCaption = Nothing
|
||||
Me.aManageListViewModel.CancelButtonCaption = Nothing
|
||||
Me.aManageListViewModel.Caption = "aManage List View Model"
|
||||
Me.aManageListViewModel.Category = "Menu"
|
||||
Me.aManageListViewModel.ConfirmationMessage = Nothing
|
||||
Me.aManageListViewModel.Id = "aManageListViewModel"
|
||||
Me.aManageListViewModel.ImageName = Nothing
|
||||
Me.aManageListViewModel.Shortcut = Nothing
|
||||
Me.aManageListViewModel.Tag = Nothing
|
||||
Me.aManageListViewModel.TargetObjectsCriteria = Nothing
|
||||
Me.aManageListViewModel.TargetViewId = Nothing
|
||||
Me.aManageListViewModel.ToolTip = Nothing
|
||||
Me.aManageListViewModel.TypeOfView = GetType(DevExpress.ExpressApp.View)
|
||||
'
|
||||
'aListViewModelManager_FileBrowser
|
||||
'
|
||||
Me.aListViewModelManager_FileBrowser.Caption = "aListViewModelManager_FileBrowser"
|
||||
Me.aListViewModelManager_FileBrowser.Category = "aListViewModelManager_FileBrowser"
|
||||
Me.aListViewModelManager_FileBrowser.ConfirmationMessage = Nothing
|
||||
Me.aListViewModelManager_FileBrowser.Id = "aListViewModelManager_FileBrowser"
|
||||
Me.aListViewModelManager_FileBrowser.ImageName = Nothing
|
||||
Me.aListViewModelManager_FileBrowser.Shortcut = Nothing
|
||||
Me.aListViewModelManager_FileBrowser.Tag = Nothing
|
||||
Me.aListViewModelManager_FileBrowser.TargetObjectsCriteria = Nothing
|
||||
Me.aListViewModelManager_FileBrowser.TargetViewId = ""
|
||||
Me.aListViewModelManager_FileBrowser.ToolTip = Nothing
|
||||
Me.aListViewModelManager_FileBrowser.TypeOfView = Nothing
|
||||
|
||||
End Sub
|
||||
Friend WithEvents aManageListViewModel As DevExpress.ExpressApp.Actions.PopupWindowShowAction
|
||||
Private WithEvents aListViewModelManager_FileBrowser As DevExpress.ExpressApp.Actions.SimpleAction
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,129 @@
|
||||
<?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>
|
||||
<metadata name="aManageListViewModel.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 56</value>
|
||||
</metadata>
|
||||
<metadata name="aListViewModelManager_FileBrowser.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>184, 135</value>
|
||||
</metadata>
|
||||
<metadata name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@@ -0,0 +1,173 @@
|
||||
Imports System
|
||||
Imports System.ComponentModel
|
||||
Imports System.Collections.Generic
|
||||
Imports System.Diagnostics
|
||||
Imports System.Text
|
||||
|
||||
Imports DevExpress.ExpressApp
|
||||
Imports DevExpress.ExpressApp.Actions
|
||||
Imports DevExpress.Persistent.Base
|
||||
Imports DevExpress.ExpressApp.Model
|
||||
Imports DevExpress.ExpressApp.Model.Core
|
||||
Imports System.IO
|
||||
Imports System.Xml
|
||||
Imports DevExpress.Xpo
|
||||
Imports DevExpress.Data.Filtering
|
||||
Imports DevExpress.Persistent.BaseImpl
|
||||
|
||||
|
||||
Public Class ListViewModelManagerVC
|
||||
Inherits DevExpress.ExpressApp.ViewController
|
||||
|
||||
Public Sub New()
|
||||
MyBase.New()
|
||||
InitializeComponent()
|
||||
RegisterActions(components)
|
||||
End Sub
|
||||
Protected Overrides Sub OnActivated()
|
||||
MyBase.OnActivated()
|
||||
|
||||
If SecuritySystemHelper.IsUserInRoleCurrentUser("ListViewModelManager") = False Then
|
||||
Frame.GetController(Of ListViewModelManagerVC).aManageListViewModel.Active.SetItemValue("", False)
|
||||
End If
|
||||
|
||||
If View.Id = "ListViewCustomization_DetailView" Then
|
||||
AddHandler Frame.GetController(Of DevExpress.ExpressApp.SystemModule.DialogController)().AcceptAction.Executing, AddressOf ListViewCustomization_DetailView_AcceptAction_Executing
|
||||
End If
|
||||
|
||||
End Sub
|
||||
Protected Overrides Sub OnDeactivated()
|
||||
MyBase.OnDeactivated()
|
||||
Frame.GetController(Of ListViewModelManagerVC).aManageListViewModel.Active.SetItemValue("", True)
|
||||
|
||||
If View.Id = "ListViewCustomization_DetailView" Then
|
||||
RemoveHandler Frame.GetController(Of DevExpress.ExpressApp.SystemModule.DialogController)().AcceptAction.Executing, AddressOf ListViewCustomization_DetailView_AcceptAction_Executing
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub aManageListViewModel_CustomizePopupWindowParams(sender As Object, e As CustomizePopupWindowParamsEventArgs) Handles aManageListViewModel.CustomizePopupWindowParams
|
||||
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
|
||||
Dim _ListViewCustomization As ListViewCustomization
|
||||
|
||||
_ListViewCustomization = _onew.CreateObject(Of ListViewCustomization)()
|
||||
e.View = Application.CreateDetailView(_onew, "ListViewCustomization_DetailView", True, _ListViewCustomization)
|
||||
|
||||
End Sub
|
||||
Private Sub aManageListViewModel_Execute(sender As Object, e As PopupWindowShowActionExecuteEventArgs) Handles aManageListViewModel.Execute
|
||||
Dim _ListViewCustomization As ListViewCustomization = TryCast(e.PopupWindow.View.SelectedObjects(0), ListViewCustomization)
|
||||
View.SaveModel()
|
||||
|
||||
Dim _Model As ModelApplicationBase = TryCast(Application.Model, ModelApplicationBase)
|
||||
|
||||
Dim xmlWriter As New ModelXmlWriter()
|
||||
Dim aspect As String = _Model.GetAspect(0)
|
||||
Dim xmlContent As String = xmlWriter.WriteToString(_Model, 0)
|
||||
Dim _FileName As String = System.IO.Path.GetTempPath + View.Id + LTrim(RTrim(CStr(0))) + ".xml"
|
||||
|
||||
Dim _StreamFile As System.IO.Stream = New System.IO.FileStream(_FileName, System.IO.FileMode.Create)
|
||||
Dim _StreamWriter As New StreamWriter(_StreamFile, System.Text.Encoding.UTF8)
|
||||
|
||||
_StreamWriter.Write(xmlContent)
|
||||
_StreamWriter.Close()
|
||||
|
||||
Select Case _ListViewCustomization.eEditMode
|
||||
Case eEditMode.eCentralXML
|
||||
|
||||
|
||||
If IO.File.Exists(_FileName) Then
|
||||
Dim _XmlDocument_From As New XmlDocument
|
||||
_XmlDocument_From.Load(_FileName)
|
||||
Dim _ListViewNode_From As XmlNode = _XmlDocument_From.SelectSingleNode("/Application/Views/ListView[@Id='" + View.Id + "']")
|
||||
|
||||
Dim _XmlDocument_To As New XmlDocument
|
||||
_XmlDocument_To.Load(_ListViewCustomization.XMLFileName)
|
||||
Dim _ListViewNode_To As XmlNode = _XmlDocument_To.SelectSingleNode("/Application/Views/ListView[@Id='" + View.Id + "']")
|
||||
Dim _ListViewNode_To_Parent As XmlNode = Nothing
|
||||
|
||||
If _ListViewNode_To IsNot Nothing Then
|
||||
_ListViewNode_To_Parent = _ListViewNode_To.ParentNode
|
||||
_ListViewNode_To.ParentNode.RemoveChild(_ListViewNode_To)
|
||||
_XmlDocument_To.Save(_ListViewCustomization.XMLFileName)
|
||||
Else
|
||||
_ListViewNode_To_Parent = _XmlDocument_To.SelectSingleNode("/Application/Views")
|
||||
End If
|
||||
Dim _ListViewNode_To_ImportNode As XmlNode = _XmlDocument_To.ImportNode(_ListViewNode_From, True)
|
||||
_ListViewNode_To_Parent.AppendChild(_ListViewNode_To_ImportNode)
|
||||
_XmlDocument_To.Save(_ListViewCustomization.XMLFileName)
|
||||
End If
|
||||
Case eEditMode.eUserXML
|
||||
Dim _Session As New Session
|
||||
|
||||
_Session.ConnectionString = GetConnectionString(_ListViewCustomization)
|
||||
_Session.Connect()
|
||||
If _Session.IsConnected Then
|
||||
_Session.BeginTransaction()
|
||||
Dim _XmlUser As XmlUser = _Session.FindObject(Of XmlUser)(CriteriaOperator.Parse("User=?", _Session.GetObjectByKey(Of User)(_ListViewCustomization.User.Oid)))
|
||||
Dim _XmlStore As XmlStore = _Session.FindObject(Of XmlStore)(CriteriaOperator.Parse("User=?", _Session.GetObjectByKey(Of XmlUser)(_XmlUser.Oid)))
|
||||
Dim _FileStream As FileStream = File.Create(IO.Path.GetTempPath + View.Id + ".xml")
|
||||
Dim info As Byte() = New UTF8Encoding(True).GetBytes(_XmlStore.XmlData)
|
||||
_FileStream.Write(info, 0, info.Length)
|
||||
_FileStream.Close()
|
||||
|
||||
Dim _XmlDocument_To As New XmlDocument
|
||||
_XmlDocument_To.Load(IO.Path.GetTempPath + View.Id + ".xml")
|
||||
Dim _ListViewNode_To As XmlNode = _XmlDocument_To.SelectSingleNode("/Application/Views/ListView[@Id='" + View.Id + "']")
|
||||
Dim _ListViewNode_To_Parent As XmlNode = Nothing
|
||||
|
||||
If _ListViewNode_To IsNot Nothing Then
|
||||
_ListViewNode_To_Parent = _ListViewNode_To.ParentNode
|
||||
_ListViewNode_To.ParentNode.RemoveChild(_ListViewNode_To)
|
||||
_XmlDocument_To.Save(IO.Path.GetTempPath + View.Id + ".xml")
|
||||
Else
|
||||
_ListViewNode_To_Parent = _XmlDocument_To.SelectSingleNode("/Application/Views")
|
||||
End If
|
||||
|
||||
Dim _XmlDocument_From As New XmlDocument
|
||||
_XmlDocument_From.Load(_FileName)
|
||||
Dim _ListViewNode_From As XmlNode = _XmlDocument_From.SelectSingleNode("/Application/Views/ListView[@Id='" + View.Id + "']")
|
||||
|
||||
Dim _ListViewNode_To_ImportNode As XmlNode = _XmlDocument_To.ImportNode(_ListViewNode_From, True)
|
||||
_ListViewNode_To_Parent.AppendChild(_ListViewNode_To_ImportNode)
|
||||
_XmlDocument_To.Save(IO.Path.GetTempPath + View.Id + ".xml")
|
||||
|
||||
_XmlStore.XmlData = _XmlDocument_To.InnerXml
|
||||
_XmlStore.Save()
|
||||
_Session.CommitTransaction()
|
||||
End If
|
||||
End Select
|
||||
End Sub
|
||||
Private Sub aListViewModelManager_FileBrowser_Execute(sender As Object, e As SimpleActionExecuteEventArgs) Handles aListViewModelManager_FileBrowser.Execute
|
||||
Dim _ListViewCustomization As ListViewCustomization = TryCast(View.SelectedObjects(0), ListViewCustomization)
|
||||
If _ListViewCustomization IsNot Nothing Then
|
||||
Dim _OpenFileDialog As New Windows.Forms.OpenFileDialog
|
||||
_OpenFileDialog.Filter = "XAFML file (.xafml)|*.xafml|All Files (*.*)|*.*"
|
||||
|
||||
If _OpenFileDialog.ShowDialog() = Windows.Forms.DialogResult.OK Then
|
||||
_ListViewCustomization.XMLFileName = _OpenFileDialog.FileName
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
Private Sub ListViewCustomization_DetailView_AcceptAction_Executing(sender As Object, e As CancelEventArgs)
|
||||
Dim _ListViewCustomization As ListViewCustomization = TryCast(View.SelectedObjects(0), ListViewCustomization)
|
||||
If String.IsNullOrEmpty(_ListViewCustomization.XMLFileName) And _ListViewCustomization.eEditMode = eEditMode.eCentralXML Then
|
||||
e.Cancel = True
|
||||
MsgBox("Nincs kiválasztva Model XML file!")
|
||||
ElseIf Not IO.File.Exists(_ListViewCustomization.XMLFileName) And _ListViewCustomization.eEditMode = eEditMode.eCentralXML Then
|
||||
e.Cancel = True
|
||||
MsgBox("A kiválasztott Model XML file nem létezik!")
|
||||
End If
|
||||
End Sub
|
||||
Private Function GetConnectionString(_ListViewCustomization As ListViewCustomization)
|
||||
Dim _ConnectionString As String = ""
|
||||
Select Case _ListViewCustomization.SQLType
|
||||
Case eSQLType.MSSQL
|
||||
_ConnectionString = DevExpress.Xpo.DB.MSSqlConnectionProvider.GetConnectionString(_ListViewCustomization.SQLServer, _ListViewCustomization.SQLUser, _ListViewCustomization.SQLPassword, _ListViewCustomization.SQLDatabase)
|
||||
Case eSQLType.MySQL
|
||||
_ConnectionString = DevExpress.Xpo.DB.MySqlConnectionProvider.GetConnectionString(_ListViewCustomization.SQLServer, _ListViewCustomization.SQLUser, _ListViewCustomization.SQLPassword, _ListViewCustomization.SQLDatabase)
|
||||
Case eSQLType.PostgreSQL
|
||||
_ConnectionString = DevExpress.Xpo.DB.PostgreSqlConnectionProvider.GetConnectionString(_ListViewCustomization.SQLServer, _ListViewCustomization.SQLUser, _ListViewCustomization.SQLPassword, _ListViewCustomization.SQLDatabase)
|
||||
End Select
|
||||
|
||||
Return _ConnectionString
|
||||
End Function
|
||||
End Class
|
||||
Reference in New Issue
Block a user