Пример #1
0
        public override void MouseUp(Point location, MouseButtons button)
        {
            ItemTab clickedTab = null;

            foreach (ItemTab tab in SubElements.OfType <ItemTab>())
            {
                if (tab.bounds.Contains(location))
                {
                    clickedTab = tab;
                }
            }

            if (button == MouseButtons.Left)
            {
                if (clickedTab != null && clickedTab.Type == LinkType.Input && DisplayedNode is ConsumerNode)
                {
                    beginEditingInputAmount(clickedTab.Item);
                }
            }
            else if (button == MouseButtons.Right)
            {
                rightClickMenu.MenuItems.Clear();
                rightClickMenu.MenuItems.Add(new MenuItem("Delete node",
                                                          new EventHandler((o, e) =>
                {
                    Parent.DeleteNode(this);
                })));
                rightClickMenu.Show(Parent, Parent.GraphToScreen(Point.Add(location, new Size(X, Y))));
            }
        }
Пример #2
0
        private void SubElemX_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            SubElementsX.ForEach(x => x.SuspendPropertyChange = true);


            SubElements.ForEach(x => x.Bool1 = ((SubElementX)sender).Bool1);

            //SubElements.ForEach(x => x.Bool1 = !x.Bool1);
            //SubElements.ForEach(x => x.NeutralBool = !x.NeutralBool);
            //SubElements.ForEach(x => x.Val2 = x.Val2 + ".");

            //SubElements.ForEach(x => x.Rad1 = true);
            //SubElements.ForEach(x => x.Rad2 = false);
            //SubElements.ForEach(x => x.Rad3 = false);


            SubElementsX.ForEach(x => x.SuspendPropertyChange = false);
            //SubElements.First().Val2 = "ooo";
            //SubElements.First().OnPropertyChanged("SubElement");

            //Permet de remonter le propertychanged
            //OnPropertyChanged("SubElementsX");
            //OnPropertyChanged("SubElementsX");
            //OnPropertyChanged("Element");
            //OnPropertyChanged("SubElement");
            //OnPropertyChanged("SubElementsX");
        }
Пример #3
0
 public TypedElementReferenceIdentifier(Segment segment, int elementNumber)
     : base(segment, elementNumber)
 {
     if (0 < SubElements.Count())
     {
         _1_ReferenceIdentifierQualifier = SubElements.ElementAt(0);
     }
     if (1 < SubElements.Count())
     {
         _2_ReferenceIdentifier = SubElements.ElementAt(1);
     }
     if (2 < SubElements.Count())
     {
         _3_ReferenceIdentifierQualifier = SubElements.ElementAt(2);
     }
     if (3 < SubElements.Count())
     {
         _4_ReferenceIdentifier = SubElements.ElementAt(3);
     }
     if (4 < SubElements.Count())
     {
         _5_ReferenceIdentifierQualifier = SubElements.ElementAt(4);
     }
     if (5 < SubElements.Count())
     {
         _6_ReferenceIdentifier = SubElements.ElementAt(5);
     }
 }
Пример #4
0
 public TypedElementContextIdentification(Segment segment, int elementNumber)
     : base(segment, elementNumber)
 {
     if (0 < SubElements.Count())
     {
         _1_ContextName = SubElements.ElementAt(0);
     }
     if (1 < SubElements.Count())
     {
         _2_ContextReference = SubElements.ElementAt(1);
     }
 }
        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 TypedElementAdjustmentIdentifier(Segment segment, int elementNumber)
     : base(segment, elementNumber)
 {
     if (0 < SubElements.Count())
     {
         _1_AdjustmentReasonCode = SubElements.ElementAt(0);
     }
     if (1 < SubElements.Count())
     {
         _2_ReferenceIdentification = SubElements.ElementAt(1);
     }
 }
Пример #7
0
        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++;
            }
        }
Пример #8
0
 public override bool ContainsPoint(Point point)
 {
     if (new Rectangle(0, 0, Width, Height).Contains(point.X, point.Y))
     {
         return(true);
     }
     foreach (ItemTab tab in SubElements.OfType <ItemTab>())
     {
         if (tab.bounds.Contains(point))
         {
             return(true);
         }
     }
     return(false);
 }
