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

Public Class ProductsDocumentations_VC
	Inherits DevExpress.ExpressApp.ViewController

	Public Sub New()
		MyBase.New()
        InitializeComponent()
		RegisterActions(components) 
    End Sub

    Private Sub aProductsDocumentations_OpenProductGroupFolder_Execute(sender As Object, e As SimpleActionExecuteEventArgs) Handles aProductsDocumentations_OpenProductGroupFolder.Execute
        Try
            Dim _DefaultFolder As String = TryCast(Application.Model.Options, IModelOptionsExtender).DefaultproductsFileFolder
            Dim _Products As Products = TryCast(TryCast(TryCast(View, ListView).CollectionSource, PropertyCollectionSource).MasterObject, Products)
            If _Products Is Nothing Then Throw New Exception("*Váratlan hiba történt, a folyamat megszakadt!")

            If System.IO.Directory.Exists(_DefaultFolder + _Products.ProductGroups.ShortName) Then
                Process.Start("explorer.exe", _DefaultFolder + _Products.ProductGroups.ShortName)
            Else
                System.IO.Directory.CreateDirectory(_DefaultFolder + _Products.ProductGroups.ShortName)
                Process.Start("explorer.exe", _DefaultFolder + _Products.ProductGroups.ShortName)
            End If
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, "Hiba!")
        End Try
    End Sub
End Class
