Imports EgtWPFLib5
Imports System.Windows
Imports System.Windows.Forms

Public Class OnlyProdEgtColorPickerV

#Region "FIELDS & PROPERTIES"

   Private WithEvents m_EgtColorPickerVM As EgtColorPickerVM

   Private Shadows DialogResult As DialogResult

   Public Property CustomColors As Integer()
      Get
         Return m_EgtColorPickerVM.GetCustomColors()
      End Get
      Set(value As Integer())
         m_EgtColorPickerVM.SetCustomColors(value)
      End Set
   End Property

   Public Property Color As System.Drawing.Color
      Get
         Return System.Drawing.Color.FromArgb(255, m_EgtColorPickerVM.Red, m_EgtColorPickerVM.Green, m_EgtColorPickerVM.Blue)
      End Get
      Set(value As System.Drawing.Color)
         m_EgtColorPickerVM.Red = value.R
         m_EgtColorPickerVM.Green = value.G
         m_EgtColorPickerVM.Blue = value.B
      End Set
   End Property

#End Region    ' Fields & Properties

#Region "CONTRUCTORS"

   Sub New(Owner As Window, EtgColorPickerVM As EgtColorPickerVM)
      MyBase.New(Owner)
      InitializeComponent()
      Me.DataContext = EtgColorPickerVM
      ' Assegno al riferimento locale al VM il VM preso dal DataContext
      m_EgtColorPickerVM = EtgColorPickerVM
   End Sub

#End Region    ' Constructors

#Region "EVENTS"

   Private Sub CloseWindow(DialogResult As MessageBoxResult) Handles m_EgtColorPickerVM.m_CloseWindow
      Me.DialogResult = DialogResult
      Me.Close()
   End Sub

#End Region     ' Events

#Region "METHODS"

   ''' <summary>
   ''' Apre una finestra EgtColorPicker
   ''' </summary>
   ''' <returns></returns>
   Public Overloads Function ShowDialog() As DialogResult
      MyBase.ShowDialog()
      Return Me.DialogResult
   End Function

#End Region    ' Methods

End Class
