Imports System.Collections.Generic Imports Infragistics.Win Imports Infragistics.Win.UltraWinSchedule Imports System.Diagnostics Private Function SaveOwnerDateSettings(ByVal owner As Owner) As Boolean If owner Is Nothing Then Return False Try Dim fileName As String = String.Empty Using fileDialog As SaveFileDialog = New SaveFileDialog() ' Show the SaveFileDialog to get the path from the user fileDialog.FileName = String.Empty fileDialog.Title = owner.Key If fileDialog.ShowDialog(Me) = System.Windows.Forms.DialogResult.OK Then fileName = fileDialog.FileName End Using If fileName.Length = 0 Then Return False Using stream As System.IO.FileStream = New FileStream(fileName, FileMode.OpenOrCreate, FileAccess.ReadWrite) owner.SaveDateSettings(stream) stream.Close() End Using Return True Catch Return False End Try End Function Private Function LoadOwnerDateSettings(ByVal owner As Owner) As Boolean If owner Is Nothing Then Return False Try Dim fileName As String = String.Empty Using fileDialog As OpenFileDialog = New OpenFileDialog() fileDialog.Title = owner.Key If (fileDialog.ShowDialog(Me) = System.Windows.Forms.DialogResult.OK) Then fileName = fileDialog.FileName End Using If fileName.Length = 0 Then Return False Using stream As FileStream = New FileStream(fileName, FileMode.Open, FileAccess.Read) owner.LoadDateSettings(stream) End Using Return True Catch Return False End Try End Function
using System.Collections.Generic; using Infragistics.Win; using Infragistics.Win.UltraWinSchedule; using System.Diagnostics; private bool SaveOwnerDateSettings( Owner owner ) { if ( owner == null ) return false; try { string fileName = string.Empty; using ( SaveFileDialog fileDialog = new SaveFileDialog() ) { // Show the SaveFileDialog to get the path from the user fileDialog.FileName = string.Empty; fileDialog.Title = owner.Key; if ( fileDialog.ShowDialog(this) == DialogResult.OK ) fileName = fileDialog.FileName; } if ( fileName.Length == 0 ) return false; using ( FileStream stream = new System.IO.FileStream(fileName, FileMode.OpenOrCreate, FileAccess.ReadWrite) ) { owner.SaveDateSettings( stream ); stream.Close(); } return true; } catch { return false; } } private bool LoadOwnerDateSettings( Owner owner ) { if ( owner == null ) return false; try { string fileName = string.Empty; using ( OpenFileDialog fileDialog = new OpenFileDialog() ) { fileDialog.Title = owner.Key; if ( fileDialog.ShowDialog(this) == DialogResult.OK ) fileName = fileDialog.FileName; } if ( fileName.Length == 0 ) return false; using ( FileStream stream = new System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read) ) { owner.LoadDateSettings( stream ); } return true; } catch { return false; } }
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2