Пример #1
0
        private static void OnDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
        {
            if (e.Exception is NotImplementedException)
            {
                ExclamationBox.Show("The requested feature has unfortunately not yet been implemented.");

                e.Handled = true;
            }
        }
Пример #2
0
        private void ExportCommand_OnExecuted(object sender, ExecutedRoutedEventArgs eventArgs)
        {
            var dialog = new SaveFileDialog
            {
                FileName = Document.Name + ".xlsx",
                Filter   = "Excel files (*.xlsx)|*.xlsx|All Files (*.*)|*.*"
            };

            if (dialog.ShowDialog() == true)
            {
                var file = new FileInfo(dialog.FileName);
                if (file.Exists)
                {
                    try
                    {
                        file.Delete();
                    }
                    catch (Exception exception)
                    {
                        ExclamationBox.Show(exception.Message);
                        return;
                    }
                }

                var viewModel = (ExportViewModel)DataContext;
                var cultures  = viewModel.Languages.
                                Where(l => l.IsSelected).
                                Select(l => l.Culture).
                                ToArray();

                var rows = ExportProvider.GetRows(cultures, viewModel.ScopeSelection);

                _excelFileWriter.CreateFile(file, rows);

                CloseControl();
            }
        }
Пример #3
0
        private static void DisplayFileFormatWarning(string fileName)
        {
            var message = string.Format(Strings.FileLoad_InvalidFileFormat, fileName);

            ExclamationBox.Show(message);
        }