void OKButton_Click(object sender, RoutedEventArgs e) { flowName = qfnw.GetFlowName(); nodes.ForEach(nodePair => { nodePair.Value.xpos = nodePair.Key.Position.X; nodePair.Value.ypos = nodePair.Key.Position.Y; }); WorkflowJsonObject json = new WorkflowJsonObject(); json.nodes = nodes.Values.ToList(); json.connections = connections.Keys.ToList(); var data = DataManager.ToJson(json); WebClient wc = new WebClient(); Uri uri = new Uri(SiteBaseUri, string.Format("Workflow/NewFlowFromJson")); // mod 20130605 // mod 20130621 wc.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded"; wc.UploadStringAsync(uri, "POST", "name=" + flowName + "&data=" + data); wc.UploadStringCompleted += new UploadStringCompletedEventHandler(wc_UploadStringCompleted); }
private void btnSubmit1_Click(object sender, RoutedEventArgs e) { nodes.ForEach(nodePair => { nodePair.Value.xpos = nodePair.Key.Position.X; nodePair.Value.ypos = nodePair.Key.Position.Y; }); WorkflowJsonObject json = new WorkflowJsonObject(); json.nodes = nodes.Values.ToList(); json.connections = connections.Keys.ToList(); var data = DataManager.ToJson(json); WebClient wc = new WebClient(); //Uri uri = new Uri(SiteBaseUri, string.Format("Workflow/SaveFlow?data={0}", data)); Uri uri = new Uri(SiteBaseUri, string.Format("Workflow/SaveFlow")); // mod 20130621 wc.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded"; wc.UploadStringAsync(uri, "POST", "data=" + data); wc.UploadStringCompleted += new UploadStringCompletedEventHandler(wc_UploadStringCompleted); }
public void InitNodesAndConnections(WorkflowJsonObject flow) { workflowId = flow.id; nodes.Clear(); connections.Clear(); foreach (var node in flow.nodes) { foreach (var x in MyCanvas.Children) { if (x is Node) { Node nodeMark = x as Node; if (nodeMark.Text == node.name) { nodes.Add(nodeMark, node); break; } } } } foreach (var conn in flow.connections) { Point start = new Point(flow.nodes[conn.from].xpos, flow.nodes[conn.from].ypos); Point end = new Point(flow.nodes[conn.to].xpos, flow.nodes[conn.to].ypos); foreach (var x in MyCanvas.Children) { if (x is BezierLink) { BezierLink arrow = x as BezierLink; if (arrow.StartPoint == start && arrow.EndPoint == end) { connections.Add(conn, arrow); break; } } } } }