Exemplo n.º 1
0
        public DIYReport.ReportModel.RptReport CreateNewReport()
        {
            _DataObj = ReportIO.NewReport();
            DIYReport.UserDIY.DesignEnviroment.CurrentReport = _DataObj;

            iniNewReportDesign();

            DesignEnviroment.DesignHasChanged = false;
            return(_DataObj);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Method which copies files and folders from the source path and sends them to the destination path
        /// </summary>
        /// <param name="source">Source path</param>
        /// <param name="destination">Destination path</param>
        /// <param name="copySubDirs">Whether or not to copy sub directories</param>
        /// <param name="isRoot">Whether or not the current copy is at the root level</param>
        public static async Task Copy(Path source, Path destination, bool copySubDirs, bool isRoot)
        {
            Dictionary <FileDescription, byte[]> fileDescToBytesMapping = new Dictionary <FileDescription, byte[]>();
            List <DirectoryDescription>          subDirectories         = copySubDirs ? new List <DirectoryDescription>() : null;

            try
            {
                IFileTransferProvider provider = null;

                // Fetching process
                provider = await getProvider(source.Provider, source.UserAccount);

                await provider.Fetch(source, copySubDirs, fileDescToBytesMapping, subDirectories);

                // Dispatching process
                provider = await getProvider(destination.Provider, destination.UserAccount);

                await provider.Dispatch(destination, copySubDirs, fileDescToBytesMapping, subDirectories);

                fileDescToBytesMapping = null; // Dispose of files and bytes that have been used

                if (copySubDirs)
                {
                    CopySubDirs(source, destination, subDirectories, copySubDirs);
                }

                if (isRoot) // Once all the copies have been completed report the success
                {
                    ReportIO.WriteStatement("Backup between " + source.AbsolutePath + " and " + destination.AbsolutePath + " completed successfully.");
                }
            }
            catch (Exception e)
            {
                if (isRoot) // Report the error only at the root level, otherwise throw so root can catch
                {
                    ReportIO.WriteStatement("Backup between " + source.AbsolutePath + " and " + destination.AbsolutePath + " failed. Reason: " + e.Message);
                }
                else
                {
                    throw e;
                }
            }
        }