public WorkspaceViewModel(TraceLab.Core.Workspaces.Workspace workspace, string experimentId)
        {
            if (workspace == null)
                throw new ArgumentNullException("workspace");
            if (String.IsNullOrEmpty(experimentId))
                throw new ArgumentException("Experiment id cannot be null or empty", "experimentId");

            m_workspace = workspace;
            m_workspace.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(workspace_PropertyChanged);

            m_experimentId = experimentId;

            //init observable collections
            m_experimentWorkspaceUnits = new ObservableCollection<WorkspaceUnit>();
            m_readonlyExperimentWorkspaceUnits = new ReadOnlyObservableCollection<WorkspaceUnit>(m_experimentWorkspaceUnits);

            //prefill local units with units of this experiment
            foreach (WorkspaceUnit unit in m_workspace.Units)
            {
                AddUnit(unit);
            }

            INotifyCollectionChanged workspaceUnitCollection = m_workspace.Units;
            workspaceUnitCollection.CollectionChanged += WorkspaceCollectionCollectionChanged;

            (new TraceLab.Core.Components.LibraryHelper(m_workspace.TypeDirectories)).PreloadWorkspaceTypes(System.AppDomain.CurrentDomain);
        }
        /// <summary>
        /// Gets the intersection point between the border of scope and line from scope node center to given 'toNode'.
        /// Padding allows controling how far inside from the border is the intersection computed.
        /// </summary>
        /// <param name="scopeNode">The scope node.</param>
        /// <param name="toNode">To node.</param>
        /// <param name="paddingLeft">The padding left.</param>
        /// <param name="paddingTop">The padding top.</param>
        /// <param name="paddingRight">The padding right.</param>
        /// <param name="paddingBottom">The padding bottom.</param>
        /// <param name="topCanvasOffset">The top canvas offset - represents the offset from top border of the scope to start of the inside canvas. 
        /// Needed because of label above the canvas.</param>
        /// <returns>
        /// Intersection point between scope's border and line from scope center to given 'toNode'. Returns null point if lines do not intersect.
        /// </returns>
        public static Point? GetIntersection(TraceLab.Core.Experiments.ScopeNode scopeNode, TraceLab.Core.Experiments.ExperimentNode toNode, 
                                             double paddingLeft, double paddingTop, double paddingRight, double paddingBottom, double topCanvasOffset)
        {
            //calculate optimal x of intersection between scope node center to its 
            Point scopeCenter = new Point(scopeNode.Data.X, scopeNode.Data.Y);

            Point endNodeCenter = new Point(toNode.Data.X, toNode.Data.Y);

            //corners including padding
            Point topLeftCorner = new Point(scopeCenter.X - scopeNode.DataWithSize.Width / 2 + paddingLeft, scopeCenter.Y - scopeNode.DataWithSize.Height / 2 + paddingTop + topCanvasOffset);
            Point topRightCorner = new Point(scopeCenter.X + scopeNode.DataWithSize.Width / 2 - paddingRight, scopeCenter.Y - scopeNode.DataWithSize.Height / 2 + paddingTop + topCanvasOffset);
            Point bottomLeftCorner = new Point(scopeCenter.X - scopeNode.DataWithSize.Width / 2 + paddingLeft, scopeCenter.Y + scopeNode.DataWithSize.Height / 2 - paddingBottom);
            Point bottomRightCorner = new Point(scopeCenter.X + scopeNode.DataWithSize.Width / 2 - paddingRight, scopeCenter.Y + scopeNode.DataWithSize.Height / 2 - paddingBottom);

            Point? intersectionOnMainCanvas;

            if (TryFindIntersection(scopeCenter, endNodeCenter, bottomLeftCorner, bottomRightCorner, out intersectionOnMainCanvas)) { } /* top */
            else if (TryFindIntersection(scopeCenter, endNodeCenter, bottomRightCorner, topRightCorner, out intersectionOnMainCanvas)) { } /* right */
            else if (TryFindIntersection(scopeCenter, endNodeCenter, bottomLeftCorner, topLeftCorner, out intersectionOnMainCanvas)) { } /* left */
            else if (TryFindIntersection(scopeCenter, endNodeCenter, topLeftCorner, topRightCorner, out intersectionOnMainCanvas)) { } /* top */

            //scope has it's own canvas with its own origin point, which is located in top left corner of the scope
            //therefore the computed point must be adjusted relatively to the scope canvas origin
            Point? adjustedIntersection = null;

            if (intersectionOnMainCanvas != null)
            {
                adjustedIntersection = AdjustPointToScopeCanvasOrigin(intersectionOnMainCanvas.Value, scopeNode, topCanvasOffset, ref scopeCenter);
            }

            return adjustedIntersection;
        }
