コード例 #1
0
        // Private Methods (1) 
        private static Task CreateHandleFilesTask(MainViewModel viewModel, IPlugIn plugIn, IHandleFilesContext ctx)
        {
            return(new Task((state) =>
            {
                MainViewModel vm = (MainViewModel)state;

                try
                {
                    plugIn.HandleFiles(ctx);
                }
                catch (Exception ex)
                {
                    vm.OnError(ex);
                }
                finally
                {
                    vm.Task = null;
                }
            }, state: viewModel
                            , creationOptions: TaskCreationOptions.LongRunning));
        }