Exemple #1
0
        private static List <Tuple <string, int, int> > execDialog(Tuple <string, int, int> wrong, Form parent)
        {
            FormDialog   dlg    = new FormDialog(wrong.Item1 + " " + wrong.Item2 + " " + wrong.Item3, false);
            DialogResult result = dlg.ShowDialog(parent);
            List <Tuple <string, int, int> > list = new List <Tuple <string, int, int> >();

            if (dlg.radioButton1.Checked)
            {
                if (result == DialogResult.OK)
                {
                    list.Add(new Tuple <string, int, int>(dlg.GetGoodName(), dlg.GetGoodType(), dlg.GetGoodDesc()));
                    return(list);
                }
                else if (result == DialogResult.Cancel)
                {
                    throw new Exception("Przerwano przez użytkownika.");
                }
                else
                {
                    return(null);
                }
            }
            else if (dlg.radioButton2.Checked)
            {
                if (result == DialogResult.OK)
                {
                    string   s    = dlg.getGoodString();
                    string[] sarr = s.Split(';');
                    foreach (string elem in sarr)
                    {
                        string[] elemArr = elem.Split(':');
                        list.Add(new Tuple <string, int, int>(elemArr[0], int.Parse(elemArr[2]), int.Parse(elemArr[1])));
                    }
                    return(list);
                }
                else if (result == DialogResult.Cancel)
                {
                    throw new Exception("Przerwano przez użytkownika.");
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                return(null);
            }
        }