private void searchTextBox_TextChanged(object sender, EventArgs e) { if (searchTextBox.Text != "") { List <Item> searchItems = Item.GetItemsByName(searchTextBox.Text); ShowItemsList showItemsList = new ShowItemsList(searchItems, ShowItemsList.createNoneAlarmStatus(searchItems.Count), null); searchPanel.Controls.Clear(); if (searchItems.Count > 0) { searchPanel.Controls.Add(showItemsList); searchPanel.Visible = true; searchLabel.Visible = false; } else { searchPanel.Visible = false; searchLabel.Visible = true; } } else { searchLabel.Visible = false; searchPanel.Visible = false; } }
private void showMostConsumedItems() { List <Item> allItems = Item.GetMostConsumedItems(); ShowItemsList showItemsList = new ShowItemsList(allItems, ShowItemsList.createNoneAlarmStatus(allItems.Count), null); mostConsumedPanel.Controls.Clear(); mostConsumedPanel.Controls.Add(showItemsList); }
private void showRecentlyAddedItems() { List <Item> recentlyAddedItems = Item.GetRecentlyAddedItems(); List <AlarmStatus> noneAlarms = new List <AlarmStatus>(); for (int i = 0; i < recentlyAddedItems.Count; i++) { noneAlarms.Add(AlarmStatus.None); } ShowItemsList showItemsList = new ShowItemsList(recentlyAddedItems, noneAlarms, null); recentlyAddedPanel.Controls.Add(showItemsList); }
public void showAllItems() { List <Item> allItems = Item.GetAllItems(); ShowItemsList showItemsList = new ShowItemsList(allItems, ShowItemsList.createNoneAlarmStatus(allItems.Count), this); for (int i = 0; i < allItems.Count; i++) { searchTextBox.AutoCompleteCustomSource.Add(allItems[i].Name); } allItemsPanel.Controls.Clear(); allItemsPanel.Controls.Add(showItemsList); }
private void showMonitoringItems() { addDateExpiredItems(); addTemperatureExpiredItems(); ShowItemsList showItemsList = new ShowItemsList(monitoringItems, alarms, null); if (monitoringItems.Count > 0) { using (var soundPlayer = new SoundPlayer(Application.StartupPath + @"\sounds\alarm.wav")) { soundPlayer.Play(); // can also use soundPlayer.PlaySync() } } monitoringExpirtyPanel.Controls.Add(showItemsList); }