public void Start(IDataAnalysisProblemData problemData, IContentView currentView) {
   IAlgorithm algorithm;
   IDataAnalysisProblem problem;
   GetMostOuterContent(currentView as Control, out algorithm, out problem);
   var context = new PreprocessingContext(problemData, algorithm ?? problem ?? problemData as IItem);
   MainFormManager.MainForm.ShowContent(context);
 }
Example #2
0
        string IMasterView.Render( IContentView view )
        {
            HttpContext.Trace.Write( "JumonyMasterView", "Begin Render" );
              OnPreRender();
              RenderAdapters.Add( view.CreateContentAdapter( this ) );
              var content = Document.Render( RenderAdapters.ToArray() );
              OnPostRender();
              HttpContext.Trace.Write( "JumonyMasterView", "End Render" );

              return content;
        }
Example #3
0
 protected virtual void treeView_DoubleClick(object sender, EventArgs e)
 {
     if (InvokeRequired)
     {
         Invoke(new EventHandler(treeView_DoubleClick), sender, e);
     }
     else
     {
         if (treeView.SelectedNode != null)
         {
             var item = treeView.SelectedNode.Tag as T;
             if (item != null)
             {
                 IContentView view = MainFormManager.MainForm.ShowContent(item);
                 if (view != null)
                 {
                     view.ReadOnly = ReadOnly;
                     view.Locked   = Locked;
                 }
             }
         }
     }
 }
Example #4
0
        protected override void itemsListView_DoubleClick(object sender, EventArgs e)
        {
            if (itemsListView.SelectedItems.Count != 1)
            {
                return;
            }

            IResult result   = itemsListView.SelectedItems[0].Tag as IResult;
            Type    viewType = itemsListView.SelectedItems[0].Tag as Type;

            if (result != null)
            {
                IContentView view = MainFormManager.MainForm.ShowContent(result, typeof(ResultView));
                if (view != null)
                {
                    view.ReadOnly = ReadOnly;
                    view.Locked   = Locked;
                }
            }
            else if (viewType != null)
            {
                MainFormManager.MainForm.ShowContent(Content, viewType);
            }
        }
Example #5
0
        public static Size MeasureContent(this IContentView contentView, Thickness inset, double widthConstraint, double heightConstraint)
        {
            var content = contentView.PresentedContent;

            if (Dimension.IsExplicitSet(contentView.Width))
            {
                widthConstraint = contentView.Width;
            }

            if (Dimension.IsExplicitSet(contentView.Height))
            {
                heightConstraint = contentView.Height;
            }

            var contentSize = Size.Zero;

            if (content != null)
            {
                contentSize = content.Measure(widthConstraint - inset.HorizontalThickness,
                                              heightConstraint - inset.VerticalThickness);
            }

            return(new Size(contentSize.Width + inset.HorizontalThickness, contentSize.Height + inset.VerticalThickness));
        }
Example #6
0
        public override void Execute()
        {
            IContentView activeView = MainFormManager.MainForm.ActiveView as IContentView;

            content = activeView.Content as IItem;

            //IOptimizer and IExecutables need some special care
            if (content is IOptimizer)
            {
                ((IOptimizer)content).Runs.Clear();
            }
            if (content is IExecutable)
            {
                IExecutable exec = content as IExecutable;
                if (exec.ExecutionState != ExecutionState.Prepared)
                {
                    exec.Prepare();
                }
            }

            HiveClient.Instance.Refresh();

            ItemTask       hiveTask = ItemTask.GetItemTaskForItem(content);
            HiveTask       task     = hiveTask.CreateHiveTask();
            RefreshableJob rJob     = new RefreshableJob();

            rJob.Job.Name = content.ToString();
            rJob.HiveTasks.Add(task);
            task.ItemTask.ComputeInParallel = content is Experiment || content is BatchRun;

            progress      = MainFormManager.GetMainForm <MainForm.WindowsForms.MainForm>().AddOperationProgressToContent(this.content, "Uploading to Hive...");
            rJob.Progress = progress;
            progress.ProgressStateChanged += progress_ProgressStateChanged;

            HiveClient.StartJob(new Action <Exception>(HandleEx), rJob, new CancellationToken());
        }
        private void GetMostOuterContent(Control control, out IAlgorithm algorithm, out IDataAnalysisProblem problem)
        {
            algorithm = null;
            problem   = null;

            while (control != null)
            {
                IContentView contentView = control as IContentView;
                if (contentView != null)
                {
                    var newAlgorithm = contentView.Content as IAlgorithm;
                    if (newAlgorithm != null)
                    {
                        algorithm = newAlgorithm;
                    }
                    var newProblem = contentView.Content as IDataAnalysisProblem;
                    if (newProblem != null)
                    {
                        problem = newProblem;
                    }
                }
                control = control.Parent;
            }
        }
