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.Persistent.BaseImpl

Public Class FileDataProcess_VC
    Inherits DevExpress.ExpressApp.ViewController

    Public Sub New()
        MyBase.New()

        InitializeComponent()
        RegisterActions(components)

    End Sub

    Private Sub aShowFileData_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aShowFileData.Execute
        Try
            Dim _ocur As Xpo.XPObjectSpace = View.ObjectSpace

            Dim _FileData As FileData = TryCast(View.SelectedObjects(0), FileData)
            
            Dim _FileName As String = System.IO.Path.Combine(System.IO.Path.GetTempPath(), System.IO.Path.GetTempPath, _FileData.FileName)
            Dim _StreamFile As System.IO.Stream = New System.IO.FileStream(_FileName, System.IO.FileMode.Create)

            _FileData.SaveToStream(_StreamFile)
            _StreamFile.Close()
            Process.Start(_FileName)

        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.OkOnly)
        End Try
    End Sub
End Class
