Changeset 14255 for trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views/3.4/SymbolicRegressionModelMathView.cs
- Timestamp:
- 08/16/16 12:04:56 (8 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views/3.4/SymbolicRegressionModelMathView.cs
r14250 r14255 20 20 #endregion 21 21 22 using System;23 using System.IO;24 using System.Windows.Forms;25 22 using HeuristicLab.MainForm; 26 using HeuristicLab. MainForm.WindowsForms;23 using HeuristicLab.Problems.DataAnalysis.Symbolic.Views; 27 24 28 namespace HeuristicLab.Problems.DataAnalysis.Symbolic. Views {25 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views { 29 26 [View("Mathematical Representation")] 30 [Content(typeof(ISymbolicDataAnalysisModel))] 31 public partial class MathSymbolicDataAnalysisModelView : AsynchronousContentView { 32 private SymbolicDataAnalysisExpressionLatexFormatter formatter = new SymbolicDataAnalysisExpressionLatexFormatter(); 33 public MathSymbolicDataAnalysisModelView() 34 : base() { 35 InitializeComponent(); 36 webBrowser.ScrollBarsEnabled = true; 37 webBrowser.ScriptErrorsSuppressed = false; 27 [Content(typeof(ISymbolicRegressionModel))] 28 public partial class SymbolicRegressionModelMathView : SymbolicDataAnalysisModelMathView { 38 29 39 // update for the first time after page has loaded 40 webBrowser.DocumentCompleted += (sender, args) => RefreshHtmlPage(); 30 public SymbolicRegressionModelMathView() : base() { } 41 31 42 string hlDir = Path.GetFullPath(AppDomain.CurrentDomain.BaseDirectory); 43 webBrowser.Navigate("file://" + Path.Combine(hlDir, "displayModelFrame.html")); 44 } 45 46 public new ISymbolicDataAnalysisModel Content { 47 get { return (ISymbolicDataAnalysisModel)base.Content; } 32 public new ISymbolicRegressionModel Content { 33 get { return (ISymbolicRegressionModel)base.Content; } 48 34 set { base.Content = value; } 49 35 } 50 36 51 protected override void OnContentChanged() { 52 base.OnContentChanged(); 53 RefreshHtmlPage(); 54 } 55 56 private void RefreshHtmlPage() { 57 // only update if the page has loaded already 58 if (webBrowser.Document == null || webBrowser.Document.Body == null) return; 59 60 if (Content != null) { 61 HtmlElement newElement = webBrowser.Document.GetElementById("model"); 62 newElement.InnerText = formatter.Format(Content.SymbolicExpressionTree); 63 webBrowser.Document.InvokeScript("refreshModel"); 64 } else { 65 HtmlElement newElement = webBrowser.Document.GetElementById("model"); 66 newElement.InnerText = string.Empty; 67 } 37 protected override string GetFormattedTree() { 38 return Formatter.Format(Content.SymbolicExpressionTree, Content.TargetVariable); 68 39 } 69 40 }
Note: See TracChangeset
for help on using the changeset viewer.