private void uk_addWrestler_Click(object sender, EventArgs e) { if (uk_wrestlerResults.Items.Count == 0) { return; } try { WresIDGroup wrestler = (WresIDGroup)uk_wrestlerResults.SelectedItem; foreach (UkemiNotification item in uk_wrestlers.Items) { if (item.Name == wrestler.Name) { return; } } UkemiNotification notification = new UkemiNotification { Name = wrestler.Name, Type = EnumLibrary.NotificationType.Wrestler, CheerList = new List <CheerVoiceEnum>() }; uk_wrestlers.Items.Add(notification); uk_wrestlers.SelectedIndex = 0; } catch (Exception ex) { L.D("AddWrestlerError: " + ex); } }
private void uk_addWrestlerNoticiation_Click(object sender, EventArgs e) { if (uk_wrestlers.Items.Count == 0) { return; } try { UkemiNotification notification = (UkemiNotification)uk_wrestlers.SelectedItem; foreach (var cheer in notification.CheerList) { if ((CheerVoiceEnum)uk_notificationList.SelectedItem == cheer) { return; } } notification.CheerList.Add((CheerVoiceEnum)uk_notificationList.SelectedItem); int index = uk_wrestlers.SelectedIndex; uk_wrestlers.Items[index] = notification; uk_wrestlers_SelectedIndexChanged(null, null); } catch (Exception ex) { L.D("AddWrestlerNotificationError: " + ex); } }
private void uk_addRing_Click(object sender, EventArgs e) { if (uk_ringResults.Items.Count == 0) { return; } try { RingInfo ring = (RingInfo)uk_ringResults.SelectedItem; foreach (UkemiNotification item in uk_ringsList.Items) { if (item.Name.Equals(ring.name)) { return; } } UkemiNotification notification = new UkemiNotification { Name = ring.name, Type = EnumLibrary.NotificationType.Promotion, CheerList = new List <CheerVoiceEnum>() }; uk_ringsList.Items.Add(notification); uk_ringsList.SelectedIndex = 0; uk_rings_SelectedIndexChanged(null, null); } catch (Exception ex) { L.D("AddRingError: " + ex); } }
private void LoadNotificationData() { System.String filePath = Path.Combine(saveFolderName, saveFileName); if (File.Exists(filePath)) { using (StreamReader sr = new StreamReader(filePath)) { List <UkemiNotification> wrestlers = new List <UkemiNotification>(); List <UkemiNotification> rings = new List <UkemiNotification>(); var lines = File.ReadAllLines(filePath); foreach (System.String line in lines) { UkemiNotification notification = new UkemiNotification(); notification.LoadNotificationData((string)line); if (notification.Type == EnumLibrary.NotificationType.Wrestler) { wrestlers.Add(notification); } else { rings.Add(notification); } } uk_wrestlers.Items.Clear(); foreach (UkemiNotification item in wrestlers) { uk_wrestlers.Items.Add(item); } uk_ringsList.Items.Clear(); foreach (UkemiNotification item in rings) { uk_ringsList.Items.Add(item); } } if (uk_wrestlers.Items.Count > 0) { uk_wrestlers.SelectedIndex = 0; uk_wrestlers_SelectedIndexChanged(null, null); } if (uk_ringsList.Items.Count > 0) { uk_ringsList.SelectedIndex = 0; uk_rings_SelectedIndexChanged(null, null); } } }
private void uk_rings_SelectedIndexChanged(object sender, EventArgs e) { if (uk_ringsList.SelectedItem == null) { return; } UkemiNotification notification = (UkemiNotification)uk_ringsList.SelectedItem; uk_ringNotifications.Items.Clear(); foreach (var cheer in notification.CheerList) { uk_ringNotifications.Items.Add(cheer); } if (uk_ringNotifications.Items.Count > 0) { uk_ringNotifications.SelectedIndex = 0; } }
private void uk_removeWrestlerNotification_Click(object sender, EventArgs e) { if (uk_wrestlers.Items.Count == 0 || uk_wrestlerNotification.Items.Count == 0) { return; } try { UkemiNotification notification = (UkemiNotification)uk_wrestlers.SelectedItem; notification.CheerList.Remove((CheerVoiceEnum)uk_wrestlerNotification.SelectedItem); int index = uk_wrestlers.SelectedIndex; uk_wrestlers.Items[index] = notification; uk_wrestlers_SelectedIndexChanged(null, null); } catch (Exception exception) { L.D("RemoveNotificationError: " + exception); } }