Пример #9
0
        private void SubElem_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            SubElements.ForEach(x => x.SuspendPropertyChange = true);

            SubElementsX.ForEach(x => x.Bool1 = ((SubElement)sender).Bool1);


            //SubElementsX.ForEach(x => x.Bool1 = !x.Bool1);
            //SubElementsX.ForEach(x => x.Val2 = x.Val2 + ".");
            //SubElementsX.ForEach(x => x.SuspendPropertyChange = false);
            //SubElementsX.First().SuspendPropertyChange = false;
            SubElements.ForEach(x => x.SuspendPropertyChange = false);


            OnPropertyChanged("SubElements");
        }
        private void ExportAsMain(StringBuilder stringBuilder)
        {
            if (!IsNullOrWhiteSpace(Name))
            {
                stringBuilder.AppendLine($"{Name}:");
            }
            stringBuilder.AppendLine();

            var enumerable = SubElements.Where(element => !IsNullOrWhiteSpace(element.ToString()));

            foreach (var element in enumerable)
            {
                stringBuilder.AppendLine($"{element}");
                stringBuilder.AppendLine();
            }
        }
Пример #11
0
 public TypedElementHealthCareClaimStatus(Segment segment, int elementNumber)
     : base(segment, elementNumber)
 {
     if (0 < SubElements.Count())
     {
         _1_IndustryCode = SubElements.ElementAt(0);
     }
     if (1 < SubElements.Count())
     {
         _2_IndustryCode = SubElements.ElementAt(1);
     }
     if (2 < SubElements.Count())
     {
         _3_EntityIdentifierCode = SubElements.ElementAt(2).ToEnumFromEDIFieldValue <EntityIdentifierCode>();
     }
 }
Пример #12
0
 public TypedElementPositionInSegment(Segment segment, int elementNumber)
     : base(segment, elementNumber)
 {
     if (0 < SubElements.Count())
     {
         _1_ElementPositionInSegment = Convert.ToInt32(SubElements.ElementAt(0));
     }
     if (1 < SubElements.Count())
     {
         _2_ComponentDataElementPositionInComposite = Convert.ToInt32(SubElements.ElementAt(1));
     }
     if (2 < SubElements.Count())
     {
         _3_RepeatingDataElementPosition = Convert.ToInt32(SubElements.ElementAt(2));
     }
 }
Пример #13
0
 public TypedElementServiceLocationInfo(Segment segment, int elementNumber)
     : base(segment, elementNumber)
 {
     if (0 < SubElements.Count())
     {
         _1_FacilityCodeValue = SubElements.ElementAt(0).ToEnumFromEDIFieldValue <PlaceOfServiceCodes>();
     }
     if (1 < SubElements.Count())
     {
         _2_FacilityCodeQualifier = SubElements.ElementAt(1);
     }
     if (2 < SubElements.Count())
     {
         _3_ClaimFrequencyTypeCode = SubElements.ElementAt(2);
     }
 }
Пример #14
0
        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 TypedElementCompositDiagnosisCodePointer(Segment segment, int elementNumber)
     : base(segment, elementNumber)
 {
     if (0 < SubElements.Count())
     {
         _1_DiagnosisCodePointer = Convert.ToInt32(SubElements.ElementAt(0));
     }
     if (1 < SubElements.Count())
     {
         _2_DiagnosisCodePointer = Convert.ToInt32(SubElements.ElementAt(1));
     }
     if (2 < SubElements.Count())
     {
         _3_DiagnosisCodePointer = Convert.ToInt32(SubElements.ElementAt(2));
     }
     if (3 < SubElements.Count())
     {
         _4_DiagnosisCodePointer = Convert.ToInt32(SubElements.ElementAt(3));
     }
 }
        private void ExportAsSubgroup(StringBuilder stringBuilder)
        {
            if (!IsNullOrWhiteSpace(Name))
            {
                stringBuilder.Append($"{Name}:  ");
            }

            var elements = SubElements.Where(element => !IsNullOrWhiteSpace(element.ToString())).ToList();

            for (int i = 0; i < elements.Count; i++)
            {
                if (i < elements.Count - 1)
                {
                    AppendSubgroupItem(stringBuilder, elements[i], $"{SubGroupSeparator} ");
                }
                else
                {
                    AppendSubgroupItem(stringBuilder, elements[i], ". ");
                }
            }
        }
