Esempio n. 1
0
        /**
           * This method deconstructs the state.
           */
        public override void Destruct()
        {
            this._blueprint = null;
            this._navigation = null;

            base.Destruct();
        }
Esempio n. 2
0
 /**
    * This is the constructor for the FloorView state.
    */
 public FloorView(string name)
     : base(name)
 {
     this.Layout += this.EventResize;
     this._blueprint = null;
     this._navigation = null;
     this._isLoaded = false;
 }
Esempio n. 3
0
 public FloorView(string name, uint currentLocationID, uint currentBuildingID, uint currentFloorID)
     : base(name)
 {
     this.Layout += this.EventResize;
     this._blueprint = null;
     this._navigation = null;
     this._currentLocationID = currentLocationID;
     this._currentBuildingID = currentBuildingID;
     this._currentFloorID = currentFloorID;
     this._isLoaded = true;
 }
Esempio n. 4
0
        public void TestNULLAddRoom()
        {
            //arrange
            BlueprintPanel panel = new BlueprintPanel();

            //act
            //			panel.AddRoom(null);

            //assert
            //			List<Room> rooms = panel.GetRooms();
            //			Assert.AreEqual(0, rooms.Count);
        }
Esempio n. 5
0
        public void TestConstructor()
        {
            //arrange
            System.Reflection.FieldInfo roomsProp = typeof(BlueprintPanel).GetField("_rooms", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);

            //act
            BlueprintPanel panel = new BlueprintPanel();

            //assert
            Assert.IsNotNull(panel);
            Assert.IsInstanceOf(typeof(BlueprintPanel), panel);
            Assert.IsNotNull(roomsProp.GetValue(panel));
        }
Esempio n. 6
0
        public void TestMixedAddRooms()
        {
            //arrange
            BlueprintPanel panel = new BlueprintPanel();

            //act
            //			panel.AddRooms(new Room("Ontspanningsruimte",3,4,3), null);

            //assert
            //			List<Room> rooms = panel.GetRooms();
            //			Assert.AreEqual(1, rooms.Count);
            //			Assert.IsNotNull(rooms[0]);
            //			Assert.IsInstanceOf(typeof(Room), rooms[0]);
        }
Esempio n. 7
0
        public void TestAddRooms()
        {
            //arrange
            BlueprintPanel panel = new BlueprintPanel();

            //act
            //			panel.AddRooms(new Room("ontspanningsruimte",4,6,4), new Room("Leslokaal",3,4,2));

            //assert
            //			List<Room> rooms = panel.GetRooms();
            //			Assert.AreEqual(2, rooms.Count);
            //			Assert.IsNotNull(rooms[0]);
            //			Assert.IsNotNull(rooms[1]);
            //			Assert.IsInstanceOf(typeof(Room), rooms[0]);
            //			Assert.IsInstanceOf(typeof(Room), rooms[1]);
        }
Esempio n. 8
0
        /**
           * This method is required for designer support and is by default a good place to organise controls in a state.
           */
        protected override void InitializeComponent()
        {
            //TODO: Current Loc & Building should come from something set BEFORE this state is reached.
            DocumentHandler doch = DocumentHandler.GetInstance();
            if (_isLoaded) {
                doch.CurrentLocation = LocationHandler.GetInstance().GetLocationBy((location) => location.Id == this._currentLocationID);
                doch.CurrentBuilding = BuildingHandler.GetInstance().GetBuildingBy((building) => building.Id == this._currentBuildingID);
                doch.CurrentFloor = FloorHandler.GetInstance().GetFloorBy((floor) => floor.GetID() == this._currentFloorID);
            }
            else {

                doch.CurrentLocation = LocationHandler.GetInstance().GetLocationBy((location) => location.Id == 1);
                doch.CurrentBuilding = BuildingHandler.GetInstance().GetBuildingBy((building) => building.Id == 1);
                if (doch.CurrentBuilding != null) {
                    doch.CurrentFloor = FloorHandler.GetInstance().GetFloorBy((floor) => floor.GetBuildingID() == doch.CurrentBuilding.Id);
                }
            }

            this._navigation = new NavigationStrip();
            this.FillNavigationStrip();

            this._blueprint = new BlueprintPanel();
            this._blueprint.Size = new Size(this.Form.ClientSize.Width - 10, this.Form.ClientSize.Height - 35);
            this._blueprint.Top = 30;
            this._blueprint.Left = 5;
            this._blueprint.MouseClick += this.EventBlueprintClick;

            this._addLocationDialog = new AddLocationDialog("Locatie toevoegen", this.FillNavigationStrip);
            this._addBuildingDialog = new AddBuildingDialog("Gebouw toevoegen", this.FillNavigationStrip);
            this._addFloorDialog = new AddFloorDialog("Verdieping toevoegen", this.FillNavigationStrip);

            this._deleteLocationDialog = new DeleteLocationDialog("Locatie verwijderen", this.FillNavigationStrip);
            this._deleteBuildingDialog = new DeleteBuildingDialog("Gebouw verwijderen", this.FillNavigationStrip);
            this._deleteFloorDialog = new DeleteFloorDialog("Verdieping verwijderen", this.FillNavigationStrip);

            this._editLocationDialog = new EditLocationDialog("Locatie aanpassen", this.FillNavigationStrip);
            this._editBuildingDialog = new EditBuildingDialog("Gebouw wijzigen", this.FillNavigationStrip);
            this._editFloorDialog = new EditFloorDialog("Verdieping Aanpassen", this.FillNavigationStrip);

            this._selectRoomDialog = new SelectRoomDialog("Geselecteerde Kamer", null);
            this._selectFunctionDialog = new SelectFunctionDialog("Selecteer een functie");

            if (doch.CurrentFloor != null) {
                this.FillBlueprint(doch.CurrentFloor.GetID());
            }

            this.Controls.Add(this._addLocationDialog);
            this.Controls.Add(this._addBuildingDialog);
            this.Controls.Add(this._addFloorDialog);

            this.Controls.Add(this._deleteLocationDialog);
            this.Controls.Add(this._deleteBuildingDialog);
            this.Controls.Add(this._deleteFloorDialog);

            this.Controls.Add(this._editLocationDialog);
            this.Controls.Add(this._editBuildingDialog);
            this.Controls.Add(this._editFloorDialog);

            this.Controls.Add(this._selectRoomDialog);
            this.Controls.Add(this._selectFunctionDialog);

            this.Controls.Add(this._navigation);
            this.Controls.Add(this._blueprint);
        }