예제 #1
0
        public static string Prompt(string f, string[] teas)
        {
            RateTeaWindow inst = new RateTeaWindow(f, teas);

            inst.ShowDialog();
            if (inst.DialogResult == true)
            {
                return(inst.ResponseText);
            }
            return(null);
        }
예제 #2
0
        private void Rate_Button_Click(object sender, RoutedEventArgs e)
        {
            List <string> selectedFriends = LB1.SelectedItems.Cast <String>().ToList();

            foreach (string f in selectedFriends)
            {
                string newTeaRate = RateTeaWindow.Prompt(f, teas.ToArray());
                if (!String.IsNullOrEmpty(newTeaRate))
                {
                    friendDict[f].AddTea(newTeaRate);
                    string tea = newTeaRate.Split(',')[1];
                    if (!teas.Contains(tea))
                    {
                        teas.Add(tea);
                        MessageBox.Show("New type of tea added: \n" + tea);
                    }
                }
            }
            //NewWindow.Prompt("Enter the name of the new friend:", "New Friend", inputType: NewWindow.InputType.Text);
        }