自动保存-WPF C#

自动保存-WPF C#,c#,wpf,C#,Wpf,是否有一种方法可以保存ListView中的详细信息,而不需要我每次都使用“保存”对话框,并允许我在特定时间范围内调用它。所以每次都是“保存”而不是“另存为” 您可以使用带有方法回调的DispatchTimer来执行保存 DispatcherTimer autosaveTimer = new DispatcherTimer(TimeSpan.FromSeconds(autosaveInterval), DispatcherPriority.Background, new EventHand

是否有一种方法可以保存ListView中的详细信息,而不需要我每次都使用“保存”对话框,并允许我在特定时间范围内调用它。所以每次都是“保存”而不是“另存为”

您可以使用带有方法回调的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...
    }