Exemple #1
0
        private async void SaveAsMenuClick(object sender, ExecutedRoutedEventArgs e)
        {
            SaveFileDialog sfd = new SaveFileDialog
            {
                Filter = "(Текстовые файлы)|*.txt"
            };

            if (sfd.ShowDialog() == true)
            {
                pathToFile = sfd.FileName;
                labelPathToFile.Content = pathToFile;
            }
            else
            {
                return;
            }

            try
            {
                matrix.ArrE.GiveMeMatrixFromTextBox(richTextBoxE);
                matrix.ArrK.GiveMeMatrixFromTextBox(richTextBoxK);

                await Task.Factory.StartNew(() => WorkWithFiles.SaveMatrixAs(pathToFile, matrix));
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Exemple #2
0
        private async void SaveMenuClick(object sender, ExecutedRoutedEventArgs e)
        {
            if (pathToFile != null)
            {
                try
                {
                    matrix.ArrE.GiveMeMatrixFromTextBox(richTextBoxE);
                    matrix.ArrK.GiveMeMatrixFromTextBox(richTextBoxK);

                    await Task.Factory.StartNew(() => WorkWithFiles.SaveMatrixAs(pathToFile, matrix));
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
            else
            {
                SaveAsMenuClick(sender, e);
            }
        }