Пример #17
0
 public TypedElementHealthCareCodeInformation(Model.Segment _segment, int _elementNumber)
     : base(_segment, _elementNumber)
 {
     if (0 < SubElements.Count())
     {
         _1_CodeListQualifierCode = SubElements.ElementAt(0).ToEnumFromEDIFieldValue <CodeListQualifierCode>();
     }
     if (1 < SubElements.Count())
     {
         _2_IndustryCode = SubElements.ElementAt(1);
     }
     if (2 < SubElements.Count())
     {
         _3_DateTimePeriodFormatQualifierEnum = SubElements.ElementAt(2).ToEnumFromEDIFieldValue <DTPQualifier>();
     }
     if (3 < SubElements.Count())
     {
         _4_DateTimePeriod = new DateTimePeriod(SubElements.ElementAt(3));
     }
     if (4 < SubElements.Count())
     {
         _5_MonetaryAmount = Convert.ToDecimal(SubElements.ElementAt(4));
     }
     if (5 < SubElements.Count())
     {
         _6_Quantity = Convert.ToDecimal(SubElements.ElementAt(5));
     }
     if (6 < SubElements.Count())
     {
         _7_VersionIdentifier = SubElements.ElementAt(6);
     }
     if (7 < SubElements.Count())
     {
         _8_IndustryCode = SubElements.ElementAt(7);
     }
     if (8 < SubElements.Count())
     {
         _9_IndustryCode = SubElements.ElementAt(8);
     }
 }
Пример #18
0
        public override void Dragged(Point location)
        {
            ItemTab draggedTab = null;

            foreach (ItemTab tab in SubElements.OfType <ItemTab>())
            {
                if (tab.bounds.Contains(new Point(DragOffsetX, DragOffsetY)))
                {
                    draggedTab = tab;
                }
            }

            if (draggedTab != null)
            {
                DraggedLinkElement newLink = new DraggedLinkElement(Parent, this, draggedTab.Type, draggedTab.Item);
                if (draggedTab.Type == LinkType.Input)
                {
                    newLink.ConsumerElement = this;
                }
                else
                {
                    newLink.SupplierElement = this;
                }
                Parent.DraggedElement = newLink;
            }
            else
            {
                X += location.X - DragOffsetX;
                Y += location.Y - DragOffsetY;

                foreach (ProductionNode node in DisplayedNode.InputLinks.Select <NodeLink, ProductionNode>(l => l.Supplier))
                {
                    Parent.GetElementForNode(node).UpdateTabOrder();
                }
                foreach (ProductionNode node in DisplayedNode.OutputLinks.Select <NodeLink, ProductionNode>(l => l.Consumer))
                {
                    Parent.GetElementForNode(node).UpdateTabOrder();
                }
            }
        }
Пример #19
0
        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 TypedElementCompositeMedicalProcedureIdentifier(Segment segment, int elementNumber)
     : base(segment, elementNumber)
 {
     if (0 < SubElements.Count())
     {
         _1_ProductOrServiceIdQualifier = SubElements.ElementAt(0).ToEnumFromEDIFieldValue <ProductOrServiceIdQualifiers>();
     }
     if (1 < SubElements.Count())
     {
         _2_ProcedureCode = SubElements.ElementAt(1);
     }
     if (2 < SubElements.Count())
     {
         _3_ProcedureModifier = SubElements.ElementAt(2);
     }
     if (3 < SubElements.Count())
     {
         _4_ProcedureModifier = SubElements.ElementAt(3);
     }
     if (4 < SubElements.Count())
     {
         _5_ProcedureModifier = SubElements.ElementAt(4);
     }
     if (5 < SubElements.Count())
     {
         _6_ProcedureModifier = SubElements.ElementAt(5);
     }
     if (6 < SubElements.Count())
     {
         _7_Description = SubElements.ElementAt(6);
     }
     if (7 < SubElements.Count())
     {
         _8_ProductOrServiceId = SubElements.ElementAt(7);
     }
 }
Пример #21
0
 public TypedElementRelatedCausesInfo(Segment segment, int elementNumber)
     : base(segment, elementNumber)
 {
     if (0 < SubElements.Count())
     {
         _1_RelatedCausesCode = SubElements.ElementAt(0);
     }
     if (1 < SubElements.Count())
     {
         _2_RelatedCausesCode = SubElements.ElementAt(1);
     }
     if (2 < SubElements.Count())
     {
         _3_RelatedCausesCode = SubElements.ElementAt(2);
     }
     if (3 < SubElements.Count())
     {
         _4_StateOrProvidenceCode = SubElements.ElementAt(3);
     }
     if (4 < SubElements.Count())
     {
         _5_CountryCode = SubElements.ElementAt(4);
     }
 }
Пример #22
0
 public Document(string header) : this()
 {
     SubElements.Add(new Header(HeaderLevel.One, header));
 }
