コード例 #1
0
 public virtual async Task CopyAsync(string DirectoryPath, CollisionOptions Option = CollisionOptions.None, ProgressChangedEventHandler ProgressHandler = null)
 {
     using (FullTrustProcessController.ExclusiveUsage Exclusive = await FullTrustProcessController.GetAvailableController())
     {
         await Exclusive.Controller.CopyAsync(Path, DirectoryPath, Option, false, ProgressHandler);
     }
 }
コード例 #2
0
        /// <inheritdoc/>
        public async Task <IStorageFolder> CreateFolderAsync(string name, CollisionOptions options = CollisionOptions.OpenExisting)
        {
            var info = new DirectoryInfo(Path.Combine(Directory.FullName, name));

            if (info.Exists && options != CollisionOptions.Overwrite)
            {
                if (options == CollisionOptions.FailIfExists)
                {
                    throw new StorageAccessException($"The requested folder {name} already exists.");
                }
                else if (options == CollisionOptions.OpenExisting)
                {
                    return(new BaseFolder(info));
                }
                else if (options == CollisionOptions.RenameIfExists)
                {
                    int num = 1;
                    while (info.Exists)
                    {
                        info = new DirectoryInfo(Path.Combine(Directory.FullName, $"{name}_{num}"));
                        num++;
                    }
                    return(new BaseFolder(info));
                }
                else
                {
                    throw new StorageAccessException($"The given overwrite behavior {options} is not supported by BaseFolder.");
                }
            }
            else
            {
                info.Create();
                return(new BaseFolder(info));
            }
        }
コード例 #3
0
        public static CreationCollisionOption ToUwp(this CollisionOptions options)
        {
            switch (options)
            {
            case CollisionOptions.FailIfExists:
                return(CreationCollisionOption.FailIfExists);

            case CollisionOptions.OpenExisting:
                return(CreationCollisionOption.OpenIfExists);

            case CollisionOptions.Overwrite:
                return(CreationCollisionOption.ReplaceExisting);

            case CollisionOptions.RenameIfExists:
                return(CreationCollisionOption.GenerateUniqueName);

            default:
                throw new StorageAccessException($"Failed to find the CreationCollisionOption to deal with file collisions for {options}");
            }
        }
コード例 #4
0
        /// <inheritdoc/>
        public async Task <IStorageFile> CreateFileAsync(string name, CollisionOptions options = CollisionOptions.OpenExisting)
        {
            var info = new FileInfo(Path.Combine(Directory.FullName, name));

            if (info.Exists && options != CollisionOptions.Overwrite)
            {
                if (options == CollisionOptions.FailIfExists)
                {
                    throw new StorageAccessException($"The requested file {name} already exists.");
                }
                else if (options == CollisionOptions.OpenExisting)
                {
                    return(new BaseFile(info));
                }
                else if (options == CollisionOptions.RenameIfExists)
                {
                    int num = 1;
                    while (info.Exists)
                    {
                        info = new FileInfo(Path.Combine(Directory.FullName, $"{name}_{num}"));
                        num++;
                    }
                    return(new BaseFile(info));
                }
                else
                {
                    throw new StorageAccessException($"The given overwrite behavior {options} is not supported by BaseFolder.");
                }
            }
            else
            {
                using (var stream = info.CreateText())
                {
                    await stream.WriteAsync(string.Empty);

                    await stream.FlushAsync();
                }
                return(new BaseFile(info));
            }
        }
コード例 #5
0
 /// <inheritdoc/>
 public async Task <IStorageFolder> CreateFolderAsync(string name, CollisionOptions options = CollisionOptions.OpenExisting)
 {
     return(new UwpFolder(await Folder.CreateFolderAsync(name, options.ToUwp())));
 }
