/// <summary> /// Allow user to load xml file. User is prompted to save unsaved graph /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MenuOpen_Click(object sender, RoutedEventArgs e) { if (!MainCanvas.IsEmpty()) { MessageBoxResult result = MessageBox.Show("Would you like to save the current graph before openning a new one?", "Current graph is not saved!", MessageBoxButton.YesNoCancel, MessageBoxImage.Warning); if (result == MessageBoxResult.Yes) { SaveToFile(); graph.Clear(); MainCanvas.Children.Clear(); OpenFromFile(); } else if (result == MessageBoxResult.No) { OpenFromFile(); } else if (result == MessageBoxResult.Cancel) { // do nothing } } else { OpenFromFile(); } }