Ejemplo n.º 1
0
        private void btnRandomDelay_Click(object sender, EventArgs e)
        {
            GenericInputDialog gid = new GenericInputDialog();
            gid.Initialize(new Delay(1.00, 0.00));

            if (gid.ShowDialog() == DialogResult.OK)
            {
                double baseValue = (double)gid.Results["base"];
                double deviation = (double)gid.Results["dev"];

                lstActions.Items.Add(new Delay(baseValue, deviation));
            }
        }
Ejemplo n.º 2
0
        // context menu
        private void toolStripMenuItemEdit_Click(object sender, EventArgs e)
        {
            if (lstActions.SelectedItems.Count <= 0) return;

            object[] selectedObjects = new object[lstActions.SelectedItems.Count];
            lstActions.SelectedItems.CopyTo(selectedObjects, 0);

            GenericInputDialog gid = new GenericInputDialog();

            for (int i = 0; i < selectedObjects.Length; i++)
            {
                object o = selectedObjects[i];
                Type oType = o.GetType();
                if (!typeof(Command).IsAssignableFrom(oType)) continue;

                Command c = (Command)o;
                //dynamic dynamicCommand = Convert.ChangeType(o, oType);
                c = gid.Edit(c);

                int realCommandIndex = lstActions.Items.IndexOf(lstActions.SelectedItems[i]);
                lstActions.Items[realCommandIndex] = c;
            }
        }