コード例 #1
0
        private void EditRoutineMenuItem_Click(object sender, EventArgs e)
        {
            int idx = listBox_routines.SelectedIndex;

            if (idx >= 0 && idx < listBox_routines.Items.Count)
            {
                var routine = _routines[idx];

                EditValueForm form = new EditValueForm("Edit Dlist",
                                                       "Enter the address and coordinates of the dlist to add.",
                                                       IsInputValid, $"{routine.Address:X8}; {routine.X}; {routine.Y}; {routine.Z}");

                if (form.ShowDialog() == DialogResult.OK)
                {
                    var parts = form.Result.Replace(" ", "").Split(";");

                    routine.X         =
                        routine.Y     =
                            routine.Z = 0;
                    routine.Address   = SegmentedAddress.Parse(parts[0], true);

                    if (parts.Length > 1)
                    {
                        routine.X = int.Parse(parts[1]);
                        routine.Y = int.Parse(parts[2]);
                        routine.Z = int.Parse(parts[3]);
                    }
                    NewRender();
                }
            }
        }
コード例 #2
0
        private void AddRoutineMenuItem_Click(object sender, System.EventArgs e)
        {
            EditValueForm form = new EditValueForm("Add Dlist", "Enter the address and coordinates of the dlist to add.", IsInputValid);

            if (form.ShowDialog() == DialogResult.OK)
            {
                var parts = form.Result.Replace(" ", "").Split(";");
                int x = 0, y = 0, z = 0;
                var addr = SegmentedAddress.Parse(parts[0], true);
                if (parts.Length > 1)
                {
                    x = int.Parse(parts[1]);
                    y = int.Parse(parts[2]);
                    z = int.Parse(parts[3]);
                }

                AddDList(addr.VAddr, x, y, z);
            }
        }