Exemple #1
0
        private void UploadAsync()
        {
            var       message  = "Uploading runs to OKB...";
            IProgress progress = MainFormManager.GetMainForm <HeuristicLab.MainForm.WindowsForms.MainForm>().AddOperationProgressToView(this, message);
            double    count    = dataGridView.Rows.Count;
            int       i        = 0;

            foreach (DataGridViewRow row in dataGridView.Rows)
            {
                i++;
                if (!Convert.ToBoolean(row.Cells[UploadColumn.Name].Value))
                {
                    continue;
                }
                selectedAlgorithm = algorithms.FirstOrDefault(x => x.Name == row.Cells[OKBAlgorithmColumn.Name].Value.ToString());
                selectedProblem   = problems.FirstOrDefault(x => x.Name == row.Cells[OKBProblemColumn.Name].Value.ToString());
                if (selectedAlgorithm == null || selectedProblem == null)
                {
                    throw new ArgumentException("Can't retrieve the algorithm/problem to upload");
                }

                OKBRun run = new OKBRun(selectedAlgorithm.Id, selectedProblem.Id, row.Tag as IRun, UserInformation.Instance.User.Id);
                run.Store();
                progress.ProgressValue = ((double)i) / count;
            }
            MainFormManager.GetMainForm <HeuristicLab.MainForm.WindowsForms.MainForm>().RemoveOperationProgressFromView(this);
            ClearRuns();
        }
Exemple #2
0
 private OKBRun(OKBRun original, Cloner cloner)
     : base(original, cloner)
 {
     algorithmId = original.algorithmId;
     problemId   = original.problemId;
     createdDate = original.createdDate;
     stored      = original.stored;
     UserId      = original.UserId;
     ClientId    = original.ClientId;
 }
 private void Runs_CollectionReset(object sender, CollectionItemsChangedEventArgs <IRun> e)
 {
     foreach (IRun run in e.OldItems)
     {
         OKBRun okbRun = run as OKBRun;
         if (okbRun != null)
         {
             Algorithm.Runs.Remove(okbRun.WrappedRun);
         }
         else
         {
             Algorithm.Runs.Remove(run);
         }
     }
 }
        private void Algorithm_Runs_ItemsAdded(object sender, CollectionItemsChangedEventArgs <IRun> e)
        {
            OKBProblem problem = Problem as OKBProblem;

            foreach (IRun run in e.Items)
            {
                if (problem != null)
                {
                    OKBRun okbRun = new OKBRun(AlgorithmId, problem.ProblemId, run, UserId);
                    runs.Add(okbRun);
                    if (StoreRunsAutomatically)
                    {
                        okbRun.Store();
                    }
                }
                else
                {
                    runs.Add(run);
                }
            }
        }