Zip for WPF and Silverlight
C1.C1Zip Namespace / C1ZipFile Class / Progress Event
Example

In This Topic
    Progress Event (C1ZipFile)
    In This Topic
    zip ファイルとの間でデータが読み書きされている間に発生します。
    Syntax
    'Declaration
     
    
    Public Event Progress As ZipProgressEventHandler
    public event ZipProgressEventHandler Progress
    Event Data

    The event handler receives an argument of type ZipProgressEventArgs containing data related to this event. The following ZipProgressEventArgs properties provide information specific to this event.

    PropertyDescription
    現在の操作をキャンセルする場合は true に設定します。  
    圧縮または展開されているファイルの長さを取得します。  
    圧縮または展開されているファイルの長さを取得します。  
    圧縮または展開されているファイルの名前を取得します。  
    ストリーム内の現在の位置を取得します。  
    ストリーム内の現在の位置を取得します。  
    Remarks
    通常、長い操作中にアプリケーションの UI を更新するために、このイベントを使用します。また、操作をキャンセルするために使用することもできます。
    Example
    以下のコードは、アプリケーションがファイルを圧縮している間に、出力ウィンドウに メッセージを書き込みます。
    private void Compress()
    {
    	// zip ファイルを作成します。
    	C1Zip zip = new C1Zip();
    	zip.Create(zipFileName);
                 
    	// イベントハンドラを接続します。
    	zip.Progress += new ZipProgressEventHandler(zip_Progress);
                 
    	// ファイルを追加します。
    	foreach (string fileName in Directory.GetFiles(path, "*.*"))
    		zip.Entries.Add(fileName);
    }
                 
    // ファイルの圧縮中にメッセージを出力します。
    private void zip_Progress(object sender, ZipProgressEventArgs e)
    {
    	Console.WriteLine("Compressing {0}, {1:p0} done",
    		e.FileName, e.Position/(float)e.FileLength);
    }
    See Also