Example #8
0
    public static void SaveAs(IContentView view) {
      IStorableContent content = view.Content as IStorableContent;
      if (!view.Locked && content != null) {
        if (saveFileDialog == null) {
          saveFileDialog = new SaveFileDialog();
          saveFileDialog.Title = "Save Item";
          saveFileDialog.DefaultExt = "hl";
          saveFileDialog.Filter = "Uncompressed HeuristicLab Files|*.hl|HeuristicLab Files|*.hl|All Files|*.*";
          saveFileDialog.FilterIndex = 2;
        }

        INamedItem namedItem = content as INamedItem;
        string suggestedFileName = string.Empty;
        if (!string.IsNullOrEmpty(content.Filename)) suggestedFileName = content.Filename;
        else if (namedItem != null) suggestedFileName = namedItem.Name;
        else suggestedFileName = "Item";

        saveFileDialog.FileName = suggestedFileName;

        if (saveFileDialog.ShowDialog() == DialogResult.OK) {
          MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().SetAppStartingCursor();
          SetSaveOperationProgressInContentViews(content, true, saveFileDialog.FileName);
          if (saveFileDialog.FilterIndex == 1) {
            ContentManager.SaveAsync(content, saveFileDialog.FileName, false, SavingCompleted);
          } else {
            ContentManager.SaveAsync(content, saveFileDialog.FileName, true, SavingCompleted);
          }
        }
      }
    }
 public ContentViewViewModel(IContentView view)
 {
     View           = view;
     View.ViewModel = this;
 }
 public void SetContentView(IContentView contentView)
 {
     this.AddControlToPanel(contentView, this.splitContainer1.Panel1, DockStyle.Fill);
 }
Example #11
0
        protected override void OnActiveViewChanged(object sender, EventArgs e)
        {
            IContentView activeView = MainFormManager.MainForm.ActiveView as IContentView;

            ToolStripItem.Enabled = GetDataAnalysisResults(activeView).Any();
        }
Example #12
0
 public void SwitchView(IContentView view)
 {
     pcontener.Controls.Clear();
     pcontener.Controls.Add((UserControl)view);
     ((UserControl)view).Dock = DockStyle.Fill;
 }
    private IEnumerable<KeyValuePair<string, IDataAnalysisSolution>> GetDataAnalysisResults(IContentView view) {
      var empty = Enumerable.Empty<KeyValuePair<string, IDataAnalysisSolution>>();
      if (view == null) return empty;
      if (view.Content == null) return empty;
      if (view.Locked) return empty;

      var optimizer = view.Content as IOptimizer;
      if (optimizer != null) return GetDataAnalysisResults(optimizer.Runs);

      RunCollectionBubbleChartView bubbleChart;
      var viewHost = view as ViewHost;
      if (viewHost != null)
        bubbleChart = viewHost.ActiveView as RunCollectionBubbleChartView;
      else bubbleChart = view as RunCollectionBubbleChartView;
      if (bubbleChart != null && bubbleChart.SelectedRuns.Any()) return GetDataAnalysisResults(bubbleChart.SelectedRuns);

      return empty;
    }
 public ContentViewViewModel(IContentView view)
 {
     View = view;
     View.ViewModel = this;
 }
Example #15
0
 public static void MapContent(RadioButtonHandler handler, IContentView page)
 {
     handler.UpdateContent();
 }
Example #16
0
 public ContentPresenter(IContentView view, ContentParameter parameter)
 {
     this.view      = view ?? throw new ArgumentException();
     this.parameter = parameter;
 }
