Exemplo n.º 1
0
        private void AddContextMenuStripItems()
        {
            _itemHighlight         = new ToolStripMenuItem("Highlight");
            _itemHighlight.Click  += (sender, e) => _watchVarControl.ToggleHighlighted();
            _itemHighlight.Checked = _watchVarControl.Highlighted;

            _itemLock        = new ToolStripMenuItem("Lock");
            _itemLock.Click += (sender, e) => ToggleLocked(null, _watchVarControl.FixedAddressListGetter());

            _itemRemoveAllLocks        = new ToolStripMenuItem("Remove All Locks");
            _itemRemoveAllLocks.Click += (sender, e) => WatchVariableLockManager.RemoveAllLocks();

            _itemDisableAllLocks        = new ToolStripMenuItem("Disable All Locks");
            _itemDisableAllLocks.Click += (sender, e) => LockConfig.LockingDisabled = !LockConfig.LockingDisabled;

            ToolStripMenuItem itemCopyUnrounded = new ToolStripMenuItem("Copy");

            itemCopyUnrounded.Click += (sender, e) => Clipboard.SetText(
                GetValue(false, true, _watchVarControl.FixedAddressListGetter()).ToString());

            ToolStripMenuItem itemPaste = new ToolStripMenuItem("Paste");

            itemPaste.Click += (sender, e) => _watchVarControl.SetValue(Clipboard.GetText());

            _contextMenuStrip.AddToBeginningList(_itemHighlight);
            _contextMenuStrip.AddToBeginningList(_itemLock);
            _contextMenuStrip.AddToBeginningList(_itemRemoveAllLocks);
            _contextMenuStrip.AddToBeginningList(_itemDisableAllLocks);
            _contextMenuStrip.AddToBeginningList(itemCopyUnrounded);
            _contextMenuStrip.AddToBeginningList(itemPaste);
        }
Exemplo n.º 2
0
        public bool Paste()
        {
            bool success = _watchVarControl.SetValue(Clipboard.GetText(), true);

            _watchVarControl.FlashColor(success ? WatchVariableControl.PASTE_COLOR : WatchVariableControl.FAILURE_COLOR);
            return(success);
        }
Exemplo n.º 3
0
        public bool SetVariableValueByName(string name, object value, bool allowToggle)
        {
            WatchVariableControl control = GetCurrentVariableControls().FirstOrDefault(c => c.VarName == name);

            if (control == null)
            {
                return(false);
            }
            return(control.SetValue(value, allowToggle));
        }