コード例 #1
0
        protected void OnAccept(object sender, EventArgs e)
        {
            bool success = true;
            Dictionary <string, PreSampleDefinition> defsToSend = new Dictionary <string, PreSampleDefinition> ();

            foreach (EntryDefPair edp in entries)
            {
                if (edp.Ent.Text.Length > 0)
                {
                    if (!defsToSend.ContainsKey(edp.Ent.Text))
                    {
                        defsToSend.Add(edp.Ent.Text, new PreSampleDefinition(edp.Pres, edp.Ent.Text));
                    }
                    else
                    {
                        defsToSend [edp.Ent.Text].MergeSamp(edp.Pres);
                    }
                }
                else
                {
                    success = false;
                }
            }
            if (success)
            {
                this.Destroy();
                Gtk.Application.Invoke(delegate {
                    MainData.SendSampleDefsToSamples(new List <PreSampleDefinition> (defsToSend.Values));
                }
                                       );
            }
            else
            {
                MainData.ShowMessageWindow("You need a sample ID for each set of information!", false);
            }
        }