Пример #1
0
 public Tutorial(string name, ICommandExecution commandExecutionExecution, Guid guid)
 {
     CommandExecution = commandExecutionExecution;
     Name             = name;
     Guid             = guid;
     CommandType      = commandExecutionExecution.GetType();
 }
Пример #2
0
        public GenerateTestDataUI(IActivateItems activator, ICommandExecution command) : base(activator)
        {
            InitializeComponent();

            var dataGeneratorFactory = new DataGeneratorFactory();

            int yLoc = 0;

            foreach (Type t in dataGeneratorFactory.GetAvailableGenerators())
            {
                var ui = new DataGeneratorUI();
                ui.Generator = dataGeneratorFactory.Create(t, new Random());
                ui.Location  = new Point(0, yLoc);
                yLoc        += ui.Height;
                pDatasets.Controls.Add(ui);
            }

            lblDirectory.Visible = false;

            EnableOrDisableGoButton();

            if (command != null)
            {
                BuildHelpWorkflow(command);
            }

            helpIcon1.SetHelpText("Tutorial", "Click for tutorial", HelpWorkflow);
        }
Пример #3
0
        private void BuildHelpWorkflow(ICommandExecution command)
        {
            HelpWorkflow = new HelpWorkflow(this, command, new TutorialTracker(Activator));

            var ds =
                new HelpStage(pDatasets,
                              "This control will allow you to create flat comma separated files with fictional data for a shared pool of patient identifiers.  Start by choosing the number of rows you want in each dataset e.g. 1,000,000");
            var pop =
                new HelpStage(pPopulationSize, "Now choose how many unique identifiers you want generated.  If your population pool is smaller than the number of records per dataset there will be a large overlap of patients between datasets while if it is larger the crossover will be sparser.");

            var location = new HelpStage(pOutputDirectory, @"Click browse to select a directory to create the 3 files in");

            var execute = new HelpStage(btnGenerate, "Click to start generating the flat files");

            ds.SetOption(">>", pop);
            pop.SetOption(">>", location);
            location.SetOption(">>", execute);

            HelpWorkflow.RootStage = ds;
        }
        public override ICommandExecution ProposeExecution(ICombineToMakeCommand cmd, AllCataloguesUsedByLoadMetadataNode target, InsertOption insertOption = InsertOption.Default)
        {
            var cata     = cmd as CatalogueCombineable;
            var manyCata = cmd as ManyCataloguesCombineable;

            ICommandExecution cmdExecution = null;

            if (cata != null)
            {
                cmdExecution = new ExecuteCommandAssociateCatalogueWithLoadMetadata(ItemActivator, target.LoadMetadata).SetTarget(new[] { cata.Catalogue });
            }

            if (manyCata != null)
            {
                cmdExecution = new ExecuteCommandAssociateCatalogueWithLoadMetadata(ItemActivator, target.LoadMetadata).SetTarget(manyCata.Catalogues);
            }


            return(cmdExecution);
        }
Пример #5
0
        /// <summary>
        /// Only applies to external files and other wierd types that are not Models in our tree views but that we might still want to allow drag and drop interactions for
        /// </summary>
        /// <param name="dataObject"></param>
        /// <param name="dropTargetModel"></param>
        /// <returns></returns>
        private ICommandExecution GetExecutionCommandIfAnyForNonModelObjects(DataObject dataObject, object dropTargetModel)
        {
            //if user is dragging in files
            if (dataObject.ContainsFileDropList())
            {
                //get file list
                var files = dataObject.GetFileDropList().Cast <string>().Select(s => new FileInfo(s)).ToArray();
                ICombineToMakeCommand fileCommand = _commandFactory.Create(files);

                //if command factory supports generating file based commands
                if (fileCommand != null)
                {
                    //does the execution factory permit the combination of a file command with the drop target
                    ICommandExecution execution = _commandExecutionFactory.Create(fileCommand, dropTargetModel);
                    return(execution);
                }
            }

            return(null);
        }
Пример #6
0
        private void DisplayFeedback(ICommandExecution execution, OlvDropEventArgs e)
        {
            //no command is even remotely possible
            if (execution == null)
            {
                e.DropSink.FeedbackColor = Color.IndianRed;
                return;
            }

            //valid combination of objects but not possible due to object states
            if (execution.IsImpossible)
            {
                e.DropSink.FeedbackColor       = Color.IndianRed;
                e.DropSink.Billboard.BackColor = Color.IndianRed;
                e.InfoMessage = execution.ReasonCommandImpossible;
                return;
            }

            e.DropSink.Billboard.BackColor = Color.GreenYellow;
            e.DropSink.FeedbackColor       = Color.GreenYellow;
            e.InfoMessage = execution.GetCommandName();
            e.Handled     = true;
            e.Effect      = DragDropEffects.Move;
        }
