예제 #1
0
        public void CreateMasterListOfParts(PartList partList)
        {
            Part itemTemp = new PartWithWeight("Fasto Cap", "Fasto's pen cap", 0.010f);

            partList.Add(itemTemp);

            itemTemp = new PartWithWeight("Fasto Barrel", "Fasto's pen Barrel", 0.050f);
            partList.Add(itemTemp);

            itemTemp = new PartWithCount("Fasto Refill", "Fasto's pen Refill", 1);
            partList.Add(itemTemp);
        }
예제 #2
0
        public override Task Prepare(HttpContext context)
        {
            Title = "Ops";
            CssUrls.Add("/.Face.css");
            JsUrls.Add("/.Face.js");

            PartList parts = new PartList {
                new HeadingElement(1)
                {
                    Content = new PlainText("Ops")
                },
                new PlainText("Here's an image"),
                new BreakElement(),
                new ImageElement()
                {
                    Classes   = new[] { "crabs" },
                    SourceUrl = "https://www.citarella.com/media/catalog/product/cache/1/image/97a78116f02a369697db694bbb2dfa59/0/2/024029200000_01_1.jpg"
                },
                ":D"
            };

            parts.Add(":D");

            Body.Append(new StandardBody {
                Content    = parts,
                ActiveHRef = "/ops"
            });
            return(Task.CompletedTask);
        }
예제 #3
0
        public bool Add(Part p)
        {
            // check space available
            //foreach (Part existing in PartList)
            //{
            //    if (p.Intersects(existing))
            //    {
            //        return false;
            //    }
            //}
            PartList.Add(p);

            // update bounding box
            int newLeft  = Math.Min(p.Bounds.Left, Bounds.Left);
            int newTop   = Math.Min(p.Bounds.Top, Bounds.Top);
            int newRight = Math.Max(p.Bounds.Right, Bounds.Right);
            int newBot   = Math.Max(p.Bounds.Bottom, Bounds.Bottom);

            Bounds = Rectangle.FromLTRB(newLeft, newTop, newRight, newBot);

            // add heat capacity to total
            p.Get <HeatComponent>().MatchSome(hc =>
            {
                TotalHeatCapacity += hc.HeatCapacity;
                Coolant           += hc.MaxCoolant;
            });

            return(true);
        }
예제 #4
0
 // Add current products associated parts to partlist.
 public static void LoadPartList()
 {
     PartList.Clear();
     foreach (Part i in CurrentProduct.AssociatedParts)
     {
         PartList.Add(i);
     }
 }
예제 #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                var quickID = int.Parse(textBox1.Text);
                if (AllParts.Contains(quickID))
                {
                    throw new Exception();
                }
                AllParts.Add(quickID);

                using (var context = new InventoryContext())
                {
                    var part = context.Part.Where(x => x.QuickID == quickID).FirstOrDefault();
                    if (part == null)
                    {
                        throw new ArgumentNullException();
                    }
                    PartList.Add(part);

                    var grid = PartList.Select(x => new
                    {
                        QuickID      = x.QuickID,
                        PartNumber   = x.PartNumber,
                        SerialNumber = x.SerialNumber,
                        Description  = x.Description,
                        Location     = x.Location,
                        Category     = x.Category,
                        Quantity     = 1
                    }).ToList();

                    dataGridView1.DataSource = null;
                    dataGridView1.DataSource = grid;
                }
            }
            catch (ArgumentNullException)
            {
                MessageBox.Show("That QuickID was not found.");
            }
            catch (Exception ex)
            {
                MessageBox.Show($"You cannot add the same QuickID twice \r\n \r\n {ex.Message}");
            }
        }
예제 #6
0
    public override Task Prepare(HttpContext context)
    {
        Title = "Central";
        Body.Classes.Add("homepage");
        CssUrls.Add("/.Face.css");
        JsUrls.Add("/.Face.js");

        PartList parts           = new PartList();
        var      uptime          = Convert.ToInt64(Environment.TickCount64);
        var      currentTime     = Convert.ToInt64(new DateTimeOffset(DateTime.UtcNow).ToUnixTimeMilliseconds());
        var      powerOnUnixTime = Convert.ToInt64(Math.Round(Convert.ToDouble(currentTime - uptime)) / 1000);

        parts.Add(new DivElement {
            Classes = new[] { "panel" },
            Content = new Part[] {
                new HeadingElement(1)
                {
                    Content = "Information",
                },
                new SectionElement {
                    Content = new Part[] {
                        new LabelElement()
                        {
                            Content = new PlainText("Device"),
                        },
                        Environment.MachineName
                    },
                },
                new SectionElement {
                    Content = new Part[] {
                        new LabelElement()
                        {
                            Content = new PlainText("Uptime"),
                        },
                        new TimeAgo(powerOnUnixTime)
                    },
                },
                new SectionElement {
                    Content = new Part[] {
                        new LabelElement()
                        {
                            Content = new PlainText("Generated"),
                        },
                        new TimeAgo(currentTime / 1000),
                        new PlainText(" ago"),
                    },
                },
            }
        });

        parts.Add(new DivElement {
            Classes = new[] { "panel" },
            Content = new Part[] {
                new HeadingElement(1)
                {
                    Content = new PlainText("Event Log"),
                },
                new EventLog()
                {
                    Classes = "eventLog",
                    Content = new [] {
                        new EventListItem {
                            Label   = "KNotify",
                            Content = new RawHtml("<b>Download complete:</b> Ainsley Harriot's Ultimate Reddy-Brek Recipies.pdf"),
                        },
                        new EventListItem {
                            Label   = "Authorised",
                            Classes = new[] { "good" },
                            Content = new RawHtml("Your request for <em>skynet5 repository access</em> was accepted"),
                        },
                        new EventListItem {
                            Label   = "Message",
                            Content = new RawHtml("Received a <a href='converse/rickyg'>message</a> from <em>Ricky G</em>"),
                        },
                        new EventListItem {
                            Label   = "Project Y",
                            Classes = new [] { "projectY" },
                            Content = new PlainText("The rabbit is in the hutch"),
                        },
                        new EventListItem {
                            Label   = "Incoming call",
                            Classes = new[] { "priority" },
                            Content = new Part[] {
                                new RawHtml("<em>Johnny Ten</em>, unscheduled<br>"),
                                new DelegateButton {
                                    OnClick = (context, post) => {
                                        Console.WriteLine("Connecting call");
                                        return(Task.CompletedTask);
                                    },
                                    Once = true,
                                    TimeToLiveSeconds = 90,                                     // 0 = until ping timeout
                                    Content           = new PlainText("Answer")
                                },
                            }
                        },
                    },
                },
            }
        });


        Body.Append(new StandardBody {
            Content    = parts,
            ActiveHRef = "/"
        });
        return(Task.CompletedTask);
    }
예제 #7
0
 public void AddPartToModule(Part p, int quantity)
 {
     PartList.Add(p);
     Quantity = quantity;
 }