public MainViewModel() { ButtonEventNode eventNode = new ButtonEventNode { CanBeRemovedByUser = false }; Network.Nodes.Add(eventNode); //NodeList.AddNodeType(() => new ButtonEventNode()); NodeList.AddNodeType(() => new ForLoopNode()); NodeList.AddNodeType(() => new IntLiteralNode()); NodeList.AddNodeType(() => new PrintNode()); NodeList.AddNodeType(() => new TextLiteralNode()); var codeObservable = eventNode.OnClickFlow.Values.Changed.Select(_ => new StatementSequence(eventNode.OnClickFlow.Values)); codeObservable.BindTo(this, vm => vm.CodePreview.Code); codeObservable.BindTo(this, vm => vm.CodeSim.Code); ForceDirectedLayouter layouter = new ForceDirectedLayouter(); var config = new Configuration { Network = Network, }; AutoLayout = ReactiveCommand.Create(() => layouter.Layout(config, 10000)); StartAutoLayoutLive = ReactiveCommand.CreateFromObservable(() => Observable.StartAsync(ct => layouter.LayoutAsync(config, ct)).TakeUntil(StopAutoLayoutLive) ); StopAutoLayoutLive = ReactiveCommand.Create(() => { }, StartAutoLayoutLive.IsExecuting); }
private void AutoLayout(object sender, RoutedEventArgs e) { var layout = new ForceDirectedLayouter(); layout.Layout(new Configuration { Network = _network }, 1000); }
private void LayoutO_Click(object sender, RoutedEventArgs e) { ForceDirectedLayouter layouter = new ForceDirectedLayouter(); var config = new Configuration { Network = ConversationWorkspace.ViewModel, }; layouter.Layout(config, 20000); }