Can VS2010 Workflow Designer automatically organize the layout?

Is there a way in VS2010 WF4 workflow designer to make it automate layout layout? I want to add a new step at the top of the workflow, and I see no way to easily make room for a new element. The process thread under where I want to add a new step is a switch statement with several branches; it’s not even possible to repeatedly select elements and move them down to make room.

+4
source share
3 answers

Unfortunately, there is no way other than adding what you want to add and then deleting the .layout file, forcing it to generate a new layout. Make sure you back up the file if the new layout is worse than the old.

+3
source

Expand the DataSet.xsd tree and delete the XSS file ...

DataSet.xsd --DataSet.cs --DataSet.xsc --DataSet.xss <-- Delete this one... --DataSet.cs --DataSet.Designer.cs 
+2
source

If you are adventurous, you can run such code (first back up your XSS file, this code will overwrite it!). The code will automatically arrange the shapes in the designer. You can adjust the constants for a better effect. Their meanings should be obvious.

 using System; using System.Collections.Generic; using System.Linq; using System.Xml.Linq; using System.Text; namespace AutoArrangeXss { class Program { static void Main(string[] args) { AutoArrange(yourXssFilePath); } static void AutoArrange(string xssFile) { const int xPad = 80; const int yPad = 20; const int maxY = 1500; XDocument doc = XDocument.Load(xssFile); var ns = doc.Root.Name.Namespace; var shapes = doc.Descendants(ns + "Shape").ToList(); int X = 0; int Y = 0; int columnW = 0; foreach (XElement shape in shapes) { int Height = int.Parse(shape.Attribute("Height").Value); int Width = int.Parse(shape.Attribute("Width").Value); if (Width > columnW) columnW = Width; shape.Attribute("X").Value = X.ToString(); shape.Attribute("Y").Value = Y.ToString(); Y += Height + yPad; if (Y > maxY) { X += columnW + xPad; Y = 0; columnW = 0; } } doc.Save(xssFile); } 
-one
source

Source: https://habr.com/ru/post/1394619/


All Articles