private void RemoveGraph_Unsynchronized(IGraphController ctrl) { if (ctrl is IViewContent content) { Current.Workbench.CloseContent(content); } }
internal PropertyNode(IGraphController graphController, string assembly, string qualifiedName, string argumentTypes) : base(graphController, NodeType.Property) { this.Caption = qualifiedName; string[] splitQualifiedName = qualifiedName.Split('.'); if (null != splitQualifiedName && (splitQualifiedName.Length >= 1)) { this.Caption = splitQualifiedName[1]; } this.Text = this.graphController.GetRuntimeStates().GenerateTempVariable(this.nodeId); this.Assembly = assembly; this.QualifiedName = qualifiedName; this.ArgumentTypes = argumentTypes; this.ReturnType = string.Empty; this.UpdateReturnTypeAndMemberType(); this.UpdateInputSlot(); //Output slot Slot outputSlot = new Slot(graphController, SlotType.Output, this); this.graphController.AddSlot(outputSlot); this.outputSlots.Add(outputSlot.SlotId); this.CheckDots(); }
public IGraphController GetController(uint identifier) { if (uint.MaxValue == identifier) // Get the current controller. { if (null == graphCanvases || (graphCanvases.Count <= 0)) { return(null); } GraphCanvas graphCanvas = graphCanvases[currentGraphCanvas]; if (null == graphCanvas.VisualHost) // When file first loaded. { return(null); } return(graphCanvases[currentGraphCanvas].Controller); } foreach (GraphCanvas canvas in graphCanvases) { IGraphController controller = canvas.Controller; if (controller.Identifier == identifier) { return(controller); } } return(null); }
internal InfoBubble(IGraphController controller, uint nodeId) { this.graphController = controller as GraphController; this.nodeId = nodeId; IdGenerator idGenerator = this.graphController.GetIdGenerator(); this.bubbleId = idGenerator.GetNextId(ComponentType.Bubble); this.graphController.AddBubble(this); }
protected override void OnControllerChanged(IGraphController oldController, IGraphController newController) { base.OnControllerChanged(oldController, newController); if (newController != null) { newController.RequestVirtualRangeChange(); } }
/// <summary> /// Plots the currently selected data columns of a worksheet. /// </summary> /// <param name="dg">The worksheet controller where the columns are selected in.</param> public static void PlotLinePolar(GUI.WorksheetController dg) { Altaxo.Graph.Gdi.GraphDocument graph = new Altaxo.Graph.Gdi.GraphDocument(); Altaxo.Graph.Gdi.XYPlotLayer layer = new Altaxo.Graph.Gdi.XYPlotLayer(graph.DefaultLayerPosition, graph.DefaultLayerSize, new Altaxo.Graph.Gdi.CS.G2DPolarCoordinateSystem()); layer.CreateDefaultAxes(); graph.Layers.Add(layer); Current.Project.GraphDocumentCollection.Add(graph); IGraphController gc = Plot(dg.DataTable, dg.SelectedDataColumns, graph, PlotStyle_Line, GroupStyle_Color_Line); }
internal CodeBlockNode(IGraphController graphController, SnapshotNode snapshotNode) : base(graphController, NodeType.CodeBlock) { this.Caption = string.Empty; this.Text = snapshotNode.Content; string error; ErrorType errorType; AmendInputOutputSlots(out error, out errorType); }
public static IVisualNode Create(IGraphController graphController, IStorage storage) { if (graphController == null || storage == null) { throw new ArgumentNullException("graphcontroller, storage"); } storage.Seek(12, SeekOrigin.Current); //Skip NodeSignature NodeType type = (NodeType)storage.ReadInteger(FieldCode.NodeType); storage.Seek(-24, SeekOrigin.Current); //Shift cursor back to the start point of reading NodeSignature VisualNode node = null; switch (type) { case NodeType.CodeBlock: node = new CodeBlockNode(graphController); node.Deserialize(storage); break; case NodeType.Condensed: node = new CondensedNode(graphController); node.Deserialize(storage); break; case NodeType.Driver: node = new DriverNode(graphController); node.Deserialize(storage); break; case NodeType.Function: node = new FunctionNode(graphController); node.Deserialize(storage); break; case NodeType.Identifier: node = new IdentifierNode(graphController); node.Deserialize(storage); break; case NodeType.Property: node = new PropertyNode(graphController); node.Deserialize(storage); break; case NodeType.Render: node = new RenderNode(graphController); node.Deserialize(storage); break; default: throw new ArgumentException("Invalid 'nodeType'"); } return(node); }
internal FunctionNode(IGraphController graphController, string assembly, string qualifiedName, string argumentTypes) : base(graphController, NodeType.Function) { this.Text = this.graphController.GetRuntimeStates().GenerateTempVariable(this.nodeId); this.Assembly = assembly; this.QualifiedName = qualifiedName; this.ArgumentTypes = argumentTypes; this.argumentNames = CoreComponent.Instance.GetArgumentNames(this.Assembly, this.QualifiedName, this.ArgumentTypes); this.UpdateReturnTypeAndMemberType(); int lastDot = 0; string className = string.Empty; switch (this.MemberType) { case LibraryItem.MemberType.Constructor: lastDot = qualifiedName.LastIndexOf('.'); if (-1 == lastDot) this.Caption = qualifiedName; else this.Caption = qualifiedName.Substring(0, lastDot); break; case LibraryItem.MemberType.StaticMethod: lastDot = qualifiedName.LastIndexOf('.'); if (-1 == lastDot) this.Caption = qualifiedName; else this.Caption = qualifiedName.Substring(lastDot + 1); break; case LibraryItem.MemberType.InstanceMethod: case LibraryItem.MemberType.InstanceProperty: lastDot = qualifiedName.LastIndexOf('.'); this.Caption = qualifiedName.Substring(lastDot + 1); break; default: this.Caption = qualifiedName; break; } //Input slot this.CreateInputSlotsFromArgumentTypes(this.ArgumentTypes); //Output slot Slot outputSlot = new Slot(graphController, SlotType.Output, this); this.graphController.AddSlot(outputSlot); this.outputSlots.Add(outputSlot.SlotId); this.replicationGuideStrings.Clear(); this.replicationGuides.Clear(); foreach (uint slot in this.inputSlots) { this.replicationGuides.Add(new List<int>()); this.replicationGuideStrings.Add(string.Empty); } this.CheckDots(); }
public void TestCreate00() { IGraphController graphController = null; IStorage storage = new BinaryStorage(); Assert.Throws <ArgumentNullException>(() => { ISlot slot = Slot.Create(graphController, storage); }); }
private void OnCanvasModified(object sender, EventArgs e) { IGraphController graphController = (IGraphController)sender; if (graphController == null) { return; } tabControl.UpdateTabText(graphController.Identifier); }
internal DriverNode(IGraphController graphController, string text) : base(graphController, NodeType.Driver) { this.centerLine = Configurations.DriverNodeCenterLine; this.Caption = this.graphController.GetRuntimeStates().GenerateTempVariable(this.nodeId); this.Text = Configurations.DriverInitialTextValue; Slot outputSlot = new Slot(graphController, SlotType.Output, this); this.graphController.AddSlot(outputSlot); this.outputSlots.Add(outputSlot.SlotId); }
public void Setup(IGraphController controller) { Console.WriteLine("Welcome\nDo you wish to log in? Y/N"); var consoleAction = Console.ReadLine(); if (consoleAction.ToLower() == "y") { controller.SignOut(); } controller.SignIn(); }
protected VisualNode(IGraphController graphController, NodeType nodeType) { this.graphController = graphController as GraphController; IdGenerator idGenerator = this.graphController.GetIdGenerator(); this.nodeType = nodeType; this.version = VisualNode.Version.Current; this.nodeId = idGenerator.GetNextId(ComponentType.Node); this.nodeState = States.Visible; this.Dirty = true; this.graphController.AddVisualNode(this); }
/// <summary> /// Called when the controller has changed. /// </summary> /// <param name="oldController">The old controller.</param> /// <param name="newController">The new controller.</param> protected virtual void OnControllerChanged(IGraphController oldController, IGraphController newController) { if (oldController != null) { oldController.VirtualRangeChanged -= OnVirtualRangeChanged; } if (newController != null) { newController.VirtualRangeChanged += OnVirtualRangeChanged; } }
/// <summary> /// Called when the <see cref="Controller"/> property has changed. /// </summary> /// <param name="oldController">The old controller.</param> /// <param name="newController">The new controller.</param> protected virtual void OnControllerChanged(IGraphController <WpfGraphDataSeries> oldController, IGraphController <WpfGraphDataSeries> newController) { if (oldController != null) { oldController.Surface = null; } if (newController != null) { newController.Surface = this; } }
/// <summary> /// Create an instance of a slot given storage /// </summary> /// <param name="graphController"></param> /// <param name="storage"></param> /// <returns></returns> internal static ISlot Create(IGraphController graphController, IStorage storage) { if (graphController == null || storage == null) { throw new ArgumentNullException("graphController, storage"); } ISlot slot = new Slot(graphController); slot.Deserialize(storage); return(slot); }
private GraphCanvas GetCanvas(uint identifier) { IGraphController controller = GetController(identifier); foreach (GraphCanvas canvas in graphCanvases) { if (canvas.Controller == controller) { return(canvas); } } return(null); }
/// <summary> /// Create a new slot /// </summary> /// <param name="gc">Owning graph controller</param> /// <param name="type">Input/Output slot</param> /// <param name="firstOwner">Node where there slot resides</param> internal Slot(IGraphController gc, SlotType type, IVisualNode firstOwner) { if (gc == null || firstOwner == null) throw new ArgumentNullException(); this.graphController = gc as GraphController; Validity.Assert(this.graphController != null); IdGenerator idGenerator = this.graphController.GetIdGenerator(); this.slotType = type; this.version = Slot.Version.Current; this.slotId = idGenerator.GetNextId(ComponentType.Slot); this.slotState = SlotStates.Visible; this.owners.Add(firstOwner.NodeId); }
/// <summary> /// Create a new slot /// </summary> /// <param name="gc">Owning graph controller</param> /// <param name="type">Input/Output slot</param> /// <param name="firstOwner">Node where there slot resides</param> internal Slot(IGraphController gc, SlotType type, IVisualNode firstOwner) { if (gc == null || firstOwner == null) { throw new ArgumentNullException(); } this.graphController = gc as GraphController; Validity.Assert(this.graphController != null); IdGenerator idGenerator = this.graphController.GetIdGenerator(); this.slotType = type; this.version = Slot.Version.Current; this.slotId = idGenerator.GetNextId(ComponentType.Slot); this.slotState = SlotStates.Visible; this.owners.Add(firstOwner.NodeId); }
internal IdentifierNode(IGraphController graphController, string caption) : base(graphController, NodeType.Identifier) { this.Assembly = string.Empty; this.ReturnType = string.Empty; this.Caption = this.graphController.GetRuntimeStates().GenerateTempVariable(this.nodeId); this.Text = string.Empty; this.UpdateInternalData(true); //1 input slot Slot newSlot = new Slot(graphController, SlotType.Input, this); this.graphController.AddSlot(newSlot); this.inputSlots.Add(newSlot.SlotId); //1 output slot newSlot = new Slot(graphController, SlotType.Output, this); this.graphController.AddSlot(newSlot); this.outputSlots.Add(newSlot.SlotId); }
internal void GraphControllerLoaded(uint identifier) { IGraphController graphController = GetController(identifier); if (graphController == null) { return; } // update the libraryView if there is any script need to be imported // the actuall importing is in the GraphControl::LoadFileInternal() List <string> importedScripts = graphController.GetImportedScripts(); if (importedScripts != null && importedScripts.Count > 0) { this.libraryView.FinishLoadingLibrary(); } graphController.Modified += new CanvasModifiedHandler(OnCanvasModified); }
internal PropertyNode(IGraphController graphController, string assembly, string qualifiedName, string argumentTypes) : base(graphController, NodeType.Property) { this.Caption = qualifiedName; string[] splitQualifiedName = qualifiedName.Split('.'); if (null != splitQualifiedName && (splitQualifiedName.Length >= 1)) this.Caption = splitQualifiedName[1]; this.Text = this.graphController.GetRuntimeStates().GenerateTempVariable(this.nodeId); this.Assembly = assembly; this.QualifiedName = qualifiedName; this.ArgumentTypes = argumentTypes; this.ReturnType = string.Empty; this.UpdateReturnTypeAndMemberType(); this.UpdateInputSlot(); //Output slot Slot outputSlot = new Slot(graphController, SlotType.Output, this); this.graphController.AddSlot(outputSlot); this.outputSlots.Add(outputSlot.SlotId); this.CheckDots(); }
internal UndoRedoRecorder(IGraphController graphController) { this.graphController = graphController as GraphController; this.actionCount = -1; }
internal CondensedNode(IGraphController graphController, string text) : base(graphController, NodeType.Condensed) { this.Text = text; this.Caption = string.Empty; }
/// <summary>This will remove the GraphController <paramref>ctrl</paramref> from the graph forms collection.</summary> /// <param name="ctrl">The GraphController to remove.</param> /// <remarks>No exception is thrown if the Form frm is not a member of the graph forms collection.</remarks> public void RemoveGraph(IGraphController ctrl) { Current.Gui.Execute(RemoveGraph_Unsynchronized, ctrl); }
public SelectionBox(IGraphController graphController, IGraphVisualHost visualHost) { this.graphController = graphController; this.visualHost = visualHost; InitializeSelectionBox(); }
internal CodeBlockNode(IGraphController graphController, string text) : base(graphController, NodeType.CodeBlock) { this.Caption = string.Empty; this.Text = text; }
private Slot(IGraphController graphController) { this.graphController = graphController as GraphController; }
internal IdentifierNode(IGraphController graphController) : base(graphController) { }
internal RenderNode(IGraphController graphController, int inputSlotCount) : base(graphController, NodeType.Render) { this.Text = string.Empty; this.Caption = string.Empty; }
internal DriverNode(IGraphController graphController) : base(graphController) { }
internal RenderNode(IGraphController graphController) : base(graphController) { }
internal FunctionNode(IGraphController graphController) : base(graphController) { }
private void RemoveGraph_Unsynchronized(IGraphController ctrl) { foreach (IViewContent content in WorkbenchSingleton.Workbench.ViewContentCollection) { if ((content is Altaxo.Gui.IMVCControllerWrapper) && object.ReferenceEquals(((Altaxo.Gui.IMVCControllerWrapper)content).MVCController, ctrl)) { content.WorkbenchWindow.CloseWindow(true); break; } } }
protected VisualNode(IGraphController graphController) { this.graphController = graphController as GraphController; IdGenerator idGenerator = this.graphController.GetIdGenerator(); }
internal CodeBlockNode(IGraphController graphController) : base(graphController) { }
/// <summary> /// Create an instance of a slot given storage /// </summary> /// <param name="graphController"></param> /// <param name="storage"></param> /// <returns></returns> internal static ISlot Create(IGraphController graphController, IStorage storage) { if (graphController == null || storage == null) throw new ArgumentNullException("graphController, storage"); ISlot slot = new Slot(graphController); slot.Deserialize(storage); return slot; }
internal CondensedNode(IGraphController graphController) : base(graphController) { }
public static IVisualNode Create(IGraphController graphController, IStorage storage) { if (graphController == null || storage == null) throw new ArgumentNullException("graphcontroller, storage"); storage.Seek(12, SeekOrigin.Current); //Skip NodeSignature NodeType type = (NodeType)storage.ReadInteger(FieldCode.NodeType); storage.Seek(-24, SeekOrigin.Current); //Shift cursor back to the start point of reading NodeSignature VisualNode node = null; switch (type) { case NodeType.CodeBlock: node = new CodeBlockNode(graphController); node.Deserialize(storage); break; case NodeType.Condensed: node = new CondensedNode(graphController); node.Deserialize(storage); break; case NodeType.Driver: node = new DriverNode(graphController); node.Deserialize(storage); break; case NodeType.Function: node = new FunctionNode(graphController); node.Deserialize(storage); break; case NodeType.Identifier: node = new IdentifierNode(graphController); node.Deserialize(storage); break; case NodeType.Property: node = new PropertyNode(graphController); node.Deserialize(storage); break; case NodeType.Render: node = new RenderNode(graphController); node.Deserialize(storage); break; default: throw new ArgumentException("Invalid 'nodeType'"); } return node; }
internal PropertyNode(IGraphController graphController) : base(graphController) { }
internal PreviewBubble(IGraphController graphController, uint nodeId) : base(graphController, nodeId) { }
/// <summary> /// Plots the currently selected data columns of a worksheet as horzizontal bar diagram. /// </summary> /// <param name="dg">The worksheet controller where the columns are selected in.</param> public static void PlotBarChartRelativeStack(GUI.WorksheetController dg) { IGraphController gc = Plot(dg.DataTable, dg.SelectedDataColumns, PlotStyle_Bar, GroupStyle_RelativeStack_Bar); ((G2DCartesicCoordinateSystem)gc.Doc.Layers[0].CoordinateSystem).IsXYInterchanged = true; }
internal FunctionNode(IGraphController graphController, string assembly, string qualifiedName, string argumentTypes) : base(graphController, NodeType.Function) { this.Text = this.graphController.GetRuntimeStates().GenerateTempVariable(this.nodeId); this.Assembly = assembly; this.QualifiedName = qualifiedName; this.ArgumentTypes = argumentTypes; this.argumentNames = CoreComponent.Instance.GetArgumentNames(this.Assembly, this.QualifiedName, this.ArgumentTypes); this.UpdateReturnTypeAndMemberType(); int lastDot = 0; string className = string.Empty; switch (this.MemberType) { case LibraryItem.MemberType.Constructor: lastDot = qualifiedName.LastIndexOf('.'); if (-1 == lastDot) { this.Caption = qualifiedName; } else { this.Caption = qualifiedName.Substring(0, lastDot); } break; case LibraryItem.MemberType.StaticMethod: lastDot = qualifiedName.LastIndexOf('.'); if (-1 == lastDot) { this.Caption = qualifiedName; } else { this.Caption = qualifiedName.Substring(lastDot + 1); } break; case LibraryItem.MemberType.InstanceMethod: case LibraryItem.MemberType.InstanceProperty: lastDot = qualifiedName.LastIndexOf('.'); this.Caption = qualifiedName.Substring(lastDot + 1); break; default: this.Caption = qualifiedName; break; } //Input slot this.CreateInputSlotsFromArgumentTypes(this.ArgumentTypes); //Output slot Slot outputSlot = new Slot(graphController, SlotType.Output, this); this.graphController.AddSlot(outputSlot); this.outputSlots.Add(outputSlot.SlotId); this.replicationGuideStrings.Clear(); this.replicationGuides.Clear(); foreach (uint slot in this.inputSlots) { this.replicationGuides.Add(new List <int>()); this.replicationGuideStrings.Add(string.Empty); } this.CheckDots(); }
public GraphVisualHost(GraphCanvas graphCanvas, GraphControl graphControl, string startupFile) { this.graphCanvas = graphCanvas; this.graphControl = graphControl; if (children == null) children = new VisualCollection(this); if (string.IsNullOrEmpty(startupFile)) this.graphController = ClassFactory.CreateGraphController(this); else { try { this.graphController = ClassFactory.CreateGraphController(this, startupFile); } catch (FileNotFoundException e) { MessageBox.Show(string.Format("FileNotFoundException: {0}", e.FileName)); } catch (IOException e) { MessageBox.Show(string.Format("IOException: {0}", e.Message)); } catch (InvalidDataException e) { MessageBox.Show(string.Format("InvalidDataException: {0}", e.Message)); } catch (FileVersionException e) { string message = string.Format(UiStrings.FutureFileVersionFmt, e.RequiredAppVersion); MessageBoxResult result = MessageBoxResult.None; string caption = UiStrings.IncompatibleVersion; result = MessageBox.Show(message, caption, MessageBoxButton.OKCancel); if (result == MessageBoxResult.OK) { System.Diagnostics.Process.Start(CoreStrings.DesignScriptSiteUrl); } } catch (Exception e) { this.graphController = ClassFactory.CreateGraphController(this); this.graphControl.DisplayException(e); } finally { if (null == graphController) this.graphController = ClassFactory.CreateGraphController(this); } } DrawingVisual foregroundVisual = new DrawingVisual(); edgeVisuals.Add(foregroundVisual, 0); this.children.Add(foregroundVisual); if (!string.IsNullOrEmpty(startupFile)) this.ZoomToFit(); }
internal ErrorBubble(IGraphController graphController, uint nodeId) : base(graphController, nodeId) { this.content = (object)string.Empty; this.ErrType = ErrorType.None; }