Files
Nuvolar/Nuvolar.Module/BusinessObjects/GeneralObjects/Customers/CustomersFromVC.vb
T
2017-03-08 11:21:27 +01:00

70 lines
2.2 KiB
VB.net

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 Microsoft.VisualBasic
Imports DevExpress.ExpressApp.Editors
Imports DevExpress.Xpo
Public Class CustomersFromVC
Inherits DevExpress.ExpressApp.ViewController
Private detailViewCore As DetailView = Nothing
Public Sub New()
MyBase.New()
'This call is required by the Component Designer.
InitializeComponent()
RegisterActions(components)
TargetViewType = ViewType.DetailView
End Sub
Protected Overrides Sub OnActivated()
MyBase.OnActivated()
AddHandler View.ControlsCreated, AddressOf View_ControlsCreated
detailViewCore = CType(View, DetailView)
End Sub
Protected Overrides Sub OnViewControlsCreated()
MyBase.OnViewControlsCreated()
End Sub
Private Sub View_ControlsCreated(ByVal sender As Object, ByVal e As EventArgs)
On Error Resume Next
Dim _CustomersFrom As CustomersFrom
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
Dim item As ViewItem = detailViewCore.FindItem("CustomersFrom")
If item IsNot Nothing Then
Dim _CustomersFrom_Collection As New XPCollection(Of CustomersFrom)(_ocur.Session)
If _CustomersFrom_Collection.Count > 1 Then
Else
For Each _CustomersFrom In _CustomersFrom_Collection
item.CurrentObject.CustomersFrom = _CustomersFrom
Next
End If
End If
End Sub
'Private Function FindLayoutItemByControlHash(ByVal hash As Integer) As BaseLayoutItem
' For Each item As BaseLayoutItem In ((CType(detailViewCore.Control, LayoutControl))).Items
' If TypeOf item Is LayoutControlItem Then
' Dim lci As LayoutControlItem = CType(item, LayoutControlItem)
' If lci.Control.GetHashCode() = hash Then
' Return item
' End If
' End If
' Next item
' Return Nothing
'End Function
End Class