Ejemplo n.º 1
0
        private void newTargetPlatformSelected(object sender, SelectionChangedEventArgs e)
        {
            ComboBoxItem cbi = (comboTargetPlatform.SelectedItem as ComboBoxItem);

            if (cbi == null)
            {
                return;
            }

            string currentSelection = cbi.Content.ToString();

            Debug.WriteLine(currentSelection);

            if (currentSelection == "-NEW ENTRY-")
            {
                string newTarget = MessageBoxHandler.showEntryBox("Special Target Platform", "Enter New Target Platform Name", "Submit");

                if (string.IsNullOrEmpty(newTarget) || string.IsNullOrWhiteSpace(newTarget))
                {
                    System.Media.SystemSounds.Exclamation.Play();
                    MessageBoxHandler.showMessageBox("Entries can NOT be empty!", "Blank Input", "Sowwy ;w;");
                    MessageBoxHandler.showMessageBox("All is good", "Forgiveness", "♥");
                    comboTargetPlatform.SelectedIndex = 0;
                    return;
                }
                else
                {
                    ComboBoxItem newItem = new ComboBoxItem();
                    newItem.Content = newTarget;
                    comboTargetPlatform.Items.Add(newItem);
                    comboTargetPlatform.SelectedItem = newItem;
                }
            }
        }