Ejemplo n.º 1
0
        private void ArgumentBox_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            int funcnum = Int32.Parse(strBefore(strAfter(FunctionBox.SelectedItem.ToString(), "("), ")"));

            if (NamesandNumbers.Functiontemplates.ContainsKey(funcnum))
            {
                DynamicEdit       de        = new DynamicEdit();
                FunctionTemplates ft        = NamesandNumbers.Functiontemplates[funcnum];
                PlayfieldValue    dummypf   = new PlayfieldValue();
                LineValue         dummyline = new LineValue();
                int argnum = 0;
                foreach (FunctionTemplate tmpl in ft.Templates)
                {
                    if (ArgumentBox.Items.Count > argnum)
                    {
                        tmpl.baseValue = ArgumentBox.Items[argnum++].ToString();
                    }
                }
                de.createDynels(ft);
                de.Controls["button_cancel"].Enabled = sender != null;
                de.ShowDialog();

                if (de.DialogResult == DialogResult.OK)
                {
                    ArgumentBox.Items.Clear();
                    argnum = 0;
                    common.execSQL("DELETE FROM statel_function_arguments WHERE statel_id=" + selectedstatel + " AND event_id=" + selectedevent + " AND function_id=" + selectedfunction);
                    foreach (FunctionTemplate tmpl in de.template.Templates)
                    {
                        ArgumentBox.Items.Add(tmpl.baseValue);
                        common.execSQL("INSERT INTO statel_function_arguments VALUES (" + argnum + "," + selectedfunction + "," + selectedevent + "," + selectedstatel + ",'" + tmpl.baseValue + "')");
                        argnum++;
                    }
                }
            }
            else
            {
                MessageBox.Show("Function not implemented yet");
            }
        }
Ejemplo n.º 2
0
        private void ArgumentBox_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            
            int funcnum = Int32.Parse(strBefore(strAfter(FunctionBox.SelectedItem.ToString(), "("), ")"));
            if (NamesandNumbers.Functiontemplates.ContainsKey(funcnum))
            {
                DynamicEdit de = new DynamicEdit();
                FunctionTemplates ft = NamesandNumbers.Functiontemplates[funcnum];
                PlayfieldValue dummypf = new PlayfieldValue();
                LineValue dummyline = new LineValue();
                int argnum = 0;
                foreach (FunctionTemplate tmpl in ft.Templates)
                {
                    if (ArgumentBox.Items.Count > argnum)
                    {
                        tmpl.baseValue = ArgumentBox.Items[argnum++].ToString();
                    }
                }
                de.createDynels(ft);
                de.Controls["button_cancel"].Enabled=sender!=null;
                de.ShowDialog();

                if (de.DialogResult == DialogResult.OK)
                {
                    ArgumentBox.Items.Clear();
                    argnum = 0;
                    common.execSQL("DELETE FROM statel_function_arguments WHERE statel_id=" + selectedstatel + " AND event_id=" + selectedevent + " AND function_id=" + selectedfunction);
                    foreach (FunctionTemplate tmpl in de.template.Templates)
                    {
                        ArgumentBox.Items.Add(tmpl.baseValue);
                        common.execSQL("INSERT INTO statel_function_arguments VALUES (" + argnum + "," + selectedfunction + "," + selectedevent + "," + selectedstatel + ",'" + tmpl.baseValue + "')");
                        argnum++;
                    }
                }
            }
            else
            {
                MessageBox.Show("Function not implemented yet");
            }
        }