コード例 #1
0
 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);
 }
コード例 #2
0
ファイル: JumonyMasterView.cs プロジェクト: neo2018/Jumony
        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;
        }
コード例 #3
0
ファイル: ItemTreeView.cs プロジェクト: lulzzz/HeuristicLab
 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;
                 }
             }
         }
     }
 }
コード例 #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);
            }
        }
コード例 #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));
        }
コード例 #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());
        }
コード例 #7
0
        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;
            }
        }
コード例 #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);
          }
        }
      }
    }
コード例 #9
0
 public ContentViewViewModel(IContentView view)
 {
     View           = view;
     View.ViewModel = this;
 }
コード例 #10
0
 public void SetContentView(IContentView contentView)
 {
     this.AddControlToPanel(contentView, this.splitContainer1.Panel1, DockStyle.Fill);
 }
コード例 #11
0
        protected override void OnActiveViewChanged(object sender, EventArgs e)
        {
            IContentView activeView = MainFormManager.MainForm.ActiveView as IContentView;

            ToolStripItem.Enabled = GetDataAnalysisResults(activeView).Any();
        }
コード例 #12
0
 public void SwitchView(IContentView view)
 {
     pcontener.Controls.Clear();
     pcontener.Controls.Add((UserControl)view);
     ((UserControl)view).Dock = DockStyle.Fill;
 }
コード例 #13
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;
    }
コード例 #14
0
 public ContentViewViewModel(IContentView view)
 {
     View = view;
     View.ViewModel = this;
 }
コード例 #15
0
 public static void MapContent(RadioButtonHandler handler, IContentView page)
 {
     handler.UpdateContent();
 }
コード例 #16
0
ファイル: Content.ascx.cs プロジェクト: csikonsin/CopyCMS
 public ContentPresenter(IContentView view, ContentParameter parameter)
 {
     this.view      = view ?? throw new ArgumentException();
     this.parameter = parameter;
 }
コード例 #17
0
 //public ContentAViewViewModel() { }
 public ContentAViewViewModel(IContentView view)
 {
     View = view;
     View.DataContext = this;
 }
コード例 #18
0
 public ContentPresenter(IContentView view)
 {
     this.view = view;
 }
コード例 #19
0
 public static void MapContent(IRadioButtonHandler handler, IContentView page)
 {
     UpdateContent(handler);
 }
コード例 #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);
     }
   }
 }
コード例 #21
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 IOptimizer) && !activeView.Locked;
        }
コード例 #22
0
 public static Size MeasureContent(this IContentView contentView, double widthConstraint, double heightConstraint)
 {
     return(contentView.MeasureContent(contentView.Padding, widthConstraint, heightConstraint));
 }
コード例 #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;
        }
コード例 #24
0
 public void SwitchViewAction(IContentView view)
 {
     View.SwitchView(view);
 }
コード例 #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;
 }
コード例 #27
0
 public static void MapTitle(IPageHandler handler, IContentView page)
 {
 }
コード例 #28
0
 public void SetContentView(IContentView contentView)
 {
     this.AddControlToPanel(contentView, this.splitContainer1.Panel1, DockStyle.Fill);
 }
コード例 #29
0
 public static bool ViewCanViewContent(IContentView view, IContent content)
 {
     return(ContentAttribute.CanViewType(view.GetType(), content.GetType()));
 }
コード例 #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();
        }
コード例 #31
0
 //public ContentAViewViewModel() { }
 public ContentAViewViewModel(IContentView view)
 {
     View             = view;
     View.DataContext = this;
 }
コード例 #32
0
ファイル: MDViewModel.cs プロジェクト: sispd/Wider
 internal void SetView(IContentView view) => base.View = view;