private void AddMetric(Point position, MetricManager.MetricInfo metricInfo) { var viewPosition = nodeGraphPanel.ControlToWorld(position); if (GraphRunning) { if (AskStopGraph()) { StopGraph(); } else { return; } } if (metricInfo != null) { NodeSystemLib2.Node metric = null; try { metric = metricInfo.CreateInstance(_graph); } catch (Exception e) { GlobalSettings.Instance.UserLog.Add(new GraphMessage(Graph, LogMessage.LogType.Error, $"In AddMetric for {metricInfo.Name}: {e}")); return; } var graphNode = new GraphNode( node: metric, factoryId: metricInfo.FactoryGuid, uniqueName: metricInfo.UniqueName, pX: viewPosition.X, pY: viewPosition.Y ); nodeGraphPanel.Nodes.Add(graphNode); } else { throw new ArgumentNullException(); } }