private void _AddParameter_Exec(object parameter) { int Id = (int)parameter; var emptyParameter = new FormElement(_View) { Elements = _View.MainView.LoadedDiagram.MethodParameters, Types = _View.MainView.LoadedDiagram.Subjects }; SubElements.Add(emptyParameter); }
public void Update() { foreach (AssemblerIconElement element in SubElements.OfType <AssemblerIconElement>().ToList()) { if (!AssemblerList.Keys.Contains(element.DisplayedMachine)) { SubElements.Remove(element); } } foreach (var kvp in AssemblerList) { if (!SubElements.OfType <AssemblerIconElement>().Any(aie => aie.DisplayedMachine == kvp.Key)) { SubElements.Add(new AssemblerIconElement(kvp.Key, kvp.Value, Parent)); } } int y = (int)(Height / Math.Ceiling(AssemblerList.Count / 2d)); int widthOver2 = this.Width / 2; int i = 0; foreach (AssemblerIconElement element in SubElements.OfType <AssemblerIconElement>()) { element.DisplayedNumber = AssemblerList[element.DisplayedMachine]; if (i % 2 == 0) { element.X = widthOver2 - element.Width; } else { element.X = widthOver2; } element.Y = (int)Math.Floor(i / 2d) * y; if (AssemblerList.Count == 1) { element.X = (Width - element.Width) / 2; } else if (i == AssemblerList.Count - 1 && AssemblerList.Count % 2 != 0) { element.X = widthOver2 - (element.Width / 2); } i++; } }
public NodeElement(ProductionNode node, ProductionGraphViewer parent) : base(parent) { Width = 100; Height = 90; DisplayedNode = node; if (DisplayedNode.GetType() == typeof(ConsumerNode)) { backgroundColour = supplyColour; } else if (DisplayedNode.GetType() == typeof(SupplyNode)) { backgroundColour = consumerColour; } else { backgroundColour = recipeColour; } backgroundBrush = new SolidBrush(backgroundColour); foreach (Item item in node.Inputs) { ItemTab newTab = new ItemTab(item, LinkType.Input, Parent); SubElements.Add(newTab); inputTabs.Add(newTab); } foreach (Item item in node.Outputs) { ItemTab newTab = new ItemTab(item, LinkType.Output, Parent); SubElements.Add(newTab); outputTabs.Add(newTab); } if (DisplayedNode is RecipeNode || DisplayedNode is SupplyNode) { assemblerBox = new AssemblerBox(Parent); SubElements.Add(assemblerBox); assemblerBox.Height = assemblerBox.Width = 50; } centreFormat.Alignment = centreFormat.LineAlignment = StringAlignment.Center; }
public Element(bool a) { id = Randomizer.Nombre(); Val1 = Randomizer.Nombre(); Val2 = "Elem " + Randomizer.Chaine(2); Val3 = "Elem " + Randomizer.Chaine(2); if (SubElements == null) { SubElements = new List <SubElement>(); } if (SubElementsX == null) { SubElementsX = new List <SubElementX>(); } for (int i = 1; i < Randomizer.Nombre(4) + 2; i++) { SubElements.Add(new SubElement(true)); SubElements[i - 1].PropertyChanged += new PropertyChangedEventHandler(SubElem_PropertyChanged); SubElementsX.Add(new SubElementX(true)); SubElementsX[i - 1].PropertyChanged += new PropertyChangedEventHandler(SubElemX_PropertyChanged); } CACs = new List <SubElementY>(); CACs.Add(new SubElementY(1)); CACs.Add(new SubElementY(2)); CACs.Add(new SubElementY(3)); CACs = CACs; EtatsLecture = new List <SubElementZ>(); EtatsLecture.Add(new SubElementZ(1)); EtatsLecture.Add(new SubElementZ(2)); EtatsLecture.Add(new SubElementZ(3)); EtatsLecture = EtatsLecture; }
public void AddSubElement(DungeonNode newSub) => SubElements.Add(newSub);
public void Add(Element element) => SubElements.Add(element);
public Document(string header) : this() { SubElements.Add(new Header(HeaderLevel.One, header)); }
public NodeElement(ProductionNode node, ProductionGraphViewer parent) : base(parent) { Width = 100; Height = 90; DisplayedNode = node; Color backgroundColour = missingColour; Color textColour = darkTextColour; if (DisplayedNode is ConsumerNode) { backgroundColour = outputColour; if (((ConsumerNode)DisplayedNode).ConsumedItem.IsMissingItem) { backgroundColour = missingColour; } } else if (DisplayedNode is SupplyNode) { backgroundColour = supplyColour; if (((SupplyNode)DisplayedNode).SuppliedItem.IsMissingItem) { backgroundColour = missingColour; } } else if (DisplayedNode is RecipeNode) { backgroundColour = recipeColour; if (((RecipeNode)DisplayedNode).BaseRecipe.IsMissingRecipe) { backgroundColour = missingColour; } } else if (DisplayedNode is PassthroughNode) { backgroundColour = passthroughColour; if (((PassthroughNode)DisplayedNode).PassedItem.IsMissingItem) { backgroundColour = missingColour; } } else { Trace.Fail("No branch for node: " + DisplayedNode.ToString()); } backgroundBrush = new SolidBrush(backgroundColour); textBrush = new SolidBrush(textColour); foreach (Item item in node.Inputs) { ItemTab newTab = new ItemTab(item, LinkType.Input, Parent); SubElements.Add(newTab); inputTabs.Add(newTab); } foreach (Item item in node.Outputs) { ItemTab newTab = new ItemTab(item, LinkType.Output, Parent); SubElements.Add(newTab); outputTabs.Add(newTab); } if (DisplayedNode is RecipeNode || DisplayedNode is SupplyNode) { assemblerBox = new AssemblerBox(Parent); SubElements.Add(assemblerBox); assemblerBox.Height = assemblerBox.Width = 50; } centreFormat.Alignment = centreFormat.LineAlignment = StringAlignment.Center; }