/** * This method deconstructs the state. */ public override void Destruct() { this._blueprint = null; this._navigation = null; base.Destruct(); }
/** * 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; }
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; }
/** * 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); }