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); }
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; }
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; } } } } }
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); } }
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)); }
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; } }
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); }
protected override void OnActiveViewChanged(object sender, EventArgs e) { IContentView activeView = MainFormManager.MainForm.ActiveView as IContentView; ToolStripItem.Enabled = GetDataAnalysisResults(activeView).Any(); }
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 static void MapContent(RadioButtonHandler handler, IContentView page) { handler.UpdateContent(); }
public ContentPresenter(IContentView view, ContentParameter parameter) { this.view = view ?? throw new ArgumentException(); this.parameter = parameter; }
//public ContentAViewViewModel() { } public ContentAViewViewModel(IContentView view) { View = view; View.DataContext = this; }
public ContentPresenter(IContentView view) { this.view = view; }
public static void MapContent(IRadioButtonHandler handler, IContentView page) { UpdateContent(handler); }
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; }
public static Size MeasureContent(this IContentView contentView, double widthConstraint, double heightConstraint) { return(contentView.MeasureContent(contentView.Padding, widthConstraint, heightConstraint)); }
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); }
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 static void MapTitle(IPageHandler handler, IContentView page) { }
public static bool ViewCanViewContent(IContentView view, IContent content) { return(ContentAttribute.CanViewType(view.GetType(), content.GetType())); }
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(); }
internal void SetView(IContentView view) => base.View = view;