Пример #7
0
        private void btnExecute_Click(object sender, EventArgs e)
        {
            Cursor = Cursors.WaitCursor;

            string problem = AllRequiredDataPresent();

            try
            {
                if (problem != null)
                {
                    MessageBox.Show(problem);
                    return;
                }

                ragExecute.Reset();

                //create the project
                if (_project == null)
                {
                    _project = new Project(Activator.RepositoryLocator.DataExportRepository, tbProjectName.Text);
                }

                _project.ProjectNumber       = int.Parse(tbProjectNumber.Text);
                _project.ExtractionDirectory = tbExtractionDirectory.Text;

                if (!Directory.Exists(_project.ExtractionDirectory))
                {
                    Directory.CreateDirectory(_project.ExtractionDirectory);
                }

                _project.SaveToDatabase();

                if (_configuration == null)
                {
                    _configuration = new ExtractionConfiguration(Activator.RepositoryLocator.DataExportRepository,
                                                                 _project);
                    _configuration.Name = "Cases";
                    _configuration.SaveToDatabase();
                }

                foreach (ExtractableDataSet ds in _selectedDatasets)
                {
                    _configuration.AddDatasetToConfiguration(ds);
                }

                ICommandExecution cmdAssociateCicWithProject = null;

                if (_cohortCreated == null && cbDefineCohort.Checked)
                {
                    var cohortDefinition = new CohortDefinition(null, tbCohortName.Text, 1, _project.ProjectNumber.Value,
                                                                (ExternalCohortTable)ddCohortSources.SelectedItem);

                    //execute the cohort creation bit
                    var cohortRequest = new CohortCreationRequest(_project, cohortDefinition,
                                                                  (DataExportRepository)Activator.RepositoryLocator.DataExportRepository, tbCohortName.Text);

                    ComboBox dd;
                    if (_cohortFile != null)
                    {
                        //execute cohort creation from file.
                        cohortRequest.FileToLoad = new FlatFileToLoad(_cohortFile);
                        dd = ddFilePipeline;
                    }
                    else
                    {
                        //execute cohort creation from cic
                        cohortRequest.CohortIdentificationConfiguration =
                            (CohortIdentificationConfiguration)cbxCohort.SelectedItem;
                        dd = ddCicPipeline;


                        //since we are about to execute a cic and store the results we should associate it with the Project (if successful)
                        cmdAssociateCicWithProject = new ExecuteCommandAssociateCohortIdentificationConfigurationWithProject(Activator).SetTarget(
                            _project).SetTarget(cohortRequest.CohortIdentificationConfiguration);
                    }

                    var engine = cohortRequest.GetEngine((Pipeline)dd.SelectedItem, new ThrowImmediatelyDataLoadEventListener());
                    engine.ExecutePipeline(new GracefulCancellationToken());
                    _cohortCreated = cohortRequest.CohortCreatedIfAny;
                }

                if (cbDefineCohort.Checked)
                {
                    //associate the configuration with the cohort
                    _configuration.Cohort_ID = _cohortCreated.ID;

                    //set the pipeline to use
                    var pipeline = (Pipeline)ddExtractionPipeline.SelectedItem;
                    if (pipeline != null)
                    {
                        _configuration.DefaultPipeline_ID = pipeline.ID;
                    }

                    _configuration.SaveToDatabase();

                    //User defined cohort if it came from cic then associate the cic with the project
                    if (cmdAssociateCicWithProject != null && !cmdAssociateCicWithProject.IsImpossible)
                    {
                        cmdAssociateCicWithProject.Execute();
                    }
                }

                Cursor = Cursors.Default;

                ExtractionConfigurationCreatedIfAny = _configuration;

                DialogResult = DialogResult.OK;
                MessageBox.Show("Project Created Successfully");
                Close();
            }
            catch (Exception exception)
            {
                ragExecute.Fatal(exception);
            }
            finally
            {
                Cursor = Cursors.Default;
            }
        }
        public DbCommandGrammar CheckResult <T>(string cell = "result")
        {
            Execution = new CheckResultExecution <T>();

            return(this);
        }
Пример #9
0
        public DbCommandGrammar ResultAction <T>(Action <T> action)
        {
            Execution = new ActionResultExecution <T>(action);

            return(this);
        }
Пример #10
0
 public ImpossibleCommandException(ICommandExecution command, string reasonCommandImpossible)
     : base(string.Format("Command is marked as IsImpossible and should not be Executed.  Reason is '{0}'", reasonCommandImpossible))
 {
     Command = command;
     ReasonCommandImpossible = reasonCommandImpossible;
 }
Пример #11
0
 public HelpWorkflow(Control hostControl, ICommandExecution command, IHelpWorkflowProgressProvider progressProvider)
 {
     HostControl      = hostControl;
     Command          = command;
     ProgressProvider = progressProvider;
 }
Пример #12
0
        /// <summary>
        /// Constructor Executor
        /// </summary>
        /// <param name="executor"></param>
        /// <param name="solutionPath"></param>
        /// /// <param name="addinPath"></param>
        public SonarInterface(ICommandExecution executor, string solutionPath, string addinPath)
        {
            this.solutionPath = solutionPath;
            this.addinPath = addinPath;
            this.executor = executor;
            this.baseArgs = "-cp \"" + addinPath + "\\Documents\\Visual Studio 2010\\Addins\\vssonar-cli.jar\" com.tekla.vssonar.VssonarCli";

            if (File.Exists(addinPath + "\\Documents\\Visual Studio 2010\\Addins\\vssonar.xml"))
            {
                userConfigFilePath = "\"" + addinPath + "\\Documents\\Visual Studio 2010\\Addins\\vssonar.xml\"";
            }
        }