Пример #23
0
        public override void MouseMoved(Point location)
        {
            if (editorBox == null)
            {
                ItemTab mousedTab = null;
                foreach (ItemTab tab in SubElements.OfType <ItemTab>())
                {
                    if (tab.bounds.Contains(location))
                    {
                        mousedTab = tab;
                    }
                }

                TooltipInfo tti = new TooltipInfo();
                if (mousedTab != null)
                {
                    tti.Text = mousedTab.Item.FriendlyName;
                    if (mousedTab.Type == LinkType.Input)
                    {
                        if (DisplayedNode is ConsumerNode)
                        {
                            tti.Text += "\nClick to edit desired amount";
                        }
                        tti.Text          += "\nDrag to create a new connection";
                        tti.Direction      = Direction.Up;
                        tti.ScreenLocation = Parent.GraphToScreen(GetInputLineConnectionPoint(mousedTab.Item));
                    }
                    else
                    {
                        tti.Text           = mousedTab.Item.FriendlyName;
                        tti.Text          += "\nDrag to create a new connection";
                        tti.Direction      = Direction.Down;
                        tti.ScreenLocation = Parent.GraphToScreen(GetOutputLineConnectionPoint(mousedTab.Item));
                    }
                    Parent.AddTooltip(tti);
                }
                else if (DisplayedNode is RecipeNode)
                {
                    tti.Direction      = Direction.Left;
                    tti.ScreenLocation = Parent.GraphToScreen(Point.Add(Location, new Size(Width, Height / 2)));
                    tti.Text           = String.Format("Recipe: {0}", (DisplayedNode as RecipeNode).BaseRecipe.FriendlyName);
                    tti.Text          += String.Format("\n--Base Time: {0}s", (DisplayedNode as RecipeNode).BaseRecipe.Time);
                    tti.Text          += String.Format("\n--Base Ingredients:");
                    foreach (var kvp in (DisplayedNode as RecipeNode).BaseRecipe.Ingredients)
                    {
                        tti.Text += String.Format("\n----{0} ({1})", kvp.Key.FriendlyName, kvp.Value.ToString());
                    }
                    tti.Text += String.Format("\n--Base Results:");
                    foreach (var kvp in (DisplayedNode as RecipeNode).BaseRecipe.Results)
                    {
                        tti.Text += String.Format("\n----{0} ({1})", kvp.Key.FriendlyName, kvp.Value.ToString());
                    }
                    if (Parent.ShowAssemblers)
                    {
                        tti.Text += String.Format("\n\nAssemblers:");
                        foreach (var kvp in assemblerBox.AssemblerList)
                        {
                            tti.Text += String.Format("\n----{0} ({1})", kvp.Key.assembler.FriendlyName, kvp.Value.ToString());
                            foreach (var Module in kvp.Key.modules)
                            {
                                tti.Text += String.Format("\n------{0}", Module.FriendlyName);
                            }
                        }
                    }
                    Parent.AddTooltip(tti);
                }
            }
        }
Пример #24
0
 public void Add(Element element) => SubElements.Add(element);
Пример #25
0
        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;
        }
 public void RemoveSubElement(DungeonNode newSub) => SubElements.Remove(newSub);
 public void AddSubElement(DungeonNode newSub) => SubElements.Add(newSub);
Пример #28
0
 public TypedElementCompositeUnitOfMeasure(Segment segment, int elementNumber)
     : base(segment, elementNumber)
 {
     if (0 < SubElements.Count())
     {
         _1_UnitOrBasisMeasCode = SubElements.ElementAt(0).ToEnumFromEDIFieldValue <UnitOrBasisOfMeasurementCode>();
     }
     if (1 < SubElements.Count())
     {
         _2_Exponent1 = SubElements.ElementAt(1);
     }
     if (2 < SubElements.Count())
     {
         _3_Multiplier = SubElements.ElementAt(2);
     }
     if (3 < SubElements.Count())
     {
         _4_UnitOrBasisMeasCode = SubElements.ElementAt(3).ToEnumFromEDIFieldValue <UnitOrBasisOfMeasurementCode>();
     }
     if (4 < SubElements.Count())
     {
         _5_Exponent2 = SubElements.ElementAt(4);
     }
     if (5 < SubElements.Count())
     {
         _6_Multiplier = SubElements.ElementAt(5);
     }
     if (6 < SubElements.Count())
     {
         _7_UnitOrBasisMeasCode = SubElements.ElementAt(6).ToEnumFromEDIFieldValue <UnitOrBasisOfMeasurementCode>();
     }
     if (7 < SubElements.Count())
     {
         _8_Exponent3 = SubElements.ElementAt(7);
     }
     if (8 < SubElements.Count())
     {
         _9_Multiplier = SubElements.ElementAt(8);
     }
     if (9 < SubElements.Count())
     {
         _10_UnitOrBasisMeasCode = SubElements.ElementAt(9).ToEnumFromEDIFieldValue <UnitOrBasisOfMeasurementCode>();
     }
     if (10 < SubElements.Count())
     {
         _11_Exponent4 = SubElements.ElementAt(10);
     }
     if (11 < SubElements.Count())
     {
         _12_Multiplier = SubElements.ElementAt(11);
     }
     if (12 < SubElements.Count())
     {
         _13_UnitOrBasisMeasCode = SubElements.ElementAt(12).ToEnumFromEDIFieldValue <UnitOrBasisOfMeasurementCode>();
     }
     if (13 < SubElements.Count())
     {
         _14_Exponent5 = SubElements.ElementAt(13);
     }
     if (14 < SubElements.Count())
     {
         _15_Multiplier = SubElements.ElementAt(14);
     }
 }
