private void buttonClearCache_Click(object sender, RoutedEventArgs e) { bool flag = true; string str = ""; TrainsCacheStorage storage = new TrainsCacheStorage(); if (!storage.Clear()) { flag = false; str = str + string.Format("\n\r {0}", storage.LastError); } TrainGraphCacheStorage storage2 = new TrainGraphCacheStorage(); if (!storage2.Clear()) { flag = false; str = str + string.Format("\n\r {0}", storage2.LastError); } LayoutCacheStorage storage3 = new LayoutCacheStorage(); if (!storage3.Clear()) { flag = false; str = str + string.Format("\n\r {0}", storage3.LastError); } if (flag) { MessageBox.Show("Cache removed successfully"); } else { MessageBox.Show("Cache removing failed..." + str); } }