Exemplo n.º 1
0
        private void RunExperimentFunc(object param)
        {
            var args = param as List <object>;

            if (args != null && args.Count == 3)
            {
                //validate args
                var progress          = args[0] as IProgress;
                var workspaceVM       = args[1] as WorkspaceViewModelWrapper;
                var componentsLibrary = args[2] as ComponentsLibraryViewModelWrapper;

                if (progress != null && workspaceVM != null && componentsLibrary != null)
                {
                    var workspace = (TraceLab.Core.Workspaces.Workspace)workspaceVM;

                    //var typeDirectories = new HashSet<string>();
                    //var packageManager = TraceLab.Core.PackageSystem.PackageManager.Instance;
                    //foreach (TraceLabSDK.PackageSystem.IPackageReference packageReference in TopLevel.References)
                    //{
                    //    var package = packageManager.GetPackage(packageReference);
                    //    foreach (string typesLocation in packageManager.GetDependantTypeLocations(package))
                    //    {
                    //        typeDirectories.Add(typesLocation);
                    //    }
                    //}

                    //workspace.TypeDirectories.AddRange(typeDirectories);
                    try
                    {
                        TopLevel.RunExperiment(progress, workspace, (ComponentsLibrary)componentsLibrary);
                    }
                    catch (System.IO.FileNotFoundException ex)
                    {
                        progress.SetError(true);
                        progress.CurrentStatus = "Experiment failed to run";
                        NLog.LogManager.GetCurrentClassLogger().Error(String.Format("Experiment failed to run. Some component dependencies could not be resolved. Please re-scan the components library to determine which components are failing.\n{0}", ex.Message));
                    }
                }
            }
        }