Files
SISBusiness/SISBusiness.Module.Win/BusinessObjects/GeneralObjects/Customers/CustomersVC.vb
T
2017-03-26 20:00:03 +02:00

74 lines
2.9 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 DevExpress.ExpressApp.Editors
Imports System.Windows.Forms
Imports DevExpress.Data.Filtering
Imports DevExpress.Persistent.BaseImpl
Public Class CustomersVC
Inherits SISBusiness.Module.CustomersVC
Dim _WaitFormClass As New WaitFormClass
Public Sub New()
MyBase.New()
'This call is required by the Component Designer.
InitializeComponent()
RegisterActions(components)
End Sub
Protected Overloads Overrides Sub OnActivated()
MyBase.OnActivated()
AddHandler DoWork, AddressOf _WaitFormClass.DoWork
AddHandler InitWork, AddressOf _WaitFormClass.Initwork
AddHandler FinalWork, AddressOf _WaitFormClass.Finalwork
If View.Id = "Customers_DetailView" Then
For Each editor As PropertyEditor In (CType(View, DetailView)).GetItems(Of PropertyEditor)()
If editor.PropertyName = "Name" Then
AddHandler editor.ControlCreated, AddressOf editor_ControlCreated
Exit For
End If
Next editor
End If
End Sub
Protected Overrides Sub OnDeactivated()
MyBase.OnDeactivated()
RemoveHandler DoWork, AddressOf _WaitFormClass.DoWork
RemoveHandler InitWork, AddressOf _WaitFormClass.Initwork
RemoveHandler FinalWork, AddressOf _WaitFormClass.Finalwork
End Sub
Private Sub editor_ControlCreated(ByVal sender As Object, ByVal e As EventArgs)
' You can access the corresponding property editor control by the following code:
Dim editorControl As Control = TryCast((CType(sender, PropertyEditor)).Control, Control)
AddHandler editorControl.HandleCreated, AddressOf editorControl_HandleCreated
Dim _Name As DevExpress.XtraEditors.TextEdit = TryCast(editorControl, DevExpress.XtraEditors.TextEdit)
If _Name IsNot Nothing Then
AddHandler _Name.LostFocus, AddressOf Name_LostFocus
End If
End Sub
Private Sub editorControl_HandleCreated(ByVal sender As Object, ByVal e As EventArgs)
' Sometimes it is necessary to access editor's control after it is visible (its handle is created).
RemoveHandler (CType(sender, Control)).HandleCreated, AddressOf editorControl_HandleCreated
End Sub
Private Sub Name_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs)
On Error Resume Next
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
Dim _Customers = TryCast(View.SelectedObjects(0), Customers)
If _Customers IsNot Nothing Then
If _Customers.FullName = "" Then _Customers.FullName = sender.text
End If
End Sub
End Class