2011-06-01 15 views
6

毎回保存ダイアログボックスを使用する必要がなく、特定の期間内に呼び出すことができるListViewの詳細を保存する方法はありますか?毎回「保存」するのではなく、「保存する」。自動保存 - WPF C#

答えて

6

保存を実行するメソッドへのコールバックとともにDispatchTimerを使用できます。

DispatcherTimer autosaveTimer = new DispatcherTimer(TimeSpan.FromSeconds(autosaveInterval), DispatcherPriority.Background, new EventHandler(DoAutoSave), Application.Current.Dispatcher); 

    private void DoAutoSave(object sender, EventArgs e) 
    { 
     // Enter save logic here... 
    }