Example #1
0
        public static Part NewItem()
        {
            Part returnPart = null;

            GeneralDialog gd = new GeneralDialog();

            gd.setTitle("Add Part");
            var name   = gd.addSimpleField("Part Name");
            var id     = gd.addSimpleField("Internal ID");
            var eol    = gd.addCheckbox("Is part at End of Life", false);
            var button = gd.addSimpleButtons("Add");

            button.Click += delegate {
                returnPart = new Part(name.Text, id.Text, (bool)eol.IsChecked);
                gd.Close();
            };
            gd.ShowDialog();

            return(returnPart);
        }
Example #2
0
        public static Location NewItem(LocationType locationType, int parentID)
        {
            Location returnPart = null;

            GeneralDialog gd = new GeneralDialog();

            gd.setTitle("Add " + locationType);
            var name   = gd.addSimpleField(locationType + " name");
            var button = gd.addSimpleButtons("Add");

            button.Click += delegate {
                returnPart = new Location(name.Text, locationType, -1, parentID);
                gd.Close();
            };
            gd.ShowDialog();

            return(returnPart);
        }