バージョン

LoadDateSettings メソッド

DateSettingsDayOfWeekSettings および RecurringDateSettings コレクションの内容を指定したストリムのデータから初期化します。
シンタックス
'宣言
 
Public Sub LoadDateSettings( _
   ByVal stream As Stream _
) 
public void LoadDateSettings( 
   Stream stream
)

パラメータ

stream
データがシリアル化される System.IO.Stream
使用例
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;
        }
    }
参照