private void Import(Stream file)
 {
     try
     {
         InvoiceXmlIxporter.Import(file, View.ObjectSpace, View.CollectionSource);
     }
     catch (ValidationException)
     {
         // User already saw an error message, so don't show a second one
     }
     catch (Exception ex)
     {
         WinApplication.Messaging.ShowExtendedException("Не удалось импортировать накладную", ex);
     }
 }
        private void ExportAction_Execute(object sender, SimpleActionExecuteEventArgs e)
        {
            var dialog = new System.Windows.Forms.SaveFileDialog()
            {
                DefaultExt = ".xml",
                Filter     = fileFilter
            };

            if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                using (var file = dialog.OpenFile())
                {
                    InvoiceXmlIxporter.Export(file, View.ObjectSpace, (Invoice)e.CurrentObject);
                }
            }
        }