Ejemplo n.º 1
0
        public void Read(ushort address, int count, MessyLab.PicoComputer.Data data)
        {
            _abort = false;
            // We use main form for invoking because the handle for the pad might not be created yet.
            var mainForm = Project.Platform.Gui.MainForm;

            for (int i = 0; i < count; i++)
            {
                if (mainForm.InvokeRequired)
                {
                    mainForm.Invoke(new Action <string>(Input), string.Format("An integer value for location #{0}: ", address));
                    lock (this)
                    {
                        if (_abort)
                        {
                            break;
                        }
                        Done.Reset();
                    }
                    Done.WaitOne();
                    data[address++] = (ushort)short.Parse(ReadValue);
                }
                if (_abort)
                {
                    break;
                }
            }
        }
Ejemplo n.º 2
0
        public void Write(ushort address, int count, MessyLab.PicoComputer.Data data)
        {
            // We use main form for invoking because the handle for the pad might not be created yet.
            var mainForm = Project.Platform.Gui.MainForm;

            if (mainForm.InvokeRequired)
            {
                mainForm.Invoke(new Action <ushort, int, MessyLab.PicoComputer.Data>(Write), address, count, data);
                return;
            }
            ShowOnMainForm();
            var sb = new StringBuilder();

            foreach (string l in outTextBox.Lines)
            {
                if (string.IsNullOrEmpty(l))
                {
                    continue;
                }
                sb.AppendLine(l);
            }
            for (int i = 0; i < count; i++)
            {
                short value = (short)data[address];
                sb.AppendLine(string.Format("The contents of memory location #{0} = {1}", address, value));
                address++;
            }
            outTextBox.Lines = sb.ToString().Split(new string[] { Environment.NewLine }, StringSplitOptions.None);

            ScrollDown();

            Application.DoEvents();
        }