Exemple #1
0
        private static List <Tuple <string, int, int> > execDialog(string wrong, string c_object_ID)
        {
            FormDialog dlg = new FormDialog(wrong, true);

            dlg.c_ID = c_object_ID;
            DialogResult result = dlg.ShowDialog(null);
            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);
                }
            }
            return(null);
        }