Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Auto save - WPF C#

Tags:

c#

wpf

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.

like image 800
carsey88 Avatar asked Jun 01 '11 13:06

carsey88


1 Answers

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...
    }
like image 124
Greg Andora Avatar answered Oct 20 '22 22:10

Greg Andora