public void SelectedColumnHandler(Object obj, EventArgs e) { Position position = new Position(SelectedRow, SelectedColumn); IBookableItem item = _bCoord.GetBookableItem(SelectedSector, position); if (item == null) { _labelItemValue.Text = ""; _labelItemValue.Tag = null; } else { bool available = _pCoord.IsAvailable(SelectedSector, position, Range); if (available) { _labelItemValue.Text = item.ToString(); _labelItemValue.ForeColor = Color.Green; _labelItemValue.Tag = item; } else { _labelItemValue.Text = item.ToString(); _labelItemValue.ForeColor = Color.Red; _labelItemValue.Tag = null; } } }
private void Populate(TreeNode tnSector, DateRange range) { Sector sector = tnSector.Tag as Sector; for (int i = 1; i <= sector.Rows; i++) { TreeNode tnRow = new TreeNode("Riga " + i); tnRow.Tag = i; for (int j = 1; j <= sector.Columns; j++) { Position positionToAdd = new Position(i, j); IBookableItem item = _bCoordinator.GetBookableItem(sector, positionToAdd); TreeNode tnBookableItem; if (item == null) { tnBookableItem = new TreeNode(j + " - nessun elemento"); tnBookableItem.Tag = null; } else { string status = "Occupato"; Color color = Color.Red; bool available = _pCoordinator.IsAvailable(sector, positionToAdd, range); if (available) { status = "Libero"; color = Color.Green; } tnBookableItem = new TreeNode(j + " - " + status + " - " + item.ToString()); tnBookableItem.ForeColor = color; tnBookableItem.Tag = item; foreach (IItem plugin in _iCoordinator.GetAssociableItemOf(item.BaseItem)) { TreeNode tnPluginItem = new TreeNode("Plugin - " + plugin.FriendlyName + "(+€" + plugin.DailyPrice + ")"); tnPluginItem.ForeColor = color; tnPluginItem.Tag = plugin; tnBookableItem.Nodes.Add(tnPluginItem); } } tnRow.Nodes.Add(tnBookableItem); } tnSector.Nodes.Add(tnRow); } }