Пример #1
0
        /// <summary>
        /// Adds a watch item to the listview. Displays a dialog allowing the user to
        /// specify the watchentry to create.
        /// </summary>
        public void AddWatchItem()
        {
            //create an instance of the add watch dialog
            AddWatch aw = new AddWatch();

            //set the code label resolver delegate
            aw.CodeLabels = _codeLabelsHandler();

            //show the dialog. If OK was pressed, then add watch entry
            if (aw.ShowDialog(this) == DialogResult.OK)
            {
                string lab = aw.Label;
                if (!string.IsNullOrEmpty(lab))
                {
                    //resolve the label name to an address in memory. If we cannot resolve it, just exit
                    uint address = 0;
                    if (_resolveSymbolHandler(lab, ref address))
                    {
                        //create a new watch entry and set the resolved address
                        WatchEntry we = new WatchEntry(lab, aw.WatchType, aw.Signed, aw.DisplayHex, _JM);
                        we.Address = address;

                        //add watch entry to listview
                        ListViewItem lvi = new ListViewItem(new string[2] {
                            we.Label, we.ToString()
                        });
                        lvi.Tag = we;
                        listView1.Items.Add(lvi);
                    }
                }
            }
        }//AddWatchItem
Пример #2
0
        }     //resetView

        /// <summary>
        /// This is called when the view needs to be updated. When the simulator hits a breakpoint or
        /// the program terminates are examples.
        /// Evaluate all the watch entries and update their values in the listview.
        /// </summary>
        public void updateView()
        {
            if (_JM == null || !_JM.ValidLoadedProgram)
            {
                return;
            }
            foreach (ListViewItem lvi in listView1.Items)
            {
                WatchEntry we = (lvi.Tag as WatchEntry);
                lvi.SubItems[1].Text = we.ToString();
            }
        }//updateView