Mini Kabibi Habibi
Imports Microsoft.VisualBasic
Imports System
Imports System.Drawing
Imports System.Windows.Forms
Imports DevExpress.ExpressApp.Editors
Imports DevExpress.ExpressApp.Model
Imports DevExpress.ExpressApp.Win.Utils
Imports DevExpress.ExpressApp.Win.Templates
Partial Public Class LookupForm
Inherits XtraFormTemplateBase
Implements ILookupPopupFrameTemplate
Private Const minWidth As Integer = 420
Private Const minHeight As Integer = 150
Private frameTemplate As LookupControlTemplate
Protected Overrides Function GetFormStateNode() As IModelFormState
If View IsNot Nothing Then
Return TemplatesHelper.GetFormStateNode(View.Id)
Else
Return MyBase.GetFormStateNode()
End If
End Function
Protected Overrides Sub OnShown(ByVal e As EventArgs)
MyBase.OnShown(e)
' B31321
If frameTemplate.IsSearchEnabled Then
frameTemplate.FindEditor.Focus()
End If
End Sub
Public Overrides Sub SetSettings(ByVal modelTemplate As IModelTemplate)
MyBase.SetSettings(modelTemplate)
formStateModelSynchronizerComponent.Model = GetFormStateNode()
End Sub
Public Sub New()
InitializeComponent()
MinimumSize = New Size(minWidth, minHeight)
StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
NativeMethods.SetExecutingApplicationIcon(Me)
ShowInTaskbar = True
KeyPreview = True
frameTemplate = New LookupControlTemplate()
Controls.Add(frameTemplate)
frameTemplate.Dock = DockStyle.Fill
actionsContainersManager.ActionContainerComponents.AddRange(frameTemplate.GetContainers())
actionsContainersManager.DefaultContainer = frameTemplate.DefaultContainer
viewSiteManager.ViewSiteControl = CType(frameTemplate.ViewSiteControl, Control)
End Sub
Public Overrides Sub SetView(ByVal view As DevExpress.ExpressApp.View)
frameTemplate.SetView(view)
Dim nonClientWidth As Integer = Size.Width - ClientSize.Width
Dim nonClientHeight As Integer = Size.Height - ClientSize.Height
ClientSize = frameTemplate.PreferredSize
MinimumSize = New Size(Math.Max(frameTemplate.MinimumSize.Width + nonClientWidth, minWidth), Math.Max(frameTemplate.MinimumSize.Height + nonClientHeight, minHeight))
End Sub
Protected Overrides ReadOnly Property RibbonFormStyle() As DevExpress.XtraBars.Ribbon.RibbonFormStyle
Get
Return DevExpress.XtraBars.Ribbon.RibbonFormStyle.Standard
End Get
End Property
#Region "ILookupPopupFrameTemplate Members"
Public Sub SetStartSearchString(ByVal searchString As String) Implements ILookupPopupFrameTemplate.SetStartSearchString
frameTemplate.SetStartSearchString(searchString)
End Sub
Public Property IsSearchEnabled() As Boolean Implements ILookupPopupFrameTemplate.IsSearchEnabled
Get
Return frameTemplate.IsSearchEnabled
End Get
Set(ByVal value As Boolean)
frameTemplate.IsSearchEnabled = value
End Set
End Property
#End Region
End Class