简体   繁体   中英

Auto save - WPF C#

Is there a way in which I can save details from a ListView that doesnt require me to use the save dialog box everytime and allows me to call it within a certain time span. So 'save' rather than 'save as' everytime.

You can use a DispatchTimer with a callback to a method to perform your save.

    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...
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM