private void LoadFolders() { txtMessage.Text = $"{Properties.Resources.txtMessageSearch}\n{location}"; txtLocation.IsEnabled = false; btnFilePicker.IsEnabled = false; LoadFoldersDelegate load_folders = ((string path) => { FSDataContainer newRoot = new FSDataContainer(path); return(newRoot); }); load_folders.BeginInvoke(location, FoldersLoaded, this); }
private void FoldersLoaded(IAsyncResult theResults) { AsyncResult results = (AsyncResult)theResults; LoadFoldersDelegate source = (LoadFoldersDelegate)results.AsyncDelegate; this.Dispatcher.Invoke(DispatcherPriority.Background, (Action)(() => { root = source.EndInvoke(results); tvDirectory.Items.Refresh(); txtMessage.Text = $"{Properties.Resources.txtMessageDone}\n{location}"; txtLocation.IsEnabled = true; btnFilePicker.IsEnabled = true; })); }