Пример #29
0
        public override void MouseMoved(Point location)
        {
            ItemTab mousedTab = null;

            foreach (ItemTab tab in SubElements.OfType <ItemTab>())
            {
                if (tab.bounds.Contains(location))
                {
                    mousedTab = tab;
                }
            }

            if (tooltipsEnabled)
            {
                TooltipInfo tti = new TooltipInfo();
                if (mousedTab != null)
                {
                    tti.Text = mousedTab.Item.FriendlyName;
                    if (mousedTab.Type == LinkType.Input)
                    {
                        tti.Text          += "\nDrag to create a new connection";
                        tti.Direction      = Direction.Up;
                        tti.ScreenLocation = Parent.GraphToScreen(GetInputLineConnectionPoint(mousedTab.Item));
                    }
                    else
                    {
                        tti.Text           = mousedTab.Item.FriendlyName;
                        tti.Text          += "\nDrag to create a new connection";
                        tti.Direction      = Direction.Down;
                        tti.ScreenLocation = Parent.GraphToScreen(GetOutputLineConnectionPoint(mousedTab.Item));
                    }
                    Parent.AddTooltip(tti);
                }
                else if (DisplayedNode is RecipeNode)
                {
                    tti.Direction      = Direction.Left;
                    tti.ScreenLocation = Parent.GraphToScreen(Point.Add(Location, new Size(Width, Height / 2)));
                    tti.Text           = String.Format("Recipe: {0}", (DisplayedNode as RecipeNode).BaseRecipe.FriendlyName);
                    tti.Text          += String.Format("\n--Base Time: {0}s", (DisplayedNode as RecipeNode).BaseRecipe.Time);
                    tti.Text          += String.Format("\n--Base Ingredients:");
                    foreach (var kvp in (DisplayedNode as RecipeNode).BaseRecipe.Ingredients)
                    {
                        tti.Text += String.Format("\n----{0} ({1})", kvp.Key.FriendlyName, kvp.Value.ToString());
                    }
                    tti.Text += String.Format("\n--Base Results:");
                    foreach (var kvp in (DisplayedNode as RecipeNode).BaseRecipe.Results)
                    {
                        tti.Text += String.Format("\n----{0} ({1})", kvp.Key.FriendlyName, kvp.Value.ToString());
                    }
                    if (Parent.ShowAssemblers)
                    {
                        tti.Text += String.Format("\n\nAssemblers:");
                        foreach (var kvp in assemblerBox.AssemblerList)
                        {
                            tti.Text += String.Format("\n----{0} ({1})", kvp.Key.assembler.FriendlyName, kvp.Value.ToString());
                            foreach (var Module in kvp.Key.modules.Where(m => m != null))
                            {
                                tti.Text += String.Format("\n------{0}", Module.FriendlyName);
                            }
                        }
                    }

                    if (Parent.Graph.SelectedAmountType == AmountType.FixedAmount)
                    {
                        tti.Text += String.Format("\n\nCurrent iterations: {0}", DisplayedNode.actualRate);
                    }
                    else
                    {
                        tti.Text += String.Format("\n\nCurrent Rate: {0}/{1}",
                                                  Parent.Graph.SelectedUnit == RateUnit.PerMinute ? DisplayedNode.actualRate / 60 : DisplayedNode.actualRate,
                                                  Parent.Graph.SelectedUnit == RateUnit.PerMinute ? "m" : "s");
                    }
                    Parent.AddTooltip(tti);
                }

                TooltipInfo helpToolTipInfo = new TooltipInfo();
                helpToolTipInfo.Text           = "Left click on this node to edit how fast it runs\nRight click to delete it";
                helpToolTipInfo.Direction      = Direction.None;
                helpToolTipInfo.ScreenLocation = new Point(10, 10);
                Parent.AddTooltip(helpToolTipInfo);
            }
        }