Esempio n. 1
0
        public void ConvertFilesAsync(string sourcePath, string destinationPath)
        {
            sourcePath      = Extensions.CheckDirectorySeparator(sourcePath);
            destinationPath = Extensions.CheckDirectorySeparator(destinationPath);
            var worker            = new ConvertFilesDelegate(ConvertFiles);
            var completedCallback = new AsyncCallback(ConversionCompletedCallback);

            lock (_syncCancel)
            {
                if (_isBusy)
                {
                    throw new InvalidOperationException("The control is currently busy.");
                }

                var  async   = AsyncOperationManager.CreateOperation(null);
                var  context = new CancellableContext(async);
                bool cancelled;

                worker.BeginInvoke(sourcePath, destinationPath, context, out cancelled, completedCallback, async);

                _isBusy = true;
                _convertFilesContext = context;
            }
        }
Esempio n. 2
0
        public void ConvertFilesAsync(string sourcePath, string destinationPath)
        {
            sourcePath = Extensions.CheckDirectorySeparator(sourcePath);
            destinationPath = Extensions.CheckDirectorySeparator(destinationPath);
            var worker = new ConvertFilesDelegate(ConvertFiles);
            var completedCallback = new AsyncCallback(ConversionCompletedCallback);

            lock (_syncCancel)
            {
                if (_isBusy)
                    throw new InvalidOperationException("The control is currently busy.");

                var async = AsyncOperationManager.CreateOperation(null);
                var context = new CancellableContext(async);
                bool cancelled;

                worker.BeginInvoke(sourcePath, destinationPath, context, out cancelled, completedCallback, async);

                _isBusy = true;
                _convertFilesContext = context;
            }
        }