Example #3
0
        /// <summary>
        /// Modifies experiment to add reference to new package.
        /// </summary>
        /// <param name="pPkg">The package being created.</param>
        /// <param name="pExperimentFile">The experiment file.</param>
        /// <returns>True is there was no error during the operation, false otherwise.</returns>
        private static bool AddPkgRefToExperiment(TraceLab.Core.PackageSystem.Package pPkg, string pExperimentFile)
        {
            bool noError = true;

            if (System.IO.File.Exists(pExperimentFile))
            {
                try
                {
                    XmlDocument xmlExperiment = new XmlDocument();
                    xmlExperiment.Load(pExperimentFile);

                    XmlNode nodeReferences = xmlExperiment.SelectSingleNode("//References");

                    XmlElement newPkgReference = xmlExperiment.CreateElement("PackageReference");
                    newPkgReference.SetAttribute("ID", pPkg.ID);
                    newPkgReference.SetAttribute("Name", pPkg.Name);
                    nodeReferences.AppendChild(newPkgReference);

                    xmlExperiment.Save(pExperimentFile);
                }
                catch (Exception)
                {
                    noError = false;
                    throw new TraceLab.Core.Exceptions.PackageCreationFailureException("Unable to modify experiment - reference to new package could not be added.");
                }
            }
            else
            {
                noError = false;
            }
            return noError;
        }
        public ComponentExceptionDisplayViewModel(TraceLab.Core.ViewModels.ComponentLogInfo logInfo)
        {
            LogInfo = logInfo;

            if (LogInfo.Exception != null)
            {
                ExceptionType = LogInfo.Exception.GetType().FullName;

                StringBuilder shortStack = new StringBuilder();
                using (StringReader reader = new StringReader(LogInfo.Exception.StackTrace)) 
                {
                    string line;
                    while ((line = reader.ReadLine()) != null)
                    {
                        if (line.StartsWith("Server stack trace: "))
                        {
                            shortStack.AppendLine("Exception trace:");
                            continue;
                        }
                        if(line.Trim().StartsWith("at System.Runtime.Remoting.Messaging")) 
                        {
                            break;
                        }
                        shortStack.AppendLine(line);
                    }
                }

                ShortStackTrace = shortStack.ToString();
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="RunnableDecisionNode"/> class.
 /// </summary>
 /// <param name="id">The id of this decision node.</param>
 /// <param name="label">The label - useful for debugging.</param>
 /// <param name="decisionModule">The decision module that is going to be invoked to select nodes to be executed after decision</param>
 /// <param name="library">The reference to the components library.</param>
 public RunnableDecisionNode(String id, String label, TraceLab.Core.Decisions.IDecisionModule decisionModule, ComponentsLibrary library, bool waitForAllPredecessors)
     : base(id, label, new RunnableNodeCollection(), new RunnableNodeCollection(), library, waitForAllPredecessors)
 {
     if (decisionModule == null)
         throw new ArgumentNullException("decisionModule");
     m_candidateNodes = new RunnableNodeCollection();
     m_decisionModule = decisionModule;
 }
Example #6
0
        public static void Run(TraceLab.Core.ViewModels.ApplicationViewModel context)
        {
            var wrapper = new ApplicationViewModelWrapper(context);
            var app = new Application();
            Window wind = new MainWindow(wrapper);

            app.Run(wind);
        }
 private void SavePositionAndZoom(TraceLab.UI.WPF.ViewModels.IZoomableViewModel oldModel)
 {
     if (oldModel != null)
     {
         oldModel.TranslateX = ZoomControl.TranslateX;
         oldModel.TranslateY = ZoomControl.TranslateY;
         oldModel.Zoom = ZoomControl.Zoom;
     }
 }
Example #8
0
        public static void Run(TraceLab.Core.ViewModels.ApplicationViewModel applicationViewModel) 
        {
            GLib.ExceptionManager.UnhandledException += new GLib.UnhandledExceptionHandler(ExceptionManager_UnhandledException);

            Application.Init();
            ApplicationContext app = new ApplicationContext(applicationViewModel);
            app.InitializeWindow();
            Application.Run();
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="RunnableNode"/> class.
 /// </summary>
 /// <param name="id">The id.</param>
 /// <param name="label">The label.</param>
 /// <param name="nextNodes">The next nodes.</param>
 /// <param name="previousNodes">The previous nodes.</param>
 /// <param name="library">The library.</param>
 /// <param name="waitForAllPredecessor">if set to <c>true</c> the node will wait for all predecessor nodes to be completed.</param>
 protected RunnableNode(String id, String label, RunnableNodeCollection nextNodes, RunnableNodeCollection previousNodes, TraceLab.Core.Components.ComponentsLibrary library, bool waitForAllPredecessors)
 {
     Id = id;
     Label = label;
     NextNodes = nextNodes;
     PreviousNodes = previousNodes;
     Library = library;
     WaitsForAllPredecessors = waitForAllPredecessors;
 }
        public BenchmarkWizard(string benchmarkDirectory, ComponentsLibrary library, Workspace workspace,
                               List<string> workspaceTypeDirectories, string dataRoot, TraceLab.Core.Settings.Settings settings)
        {
            m_workspace = workspace;
            m_componentsLibrary = library;
            m_dataRoot = dataRoot;
            m_settings = settings;
            BenchmarksDirectory = benchmarkDirectory;

        }
 /// <summary>
 /// Initializes a new s_instance of the <see cref="CompositeComponentMetadataDefinition"/> class.
 /// </summary>
 /// <param name="id">The id.</param>
 /// <param name="componentSourceFile">The component source file.</param>
 /// <param name="componentName">Name of the component.</param>
 /// <param name="label">The label.</param>
 /// <param name="version">The version.</param>
 /// <param name="description">The description.</param>
 /// <param name="author">The author.</param>
 public CompositeComponentMetadataDefinition(string id,
         TraceLab.Core.Experiments.CompositeComponentGraph componentGraph,
         string componentSourceFile, string componentName, string label, string version, string description, string author, 
         ComponentTags tags, List<DocumentationLink> documentationLinks)
     : base(id, componentSourceFile, componentName, label, version, description, author, tags, documentationLinks)
 {
     ComponentGraph = componentGraph;
     IOSpecDefinition = new IOSpecDefinition();
     ConfigurationWrapperDefinition = new ConfigWrapperDefinition(false, null);
 }
        private void SetPositionAndZoom(TraceLab.UI.WPF.ViewModels.IZoomableViewModel newModel)
        {
            //if (newModel != null)
            //{
            //    double newX = newModel.TranslateX;
            //    double newY = newModel.TranslateY;
            //    double newZoom = newModel.Zoom;

            //    zoomControl.SetPositionAndZoom(newX, newY, newZoom);
            //}
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="RunnableLoopNode"/> class.
 /// </summary>
 /// <param name="id">The id.</param>
 /// <param name="loopDecisionModule">The loop decision module.</param>
 /// <param name="compositeComponentMetadata">The composite component metadata.</param>
 /// <param name="templateGraph">The template graph.</param>
 /// <param name="workspaceWrapper">The composite component workspace wrapper.</param>
 /// <param name="library">The library.</param>
 /// <param name="waitForAllPredecessors">if set to <c>true</c> [wait for all predecessors].</param>
 public RunnableLoopNode(String id,
     TraceLab.Core.Decisions.ILoopDecisionModule loopDecisionModule,
     CompositeComponentBaseMetadata compositeComponentMetadata,
     RunnableExperimentBase templateGraph,
     NestedWorkspaceWrapper workspaceWrapper,
     TraceLab.Core.Components.ComponentsLibrary library,
     bool waitForAllPredecessors)
     : base(id, compositeComponentMetadata, templateGraph, workspaceWrapper, library, waitForAllPredecessors) 
 {
     m_loopDecisionModule = loopDecisionModule;
 }
 /// <summary>
 /// Initializes a new s_instance of the <see cref="RunnableCompositeComponentNode"/> class.
 /// </summary>
 /// <param name="id">The id.</param>
 /// <param name="compositeComponentMetadata">The composite component metadata.</param>
 /// <param name="templateGraph">The template graph.</param>
 /// <param name="workspaceWrapper">The composite component workspace wrapper.</param>
 public RunnableCompositeComponentNode(String id,
             CompositeComponentBaseMetadata compositeComponentMetadata, 
             RunnableExperimentBase templateGraph, 
             NestedWorkspaceWrapper workspaceWrapper, 
             TraceLab.Core.Components.ComponentsLibrary library, 
             bool waitForAllPredecessors)
             : base(id, compositeComponentMetadata.Label, new RunnableNodeCollection(), new RunnableNodeCollection(), library, waitForAllPredecessors)
 {
     m_compositeComponentMetadata = compositeComponentMetadata;
     m_subLevelExperiment = templateGraph;
     m_workspace = workspaceWrapper;
 }
        protected virtual void InitializeComponentGraph(TraceLab.Core.Settings.Settings settings)
        {
            if (CompositeComponentMetadata.HasDeserializationError == false)
            {
                CompositeComponentMetadata.InitializeComponentGraph(this, settings);

                //subscribe to subworkflow errors
                INotifyCollectionChanged subexperimentErrorCollection = CompositeComponentMetadata.ComponentGraph.Errors;
                subexperimentErrorCollection.CollectionChanged += SubExperimentErrorCollectionChanged;
                
            }
        }
Example #16
0
        public static void OpenNewExperiment(TraceLab.Core.ViewModels.ApplicationViewModel context, string experimentFilepath)
        {
            //find any MainWindow
            Application.Current.Dispatcher.Invoke(new Action(delegate()
            {
                //first search through opened MainWindows to see if any window already have the given experimentFilename opened
                bool found = TryActivateExistingWindow(experimentFilepath);

                if (found == false)
                {
                    OpenExperimentInNewWindow(experimentFilepath);
                }
            }));
        }
        /// <summary>
        /// Initializes a new s_instance of the <see cref="RunnableExperiment"/> class.
        /// </summary>
        /// <param name="nodesFactory">The nodes factory that is going to be used to create nodes when nodes are added to template graph.</param>
        /// <param name="library">The library.</param>
        /// <param name="componentsAppDomain">The components app domain is the app domain which components assemblies are going to be loaded into.</param>
        /// <param name="terminateExperimentExecutionResetEvent">The event that allows signalling termination of the experiment</param>
        public RunnableExperiment(IRunnableNodeFactory nodesFactory, TraceLab.Core.Components.ComponentsLibrary library,
                                  AppDomain componentsAppDomain, System.Threading.ManualResetEvent terminateExperimentExecutionResetEvent)
        {
            if (componentsAppDomain == null)
                throw new ArgumentNullException("componentsAppDomain");
            if (terminateExperimentExecutionResetEvent == null)
                throw new ArgumentNullException("terminateExperimentExecutionResetEvent");

            m_componentsAppDomain = componentsAppDomain;
            m_terminateExperimentExecutionResetEvent = terminateExperimentExecutionResetEvent;
            m_nodes = new RunnableNodeCollection();
            m_nodesFactory = nodesFactory;
            Library = library;
        }
        public ComponentLibraryViewModel(TraceLab.Core.Components.ComponentsLibrary componentsLibraryInstance, IEnumerable<string> workspaceTypeDirectories)
        {
            if (componentsLibraryInstance == null)
                throw new ArgumentNullException("componentsLibraryInstance");

            // We'll use this collection to determine which PropertyChanged notifications to pass on.
            foreach (PropertyInfo prop in typeof(ComponentLibraryViewModel).GetProperties())
            {
                m_validProperties.Add(prop.Name);
            }

            m_componentsLibraryInstance = componentsLibraryInstance;
            m_componentsLibraryInstance.PropertyChanged += m_componentsLibraryInstance_PropertyChanged;
            m_componentsLibraryInstance.Rescanning += m_componentsLibraryInstance_Rescanning;
            m_componentsLibraryInstance.Rescanned += m_componentsLibraryInstance_Rescanned;
            m_workspaceTypeDirectories = workspaceTypeDirectories;
        }
Example #19
0
        /// <summary>
        /// Loads a experiment from the specified file.
        /// </summary>
        /// <param name="filename">The filename.</param>
        /// <exception cref="TraceLab.Core.Exceptions.ExperimentLoadException">throws if experiment load fails</exception>
        /// <returns>
        /// Returns loaded m_experiment. If loading failed it returns null.
        /// </returns>
        public static Experiment Load(string fileName, TraceLab.Core.Components.ComponentsLibrary library)
        {
            Experiment experiment = null;
            try
            {
                using (System.Xml.XmlReader reader = System.Xml.XmlReader.Create(fileName))
                {
                    experiment = ExperimentSerializer.DeserializeExperiment(reader, library, fileName);
                }

                if (experiment != null)
                {
                    experiment.ResetModifiedFlag();
                }

            }
            catch (ArgumentException e)
            {
                throw new ExperimentLoadException("The experiment file could not be loaded. Filename cannot be empty. ", e);
            }
            catch (System.Security.SecurityException e)
            {
                throw new ExperimentLoadException("The experiment file could not be loaded.", e);
            }
            catch (System.IO.FileNotFoundException e)
            {
                throw new ExperimentLoadException("The experiment file has not been found.", e);
            }
            catch (System.IO.DirectoryNotFoundException e)
            {
                throw new ExperimentLoadException("The directory has not been found.", e);
            }
            catch (UriFormatException e)
            {
                throw new ExperimentLoadException("The experiment is corrupted and could not be loaded.", e);
            }
            catch (System.Xml.XmlException e)
            {
                throw new ExperimentLoadException("The experiment is corrupted and could not be loaded.", e);
            }
            
            return experiment;
        }
        /// <summary>
        /// Deserializes the experiment.
        /// </summary>
        /// <param name="reader">The reader.</param>
        /// <param name="experimentFilename">The experiment filename - needed so that experiment can set all relative config paths in relation to experiment location.</param>
        /// <returns></returns>
        internal static Experiment DeserializeExperiment(XmlReader reader, TraceLab.Core.Components.IComponentsLibrary library, string experimentFilename)
        {
            Experiment loadedFlow = null;

            if (reader != null)
            {
                IXPathNavigable doc = new XPathDocument(reader);

                var serializer = TraceLab.Core.Serialization.XmlSerializerFactory.GetSerializer(typeof(PackageSystem.PackageReference), Type.EmptyTypes);

                var references = new ObservableCollection<IPackageReference>();
                // Get the references:
                var nav = doc.CreateNavigator();
                var referenceIter = nav.Select("/graph/References/PackageReference");
                if (referenceIter != null)
                {
                    while (referenceIter.MoveNext())
                    {
                        var reference= (IPackageReference)serializer.Deserialize(referenceIter.Current.ReadSubtree());
                        references.Add(reference);
                    }
                }

                var graphFactory = new ExperimentFactoryReader(library, references, System.IO.Path.GetDirectoryName(experimentFilename));

                loadedFlow = QuickGraph.Serialization.SerializationExtensions.DeserializeFromXml<ExperimentNode, ExperimentNodeConnection, Experiment>(doc,
                    "/graph", "/graph/node", "/graph/edge",
                    graphFactory.GraphFactory,
                    graphFactory.NodeFactory,
                    graphFactory.EdgeFactory
                );

                loadedFlow.References = references;

                //Update the loaded graph and sets its start and end node
                loadedFlow.ReloadStartAndEndNode();

                loadedFlow.ExperimentInfo.FilePath = experimentFilename;
            }
            
            return loadedFlow;
        }
Example #21
0
        /// <summary>
        /// Adds item and its content (file or folder) to package.
        /// </summary>
        /// <param name="pPkg">Package being created.</param>
        /// <param name="item">Item to be added.</param>
        /// <returns>True is there was no error during the operation, false otherwise.</returns>
        public static bool AddItemToPackage(TraceLab.Core.PackageSystem.Package pkg, PackageFileSourceInfo item, bool isExperimentPackage)
        {
            bool noError = true;

            string targetPath = System.IO.Path.Combine(pkg.Location, item.GetPath());

            PackageHeirarchyItem dir = item as PackageHeirarchyItem;
            if (dir != null)
            {
                if (item.Parent != null)
                {
                    System.IO.Directory.CreateDirectory(targetPath);
                }

                foreach (PackageFileSourceInfo child in dir.Children)
                {
                    noError = noError && AddItemToPackage(pkg, child, isExperimentPackage);
                }

                if (dir.HasComponents)
                {
                    pkg.SetDirectoryHasComponents(dir.GetPath(), true);
                }
                if (dir.HasTypes)
                {
                    pkg.SetDirectoryHasTypes(dir.GetPath(), true);
                }
            }
            else
            {
                System.IO.File.Copy(item.SourceFilePath, targetPath);
                //Add reference to this created package to all experiments and composite components
                if (isExperimentPackage && targetPath.EndsWith(".teml") || targetPath.EndsWith(".tcml"))
                {
                    noError = noError && AddPkgRefToExperiment(pkg, targetPath);
                }
                System.IO.File.SetAttributes(targetPath, System.IO.File.GetAttributes(targetPath) & ~System.IO.FileAttributes.ReadOnly);
                pkg.AddFile(targetPath);
            }

            return noError;
        }
        /// <summary>
        /// A WPF-aware viewmodel to wrap the main system WorkspaceViewModel.  
        /// 
        /// Note: This must be constructed on the main UI thread.
        /// </summary>
        /// <param name="workspaceViewModel">The WorkspaceViewModel to wrap.</param>
        public WorkspaceViewModelWrapper(TraceLab.Core.ViewModels.WorkspaceViewModel workspaceViewModel)
        {
            if (workspaceViewModel == null)
                throw new ArgumentNullException("workspaceViewModel");

            m_workspaceViewModel = workspaceViewModel;
            m_workspaceViewModel.PropertyChanged += new PropertyChangedEventHandler(m_workspaceViewModel_PropertyChanged);

            Dispatch = Dispatcher.CurrentDispatcher;

            // Pre-fill our units with what's in the workspace view model prior to exposing it
            // this is a mild performance tweak.
            foreach (WorkspaceUnit unit in m_workspaceViewModel.WorkspaceUnitCollection)
            {
                AddUnit(unit);
            }

            m_readOnlyUnits = new ReadOnlyObservableCollection<WpfWorkspaceUnitWrapper>(m_units);

            INotifyCollectionChanged workspaceCollection = m_workspaceViewModel.WorkspaceUnitCollection;
            workspaceCollection.CollectionChanged += WorkspaceCollectionCollectionChanged;
        }
        internal static IExperimentRunner CreateExperimentRunner(IExperiment currentExperiment,
                TraceLab.Core.Workspaces.Workspace workspace,
                TraceLab.Core.Components.ComponentsLibrary library)
        {
            // Allow all nodes to send info to logs - if any targets exist.
            foreach (TraceLab.Core.Experiments.ExperimentNode node in currentExperiment.Vertices)
            {
                var componentNode = node as TraceLab.Core.Experiments.ComponentNode;
                if (componentNode != null)
                {
                    foreach (TraceLab.Core.Settings.LogLevelItem item in componentNode.Data.Metadata.LogLevels)
                    {
                        item.IsEnabled = true;
                    }
                }
            }

            RunnableNodeFactory templateGraphNodesFactory = new RunnableNodeFactory(workspace);
            TraceLab.Core.ExperimentExecution.RunnableExperimentBase template = GraphAdapter.Adapt(currentExperiment, templateGraphNodesFactory, library, workspace.TypeDirectories);

            var dispatcher = ExperimentRunnerFactory.CreateExperimentRunner(template);
            return dispatcher;
        }
 private static void ReloadApplicationViewModel(TraceLab.Core.Experiments.Experiment experiment)
 {
     ConsoleInstance.StopListenToLogEvents();
     ConsoleInstance.Application = ApplicationViewModel.CreateNewApplicationViewModel(ConsoleInstance.Application, experiment);
     ConsoleInstance.StartListenToLogEvents();
 }
 /// <summary>
 /// Gets the origin canvas point of the scope
 /// </summary>
 /// <param name="scopeNode">The scope node.</param>
 /// <param name="topCanvasOffset">The top canvas offset.</param>
 /// <param name="scopeCenter">The scope center.</param>
 /// <returns></returns>
 private static Point GetOriginCanvasPoint(TraceLab.Core.Experiments.ScopeNodeBase scopeNode, double topCanvasOffset, ref Point scopeCenter)
 {
     Point originCanvasPoint = new Point(scopeCenter.X - scopeNode.DataWithSize.Width / 2, scopeCenter.Y - scopeNode.DataWithSize.Height / 2 + topCanvasOffset);
     return originCanvasPoint;
 }
 /// <summary>
 /// Adjusts the point to scope canvas origin of the scope node
 /// </summary>
 /// <param name="pointToAdjust">The point to adjust.</param>
 /// <param name="scopeNode">The scope node.</param>
 /// <param name="topCanvasOffset">The top canvas offset - represents the offset from top border of the scope to start of the inside canvas. </param>
 /// <param name="scopeCenter">The scope center.</param>
 /// <returns></returns>
 private static Point AdjustPointToScopeCanvasOrigin(Point pointToAdjust, TraceLab.Core.Experiments.ScopeNodeBase scopeNode, double topCanvasOffset, ref Point scopeCenter)
 {
     Point originCanvasPoint = GetOriginCanvasPoint(scopeNode, topCanvasOffset, ref scopeCenter);
     Point adjustedPoint = AdjustPointToGivenOriginPoint(pointToAdjust, ref originCanvasPoint);
     return adjustedPoint;
 }
 /// <summary>
 /// Gets the point of top border center with a given padding to border
 /// </summary>
 /// <param name="scopeNode">The scope node.</param>
 /// <param name="paddingBottom">The padding from top border.</param>
 /// <param name="topCanvasOffset">The top canvas offset - scope may have label, thus graph canvas is off by some amount from top.</param>
 /// <returns>top border center</returns>
 public static Point GetTopBorderCenter(TraceLab.Core.Experiments.ScopeNodeBase scopeNode, double paddingTop, double topCanvasOffset)
 {
     Point scopeCenter = new Point(scopeNode.Data.X, scopeNode.Data.Y);
     Point topBorderCenter = new Point(scopeCenter.X, scopeCenter.Y - scopeNode.DataWithSize.Height / 2 + paddingTop + topCanvasOffset);
     Point adjustedPoint = AdjustPointToScopeCanvasOrigin(topBorderCenter, scopeNode, topCanvasOffset, ref scopeCenter);
     return adjustedPoint;
 }
 public RunnableNode CreateNode(string id, Metadata metadata, LoggerNameRoot loggerNameRoot, TraceLab.Core.Components.ComponentsLibrary library, AppDomain componentsAppDomain,
     System.Threading.ManualResetEvent terminateExperimentExecutionResetEvent)
 {
     return CreateNode(id, metadata, terminateExperimentExecutionResetEvent);
 }
 /// <summary>
 /// Initializes the component graph from ComponentMetadataDefinition graph
 /// </summary>
 /// <param name="node">The node.</param>
 /// <param name="settings">The settings.</param>
 public override void InitializeComponentGraph(CompositeComponentNode node, TraceLab.Core.Settings.Settings settings)
 {
     //each composite node gets its own copy of ComponentMetadataDefinition.ComponentGraph
     m_compositeComponentGraph = new CompositeComponentGraph(node, ComponentMetadataDefinition.ComponentGraph);
     m_compositeComponentGraph.Settings = settings;
 }
Example #30
0
 protected virtual void InitializeComponentGraph(TraceLab.Core.Settings.Settings settings)
 {
     CompositeComponentMetadata.InitializeComponentGraph(this, settings);
 }