Example #1
0
        private void SaveFile(string saveFileTitle, string defaultFileName, string outputFileExtention, string filter,
                              string resourceName)
        {
            var file = new FileSaveAsNotification()
            {
                Title                     = saveFileTitle,
                DefaultFileName           = defaultFileName,
                OutputFileExtention       = outputFileExtention,
                OutputFileExtentionFilter = filter,
            };

            FileSaveAsInteractionRequest.Raise(file);
            if (file.FileSaved)
            {
                var assembly = Assembly.GetExecutingAssembly();
                var stream   = assembly.GetManifestResourceStream(resourceName);
                if (stream == null)
                {
                    throw new Exception("Unable to get the file");
                }
                using (FileStream output = new FileStream(file.OutputFileName, FileMode.Create))
                {
                    stream.CopyTo(output);
                }
            }
        }
Example #2
0
        private void SaveFile(string saveFileTitle, string defaultFileName, string outputFileExtention, string filter)
        {
            var file = new FileSaveAsNotification()
            {
                Title                     = saveFileTitle,
                DefaultFileName           = defaultFileName,
                OutputFileExtention       = outputFileExtention,
                OutputFileExtentionFilter = filter,
            };

            SaveOutputRequest.Raise(file);
            if (file.FileSaved)
            {
                var outputFileName = file.OutputFileName;
                if (File.Exists(outputFileName))
                {
                    File.Delete(outputFileName);
                }
                WriteJournal(outputFileName);
                WritePreviousBalanceSheet(outputFileName);
                WriteBalanceSheet(outputFileName);
                WriteTrialBalance(outputFileName);
                WriteAccountDefinitions(outputFileName);
                WriteAccounts(outputFileName);
            }
        }