public static DocumentHandler GetInstance() { if (instance == null) { instance = new DocumentHandler(); } return instance; }
/* With this constructor you can make the dialog for adding new items to a room. The handlers used in this class will be set here. */ public AddItemDialog(string name, Action parentCallback) : base(name, parentCallback) { this._callback = parentCallback; this._itemTypeHandler = ItemTypeHandler.GetInstance(); this._itemHandler = ItemHandler.GetInstance(); this._documentHandler = DocumentHandler.GetInstance(); }
/* With this constructor you can make the dialog for deleteing new items to a room. The handlers used in this class will be set here. */ public DeleteItemDialog(string name, Action parentCallback, Room targetRoom, ItemType itemType) : base(name, parentCallback) { this._callback = parentCallback; this._itemTypeHandler = ItemTypeHandler.GetInstance(); this._itemHandler = ItemHandler.GetInstance(); this._documentHandler = DocumentHandler.GetInstance(); this._targetRoom = targetRoom; this._itemType = itemType; }
protected override void InitializeComponent() { base.InitializeComponent(); this._documentHandler = DocumentHandler.GetInstance(); this._itemHandler = ItemHandler.GetInstance(); this._itemTypeHandler = ItemTypeHandler.GetInstance(); this._itemTypeList = new List<ItemType>(); this._itemList = new List<Item>(); this._itemTypeList = this._itemTypeHandler.GetItemTypesBy((itemType) => true); this._itemList = this._itemHandler.GetItemsBy((item) => item.RoomID == this._documentHandler.CurrentRoom.GetID() && item.Type.Description == this._itemType.Description); this._editItemCancel = new System.Windows.Forms.Button(); this._editItemAccept = new System.Windows.Forms.Button(); this._objectTypeLabel = new System.Windows.Forms.Label(); this._amountOfItemsLabel = new System.Windows.Forms.Label(); this._amountOfItemsBorderedTextBox = new KBS2.Controls.BorderedTextBox(); this._newObjectTypeComboBox = new ComboBox(); this._currentItemLabel = new Label(); // // _currentItemLabel // this._currentItemLabel.AutoSize = true; this._currentItemLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold); this._currentItemLabel.Location = new System.Drawing.Point(150, 49); this._currentItemLabel.Name = "_objectTypeLabel"; this._currentItemLabel.Size = new System.Drawing.Size(200, 13); this._currentItemLabel.TabIndex = 21; this._currentItemLabel.Text = "Huidige objecttype: " + this._itemType.Description; // // _editItemCancel // this._editItemCancel.BackColor = System.Drawing.Color.DimGray; this._editItemCancel.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Gray; this._editItemCancel.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this._editItemCancel.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold); this._editItemCancel.ForeColor = System.Drawing.Color.White; this._editItemCancel.Location = new System.Drawing.Point(7, 148); this._editItemCancel.Margin = new System.Windows.Forms.Padding(7, 6, 7, 6); this._editItemCancel.Name = "_editItemCancel"; this._editItemCancel.Size = new System.Drawing.Size(120, 46); this._editItemCancel.TabIndex = 11; this._editItemCancel.Text = "Sluiten"; this._editItemCancel.UseVisualStyleBackColor = false; this._editItemCancel.Click += new EventHandler(this.EditItemCancel_Click); // // _editItemAccept // this._editItemAccept.BackColor = System.Drawing.Color.DimGray; this._editItemAccept.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Gray; this._editItemAccept.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this._editItemAccept.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold); this._editItemAccept.ForeColor = System.Drawing.Color.White; this._editItemAccept.Location = new System.Drawing.Point(364, 148); this._editItemAccept.Margin = new System.Windows.Forms.Padding(7, 6, 7, 6); this._editItemAccept.Name = "_editItemAccept"; this._editItemAccept.Size = new System.Drawing.Size(129, 46); this._editItemAccept.TabIndex = 13; this._editItemAccept.Text = "Wijzigen"; this._editItemAccept.UseVisualStyleBackColor = false; this._editItemAccept.Click += new EventHandler(this.EditItemAccept_Click); // // _objectTypeLabel // this._objectTypeLabel.AutoSize = true; this._objectTypeLabel.Location = new System.Drawing.Point(137, 84); this._objectTypeLabel.Name = "_objectTypeLabel"; this._objectTypeLabel.Size = new System.Drawing.Size(200, 13); this._objectTypeLabel.TabIndex = 21; this._objectTypeLabel.Text = "Kies een nieuw objecctype:"; // // _amountOfItemsLabel // this._amountOfItemsLabel.AutoSize = true; this._amountOfItemsLabel.Location = new System.Drawing.Point(108, 100); this._amountOfItemsLabel.Name = "_amountOfItemsLabel"; this._amountOfItemsLabel.Size = new System.Drawing.Size(78, 13); this._amountOfItemsLabel.TabIndex = 23; this._amountOfItemsLabel.Text = "Vul de hoeveelheid objecten in" + Environment.NewLine + "die u naar dit type wil veranderen:"; // // _amountOfItemsBorderedTextBox // this._amountOfItemsBorderedTextBox.BackColor = System.Drawing.SystemColors.ControlDark; this._amountOfItemsBorderedTextBox.DefaultBorderColor = System.Drawing.SystemColors.ControlDark; this._amountOfItemsBorderedTextBox.FocusedBorderColor = System.Drawing.Color.Red; this._amountOfItemsBorderedTextBox.Location = new System.Drawing.Point(275, 100); this._amountOfItemsBorderedTextBox.Name = "_amountOfItemsBorderedTextBox"; this._amountOfItemsBorderedTextBox.Padding = new System.Windows.Forms.Padding(1); this._amountOfItemsBorderedTextBox.Size = new System.Drawing.Size(100, 20); this._amountOfItemsBorderedTextBox.TabIndex = 24; // // _newObjectTypeTextBox // this._newObjectTypeComboBox.FormattingEnabled = true; this._newObjectTypeComboBox.Location = new System.Drawing.Point(275, 76); this._newObjectTypeComboBox.Name = "_newObjectTypeComboBox"; this._newObjectTypeComboBox.Size = new System.Drawing.Size(100, 21); this._newObjectTypeComboBox.TabIndex = 20; this._newObjectTypeComboBox.SelectedIndexChanged += new EventHandler(this.ObjectComboBx_SelectedIndexChanged); // // EditItem // this._panel.Controls.Add(this._currentItemLabel); this._panel.Controls.Add(this._editItemAccept); this._panel.Controls.Add(this._editItemCancel); this._panel.Controls.Add(this._amountOfItemsBorderedTextBox); this._panel.Controls.Add(this._amountOfItemsLabel); this._panel.Controls.Add(this._objectTypeLabel); this._panel.Controls.Add(this._newObjectTypeComboBox); this.FillNewObjectTypeComboBox(); this.build(); }
// The constructor for the main view public MainView(string name) : base(name) { this._locationlist = new List<Label>(); this._buildinglist = new List<Label>(); this._floorlist = new List<Label>(); this._doch = DocumentHandler.GetInstance(); this.SelectCorrectLocations(); this._addLocationDialog = new AddLocationDialog("Locatie toevoegen", delegate () { this.RemoveAllLocationsFromPanel(); this.SelectCorrectLocations(); this._locationLabelLocationY = 0; this.PlaceLocationsOnPanel(); this.DecisionShowScrollbar(); }); this._addBuildingDialog = new AddBuildingDialog("Gebouw toevoegen", delegate () { // If the floor has been added, all floors and their labels will be deleted from the panel and their arrays this.RemoveAllBuildingsFromPanel(); this.SelectCorrectBuildings(this._currentLocationID); // The floors of the current building are being selected. this._locationLabelBuildingY = 0; // The field for the Y-coordinate of the labels of the floors is set to zero. this.PlaceBuildingsOnPanel(); // The labels of the floors are being placed on the panel with each their own spcific Y-coordinate. this.DecisionShowScrollbar(); // Decide if the scrollbar has to be shown }); }); this._addFloorDialog = new AddFloorDialog("Verdieping toevoegen", delegate () { this.RemoveAllFloorsFromPanel(); // If the floor has been added, all floors and their labels will be deleted from the panel and their arrays this.SelectCorrectFloors(this._currentBuildingID); // The floors of the current building are being selected. this._locationLabelFloorY = 0; // The field for the Y-coordinate of the labels of the floors is set to zero. this.PlaceFloorsOnPanel(); // The labels of the floors are being placed on the panel with each their own spcific Y-coordinate. this.DecisionShowScrollbar(); // Decide if the scrollbar has to be shown }); this._deleteLocationDialog = new DeleteLocationDialog("Locatie verwijderen", delegate () { this.RemoveAllLocationsFromPanel(); this.RemoveAllBuildingsFromPanel(); this.RemoveAllFloorsFromPanel(); this.SelectCorrectLocations(); this._locationLabelLocationY = 0; this.PlaceLocationsOnPanel(); this.DecisionShowScrollbar(); }); this._deleteBuildingDialog = new DeleteBuildingDialog("Gebouw verwijderen", delegate () { // If the floor has been added, all floors and their labels will be deleted from the panel and their arrays this.RemoveAllFloorsFromPanel(); this.RemoveAllBuildingsFromPanel(); this.SelectCorrectBuildings(this._currentLocationID); // The floors of the current building are being selected. this._locationLabelBuildingY = 0; // The field for the Y-coordinate of the labels of the floors is set to zero. this.PlaceBuildingsOnPanel(); // The labels of the floors are being placed on the panel with each their own spcific Y-coordinate. this.DecisionShowScrollbar(); // Decide if the scrollbar has to be shown }); }); this._deleteFloorDialog = new DeleteFloorDialog("Verdieping verwijderen", delegate () { this.RemoveAllFloorsFromPanel(); // If the floor has been added, all floors and their labels will be deleted from the panel and their arrays this.SelectCorrectFloors(this._currentBuildingID); // The floors of the current building are being selected. this._locationLabelFloorY = 0; // The field for the Y-coordinate of the labels of the floors is set to zero. this.PlaceFloorsOnPanel(); // The labels of the floors are being placed on the panel with each their own spcific Y-coordinate. this.DecisionShowScrollbar(); // Decide if the scrollbar has to be shown }); this._editLocationDialog = new EditLocationDialog("Locatie wijzigen", delegate () { this.RemoveAllLocationsFromPanel(); this.SelectCorrectLocations(); this._locationLabelLocationY = 0; this.PlaceLocationsOnPanel(); this.DecisionShowScrollbar(); }); this._editBuildingDialog = new EditBuildingDialog("Gebouw wijzigen", delegate () { this.RemoveAllBuildingsFromPanel(); this.SelectCorrectBuildings(this._currentLocationID); this._locationLabelBuildingY = 0; this.PlaceBuildingsOnPanel(); this.DecisionShowScrollbar(); }); this._editFloorDialog = new EditFloorDialog("Verdieping wijzigen", delegate () { this.RemoveAllFloorsFromPanel(); this.SelectCorrectFloors(this._currentBuildingID); this._locationLabelFloorY = 0; this.PlaceFloorsOnPanel(); this.DecisionShowScrollbar(); }); this._addItemTypeDialog = new AddItemTypeDialog("Meubel type toevoegen", null); this._addItemDialog = new AddItemDialog("Meubel toevoegen",null); }