Example #17
0
 //public ContentAViewViewModel() { }
 public ContentAViewViewModel(IContentView view)
 {
     View = view;
     View.DataContext = this;
 }
Example #18
0
 public ContentPresenter(IContentView view)
 {
     this.view = view;
 }
Example #19
0
 public static void MapContent(IRadioButtonHandler handler, IContentView page)
 {
     UpdateContent(handler);
 }
Example #20
0
 private static void Save(IContentView view) {
   IStorableContent content = view.Content as IStorableContent;
   if (!view.Locked && content != null) {
     if (string.IsNullOrEmpty(content.Filename))
       SaveAs(view);
     else {
       MainFormManager.GetMainForm<HeuristicLab.MainForm.WindowsForms.MainForm>().SetAppStartingCursor();
       SetSaveOperationProgressInContentViews(content, true);
       ContentManager.SaveAsync(content, content.Filename, true, SavingCompleted);
     }
   }
 }
        protected override void OnActiveViewChanged(object sender, EventArgs e)
        {
            IContentView activeView = MainFormManager.MainForm.ActiveView as IContentView;

            ToolStripItem.Enabled = (activeView != null) && (activeView.Content != null) && (activeView.Content is IOptimizer) && !activeView.Locked;
        }
Example #22
0
 public static Size MeasureContent(this IContentView contentView, double widthConstraint, double heightConstraint)
 {
     return(contentView.MeasureContent(contentView.Padding, widthConstraint, heightConstraint));
 }
Example #23
0
        protected override void OnActiveViewChanged(object sender, EventArgs e)
        {
            IContentView activeView = MainFormManager.MainForm.ActiveView as IContentView;

            ToolStripItem.Enabled = (activeView != null) && (activeView.Content != null) && (activeView.Content is EngineAlgorithm) && !(activeView.Content is UserDefinedAlgorithm) && !activeView.Locked;
        }
 public void SwitchViewAction(IContentView view)
 {
     View.SwitchView(view);
 }
Example #25
0
        private IEnumerable <KeyValuePair <string, IDataAnalysisSolution> > GetDataAnalysisResults(IContentView view)
        {
            var empty = Enumerable.Empty <KeyValuePair <string, IDataAnalysisSolution> >();

            if (view == null)
            {
                return(empty);
            }
            if (view.Content == null)
            {
                return(empty);
            }
            if (view.Locked)
            {
                return(empty);
            }

            var optimizer = view.Content as IOptimizer;

            if (optimizer != null)
            {
                return(GetDataAnalysisResults(optimizer.Runs));
            }

            RunCollectionBubbleChartView bubbleChart;
            var viewHost = view as ViewHost;

            if (viewHost != null)
            {
                bubbleChart = viewHost.ActiveView as RunCollectionBubbleChartView;
            }
            else
            {
                bubbleChart = view as RunCollectionBubbleChartView;
            }
            if (bubbleChart != null && bubbleChart.SelectedRuns.Any())
            {
                return(GetDataAnalysisResults(bubbleChart.SelectedRuns));
            }

            return(empty);
        }
 public ContentPresenter(IContentView view)
 {
     this.view = view;
 }
Example #27
0
 public static void MapTitle(IPageHandler handler, IContentView page)
 {
 }
 public void SetContentView(IContentView contentView)
 {
     this.AddControlToPanel(contentView, this.splitContainer1.Panel1, DockStyle.Fill);
 }
 public static bool ViewCanViewContent(IContentView view, IContent content)
 {
     return(ContentAttribute.CanViewType(view.GetType(), content.GetType()));
 }
Example #30
0
        protected override void OnActiveViewChanged(object sender, EventArgs e)
        {
            IContentView activeView = MainFormManager.MainForm.ActiveView as IContentView;

            ToolStripItem.Enabled = (activeView != null) && (activeView.Content != null) && ((activeView.Content is Experiment) || (activeView.Content is RunCollection) || (activeView.Content is IOptimizer)) && !activeView.Locked && OKBRoles.CheckUserPermissions();
        }
Example #31
0
 //public ContentAViewViewModel() { }
 public ContentAViewViewModel(IContentView view)
 {
     View             = view;
     View.DataContext = this;
 }
Example #32
0
 internal void SetView(IContentView view) => base.View = view;