コード例 #6
0
        /// <summary>
        /// Copies the contents of the given <see cref="IStorageFile"/> into a new file located in the specified <see cref="IStorageFolder"/>, and then removes the source file.
        /// </summary>
        /// <param name="file">The existing file whose contents should be read.</param>
        /// <param name="destination">The destination folder to copy the <see cref="IStorageFile"/> into.</param>
        /// <param name="collisionOptions">Overrides the <see cref="CollisionOptions"/> behavior when creating the new file in the <paramref name="destination"/> folder.</param>
        /// <param name="fileName">Overrides the name of the destination file (default is <see cref="IStorageItem.Name"/> of the source <paramref name="file"/>).</param>
        public static async Task <IStorageFile> MoveToAsync(this IStorageFile file, IStorageFolder destination, CollisionOptions collisionOptions = CollisionOptions.RenameIfExists, string fileName = null)
        {
            IStorageFile destinationFile = await destination.CreateFileAsync(fileName ?? file.Name, collisionOptions);

            await CopyContentsAsync(file, destinationFile);

            await file.RemoveAsync();

            return(destinationFile);
        }
コード例 #7
0
        /// <summary>
        /// Copies the contents of the given <see cref="IStorageFolder"/> into a new folder located in the specified <see cref="IStorageFolder"/>, and then removes the source folder.
        /// </summary>
        /// <param name="folder">The existing folder whose contents should be read.</param>
        /// <param name="destination">The destination folder to copy the <see cref="IStorageFile"/> into.</param>
        /// <param name="collisionOptions">Overrides the <see cref="CollisionOptions"/> behavior when creating the new file in the <paramref name="destination"/> folder.</param>
        /// <param name="folderName">Overrides the name of the destination file (default is <see cref="IStorageItem.Name"/> of the source <paramref name="folder"/>).</param>
        public static async Task <IStorageFolder> MoveToAsync(this IStorageFolder folder, IStorageFolder destination, CollisionOptions collisionOptions = CollisionOptions.RenameIfExists, string folderName = null)
        {
            IStorageFolder destinationFolder = await destination.CreateFolderAsync(folderName ?? folder.Name, collisionOptions);

            await CopyContentsAsync(folder, destinationFolder);

            await folder.RemoveAsync();

            return(destinationFolder);
        }
