Example #1
0
        private async void OpenButton_OnClick(object sender, RoutedEventArgs e)
        {
            if (m_textFile.IsDirty)
            {
                var answer = MessageBox.Show(this, "Current text file has not been saved yet. Do you want to proceed anyway?",
                                             "File is not saved!", MessageBoxButton.YesNo, MessageBoxImage.Warning);
                if (answer == MessageBoxResult.Yes)
                {
                    m_textFile.IsDirty = false;
                }
                else
                {
                    await SavingEntrails();
                }
            }

            try
            {
                var loadDialog = new LoadFileDialog(m_repository);
                loadDialog.ShowDialog();
                LoadTextFile(loadDialog.SelectedFileId);
            }
            catch (Exception exc)
            {
                MessageBox.Show(this, exc.Message + "\n" + exc.StackTrace, "Exception on opening another text file",
                                MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Example #2
0
		private async void OpenButton_OnClick(object sender, RoutedEventArgs e)
		{
			if (m_textFile.IsDirty)
			{
				var answer = MessageBox.Show(this, "Current text file has not been saved yet. Do you want to proceed anyway?",
					"File is not saved!", MessageBoxButton.YesNo, MessageBoxImage.Warning);
				if (answer == MessageBoxResult.Yes)
				{
					m_textFile.IsDirty = false;
				}
				else
				{
					await SavingEntrails();
				}
			}

			try
			{
				var loadDialog = new LoadFileDialog(m_repository);
				loadDialog.ShowDialog();
				LoadTextFile(loadDialog.SelectedFileId);
			}
			catch (Exception exc)
			{
				MessageBox.Show(this, exc.Message + "\n" + exc.StackTrace, "Exception on opening another text file",
					MessageBoxButton.OK, MessageBoxImage.Error);
			}
		}