예제 #1
0
파일: Location.cs 프로젝트: Vzor-/Inventory
        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);
        }
예제 #2
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);
        }