コード例 #8
0
        private static void ExecuteSubTaskCore(OperationListBaseModel Model)
        {
            Interlocked.Increment(ref RunningTaskCounter);

            try
            {
                CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
                {
                    Model.UpdateStatus(OperationStatus.Preparing);
                }).AsTask().Wait();

                Model.PrepareSizeDataAsync().Wait();

                CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
                {
                    Model.UpdateStatus(OperationStatus.Processing);
                    Model.UpdateProgress(0);
                }).AsTask().Wait();

                switch (Model)
                {
                case OperationListRemoteModel:
                {
                    using (FullTrustProcessController.ExclusiveUsage Exclusive = FullTrustProcessController.GetAvailableController().Result)
                    {
                        if (!Exclusive.Controller.PasteRemoteFile(Model.ToPath).Result)
                        {
                            CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
                                {
                                    Model.UpdateStatus(OperationStatus.Error, Globalization.GetString("QueueDialog_CopyFailUnexpectError_Content"));
                                }).AsTask().Wait();
                        }
                    }

                    break;
                }

                case OperationListCopyModel:
                {
                    try
                    {
                        CollisionOptions Option = CollisionOptions.None;

                        if (Model.FromPath.All((Item) => Path.GetDirectoryName(Item).Equals(Model.ToPath, StringComparison.OrdinalIgnoreCase)))
                        {
                            Option = CollisionOptions.RenameOnCollision;
                        }
                        else if (Model.FromPath.Select((SourcePath) => Path.Combine(Model.ToPath, Path.GetFileName(SourcePath)))
                                 .Any((DestPath) => FileSystemStorageItemBase.CheckExistAsync(DestPath).Result))
                        {
                            CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
                                {
                                    Model.UpdateStatus(OperationStatus.NeedAttention, Globalization.GetString("NameCollision"));
                                }).AsTask().Wait();

                            switch (Model.WaitForButtonAction())
                            {
                            case 0:
                            {
                                Option = CollisionOptions.OverrideOnCollision;
                                break;
                            }

                            case 1:
                            {
                                Option = CollisionOptions.RenameOnCollision;
                                break;
                            }
                            }
                        }

                        if (Model.Status == OperationStatus.Cancelled)
                        {
                            return;
                        }

                        using (FullTrustProcessController.ExclusiveUsage Exclusive = FullTrustProcessController.GetAvailableController().Result)
                        {
                            Exclusive.Controller.CopyAsync(Model.FromPath, Model.ToPath, Option, ProgressHandler: (s, e) =>
                                {
                                    CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
                                    {
                                        Model.UpdateProgress(e.ProgressPercentage);
                                    }).AsTask().Wait();
                                }).Wait();
                        }
                    }
                    catch (AggregateException Ae) when(Ae.InnerException is FileNotFoundException)
                    {
                        CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
                            {
                                Model.UpdateStatus(OperationStatus.Error, Globalization.GetString("QueueDialog_CopyFailForNotExist_Content"));
                            }).AsTask().Wait();
                    }
                    catch (AggregateException Ae) when(Ae.InnerException is InvalidOperationException)
                    {
                        CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
                            {
                                Model.UpdateStatus(OperationStatus.Error, Globalization.GetString("QueueDialog_UnauthorizedPaste_Content"));
                            }).AsTask().Wait();
                    }
                    catch (Exception ex)
                    {
                        LogTracer.Log(ex, "Copy failed for unexpected error");

                        CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
                            {
                                Model.UpdateStatus(OperationStatus.Error, Globalization.GetString("QueueDialog_CopyFailUnexpectError_Content"));
                            }).AsTask().Wait();
                    }

                    break;
                }

                case OperationListMoveModel:
                {
                    try
                    {
                        CollisionOptions Option = CollisionOptions.None;

                        if (Model.FromPath.Select((SourcePath) => Path.Combine(Model.ToPath, Path.GetFileName(SourcePath)))
                            .Any((DestPath) => FileSystemStorageItemBase.CheckExistAsync(DestPath).Result))
                        {
                            CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
                                {
                                    Model.UpdateStatus(OperationStatus.NeedAttention, Globalization.GetString("NameCollision"));
                                }).AsTask().Wait();

                            switch (Model.WaitForButtonAction())
                            {
                            case 0:
                            {
                                Option = CollisionOptions.OverrideOnCollision;
                                break;
                            }

                            case 1:
                            {
                                Option = CollisionOptions.RenameOnCollision;
                                break;
                            }
                            }
                        }

                        if (Model.Status == OperationStatus.Cancelled)
                        {
                            return;
                        }

                        using (FullTrustProcessController.ExclusiveUsage Exclusive = FullTrustProcessController.GetAvailableController().Result)
                        {
                            Exclusive.Controller.MoveAsync(Model.FromPath, Model.ToPath, Option, ProgressHandler: (s, e) =>
                                {
                                    CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
                                    {
                                        Model.UpdateProgress(e.ProgressPercentage);
                                    }).AsTask().Wait();
                                }).Wait();
                        }
                    }
                    catch (AggregateException Ae) when(Ae.InnerException is FileNotFoundException)
                    {
                        CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
                            {
                                Model.UpdateStatus(OperationStatus.Error, Globalization.GetString("QueueDialog_MoveFailForNotExist_Content"));
                            }).AsTask().Wait();
                    }
                    catch (AggregateException Ae) when(Ae.InnerException is FileCaputureException)
                    {
                        CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
                            {
                                Model.UpdateStatus(OperationStatus.Error, Globalization.GetString("QueueDialog_Item_Captured_Content"));
                            }).AsTask().Wait();
                    }
                    catch (AggregateException Ae) when(Ae.InnerException is InvalidOperationException)
                    {
                        CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
                            {
                                Model.UpdateStatus(OperationStatus.Error, Globalization.GetString("QueueDialog_UnauthorizedPaste_Content"));
                            }).AsTask().Wait();
                    }
                    catch (Exception ex)
                    {
                        LogTracer.Log(ex, "Move failed for unexpected error");

                        CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
                            {
                                Model.UpdateStatus(OperationStatus.Error, Globalization.GetString("QueueDialog_MoveFailUnexpectError_Content"));
                            }).AsTask().Wait();
                    }

                    break;
                }

                case OperationListDeleteModel DeleteModel:
                {
                    try
                    {
                        using (FullTrustProcessController.ExclusiveUsage Exclusive = FullTrustProcessController.GetAvailableController().Result)
                        {
                            Exclusive.Controller.DeleteAsync(DeleteModel.FromPath, DeleteModel.IsPermanentDelete, (s, e) =>
                                {
                                    CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
                                    {
                                        Model.UpdateProgress(e.ProgressPercentage);
                                    }).AsTask().Wait();
                                }).Wait();
                        }
                    }
                    catch (AggregateException Ae) when(Ae.InnerException is FileNotFoundException)
                    {
                        CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
                            {
                                Model.UpdateStatus(OperationStatus.Error, Globalization.GetString("QueueDialog_DeleteItemError_Content"));
                            }).AsTask().Wait();
                    }
                    catch (AggregateException Ae) when(Ae.InnerException is FileCaputureException)
                    {
                        CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
                            {
                                Model.UpdateStatus(OperationStatus.Error, Globalization.GetString("QueueDialog_Item_Captured_Content"));
                            }).AsTask().Wait();
                    }
                    catch (AggregateException Ae) when(Ae.InnerException is InvalidOperationException)
                    {
                        CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
                            {
                                Model.UpdateStatus(OperationStatus.Error, Globalization.GetString("QueueDialog_UnauthorizedDelete_Content"));
                            }).AsTask().Wait();
                    }
                    catch (Exception ex)
                    {
                        LogTracer.Log(ex, "Delete failed for unexpected error");

                        CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
                            {
                                Model.UpdateStatus(OperationStatus.Error, Globalization.GetString("QueueDialog_DeleteFailUnexpectError_Content"));
                            }).AsTask().Wait();
                    }

                    break;
                }

                case OperationListUndoModel UndoModel:
                {
                    try
                    {
                        using (FullTrustProcessController.ExclusiveUsage Exclusive = FullTrustProcessController.GetAvailableController().Result)
                        {
                            switch (UndoModel.UndoOperationKind)
                            {
                            case OperationKind.Copy:
                            {
                                Exclusive.Controller.DeleteAsync(Model.FromPath, true, (s, e) =>
                                        {
                                            CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
                                            {
                                                Model.UpdateProgress(e.ProgressPercentage);
                                            }).AsTask().Wait();
                                        }).Wait();

                                break;
                            }

                            case OperationKind.Move:
                            {
                                Exclusive.Controller.MoveAsync(Model.FromPath, Model.ToPath, IsUndoOperation: true, ProgressHandler: (s, e) =>
                                        {
                                            CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
                                            {
                                                Model.UpdateProgress(e.ProgressPercentage);
                                            }).AsTask().Wait();
                                        }).Wait();

                                break;
                            }

                            case OperationKind.Delete:
                            {
                                if (!Exclusive.Controller.RestoreItemInRecycleBinAsync(Model.FromPath).Result)
                                {
                                    throw new Exception();
                                }

                                break;
                            }
                            }
                        }
                    }
                    catch (AggregateException Ae) when(Ae.InnerException is FileNotFoundException)
                    {
                        CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
                            {
                                Model.UpdateStatus(OperationStatus.Error, Globalization.GetString("QueueDialog_UndoFailForNotExist_Content"));
                            }).AsTask().Wait();
                    }
                    catch (AggregateException Ae) when(Ae.InnerException is FileCaputureException)
                    {
                        CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
                            {
                                Model.UpdateStatus(OperationStatus.Error, Globalization.GetString("QueueDialog_Item_Captured_Content"));
                            }).AsTask().Wait();
                    }
                    catch (AggregateException Ae) when(Ae.InnerException is InvalidOperationException)
                    {
                        CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
                            {
                                Model.UpdateStatus(OperationStatus.Error, Globalization.GetString("QueueDialog_UnauthorizedUndo_Content"));
                            }).AsTask().Wait();
                    }
                    catch (Exception ex)
                    {
                        LogTracer.Log(ex, "Undo failed for unexpected error");

                        CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
                            {
                                Model.UpdateStatus(OperationStatus.Error, Globalization.GetString("QueueDialog_UndoFailure_Content"));
                            }).AsTask().Wait();
                    }

                    break;
                }

                case OperationListCompressionModel CModel:
                {
                    try
                    {
                        CompressionUtil.SetEncoding(Encoding.Default);

                        switch (CModel.Type)
                        {
                        case CompressionType.Zip:
                        {
                            CompressionUtil.CreateZipAsync(CModel.FromPath, CModel.ToPath, CModel.Level, CModel.Algorithm, (s, e) =>
                                    {
                                        CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
                                        {
                                            Model.UpdateProgress(e.ProgressPercentage);
                                        }).AsTask().Wait();
                                    }).Wait();

                            break;
                        }

                        case CompressionType.Tar:
                        {
                            CompressionUtil.CreateTarAsync(CModel.FromPath, CModel.ToPath, CModel.Level, CModel.Algorithm, (s, e) =>
                                    {
                                        CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
                                        {
                                            Model.UpdateProgress(e.ProgressPercentage);
                                        }).AsTask().Wait();
                                    }).Wait();

                            break;
                        }

                        case CompressionType.Gzip:
                        {
                            if (CModel.FromPath.Length == 1)
                            {
                                CompressionUtil.CreateGzipAsync(CModel.FromPath.First(), CModel.ToPath, CModel.Level, (s, e) =>
                                        {
                                            CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
                                            {
                                                Model.UpdateProgress(e.ProgressPercentage);
                                            }).AsTask().Wait();
                                        }).Wait();
                            }
                            else
                            {
                                throw new ArgumentException("Gzip could not contains more than one item");
                            }

                            break;
                        }

                        case CompressionType.BZip2:
                        {
                            if (CModel.FromPath.Length == 1)
                            {
                                CompressionUtil.CreateBZip2Async(CModel.FromPath.First(), CModel.ToPath, (s, e) =>
                                        {
                                            CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
                                            {
                                                Model.UpdateProgress(e.ProgressPercentage);
                                            }).AsTask().Wait();
                                        }).Wait();
                            }
                            else
                            {
                                throw new ArgumentException("Gzip could not contains more than one item");
                            }

                            break;
                        }
                        }
                    }
                    catch (AggregateException Ae) when(Ae.InnerException is UnauthorizedAccessException)
                    {
                        CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
                            {
                                Model.UpdateStatus(OperationStatus.Error, Globalization.GetString("QueueDialog_UnauthorizedCompression_Content"));
                            }).AsTask().Wait();
                    }
                    catch (AggregateException Ae) when(Ae.InnerException is FileNotFoundException)
                    {
                        CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
                            {
                                Model.UpdateStatus(OperationStatus.Error, Globalization.GetString("QueueDialog_LocateFileFailure_Content"));
                            }).AsTask().Wait();
                    }
                    catch (Exception ex)
                    {
                        LogTracer.Log(ex, "Compression error");

                        CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
                            {
                                Model.UpdateStatus(OperationStatus.Error, Globalization.GetString("QueueDialog_CompressionError_Content"));
                            }).AsTask().Wait();
                    }

                    break;
                }

                case OperationListDecompressionModel DModel:
                {
                    try
                    {
                        CompressionUtil.SetEncoding(DModel.Encoding);

                        if (Model.FromPath.All((Item) => Item.EndsWith(".zip", StringComparison.OrdinalIgnoreCase) ||
                                               Item.EndsWith(".tar", StringComparison.OrdinalIgnoreCase) ||
                                               Item.EndsWith(".tar.gz", StringComparison.OrdinalIgnoreCase) ||
                                               Item.EndsWith(".tgz", StringComparison.OrdinalIgnoreCase) ||
                                               Item.EndsWith(".tar.bz2", StringComparison.OrdinalIgnoreCase) ||
                                               Item.EndsWith(".bz2", StringComparison.OrdinalIgnoreCase) ||
                                               Item.EndsWith(".gz", StringComparison.OrdinalIgnoreCase) ||
                                               Item.EndsWith(".rar", StringComparison.OrdinalIgnoreCase)))
                        {
                            CompressionUtil.ExtractAllAsync(Model.FromPath, Model.ToPath, DModel.ShouldCreateFolder, (s, e) =>
                                {
                                    CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
                                    {
                                        Model.UpdateProgress(e.ProgressPercentage);
                                    }).AsTask().Wait();
                                }).Wait();
                        }
                        else
                        {
                            throw new Exception(Globalization.GetString("QueueDialog_FileTypeIncorrect_Content"));
                        }
                    }
                    catch (AggregateException Ae) when(Ae.InnerException is UnauthorizedAccessException)
                    {
                        CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
                            {
                                Model.UpdateStatus(OperationStatus.Error, Globalization.GetString("QueueDialog_UnauthorizedDecompression_Content"));
                            }).AsTask().Wait();
                    }
                    catch (AggregateException Ae) when(Ae.InnerException is FileNotFoundException)
                    {
                        CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
                            {
                                Model.UpdateStatus(OperationStatus.Error, Globalization.GetString("QueueDialog_LocateFileFailure_Content"));
                            }).AsTask().Wait();
                    }
                    catch (Exception ex)
                    {
                        LogTracer.Log(ex, "Decompression error");

                        CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
                            {
                                Model.UpdateStatus(OperationStatus.Error, Globalization.GetString("QueueDialog_DecompressionError_Content"));
                            }).AsTask().Wait();
                    }

                    break;
                }
                }

                CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
                {
                    if (Model.Status != OperationStatus.Error)
                    {
                        Model.UpdateProgress(100);
                        Model.UpdateStatus(OperationStatus.Completed);
                    }
                }).AsTask().Wait();
            }
            catch (Exception ex)
            {
                LogTracer.Log(ex, "A subthread in Task List threw an exception");
            }
            finally
            {
                Interlocked.Decrement(ref RunningTaskCounter);
            }
        }
コード例 #9
0
 public virtual Task CopyAsync(FileSystemStorageFolder Directory, CollisionOptions Option = CollisionOptions.None, ProgressChangedEventHandler ProgressHandler = null)
 {
     return(CopyAsync(Directory.Path, Option, ProgressHandler));
 }
コード例 #10
0
ファイル: Entity.cs プロジェクト: DeanReynolds/Orbis
 /// <summary>
 /// Create a new Entity.
 /// </summary>
 /// <param name="hitBox">The hitbox polygon for the entity.</param>
 /// <param name="collisionOptions">The flags for collision detection when moving.</param>
 public Entity(Polygon hitBox, CollisionOptions collisionOptions)
 {
     Hitbox = hitBox; _collisionOptions = collisionOptions;
 }
コード例 #11
0
ファイル: Entity.cs プロジェクト: DeanReynolds/Orbis
 /// <summary>
 /// Create a new Entity.
 /// </summary>
 /// <param name="collisionOptions">The flags for collision detection when moving.</param>
 public Entity(CollisionOptions collisionOptions)
 {
     _collisionOptions = collisionOptions;
 }