Example #1
0
        /// <summary>
        /// Clears the contents of the clipboard
        /// </summary>
        public void Clear()
        {
            _currentData.Clear();
            _currentData = null;

            ClipboardChanged?.Invoke(this, new ClipboardEventArgs(null, ClipboardEventType.Clear));
        }
Example #2
0
        /// <summary>
        /// Stores the given object on this clipboard.
        /// Setting a new object clears any object that was already on the clipboard
        /// </summary>
        /// <param name="dataObject">The new object to set to the clipboard</param>
        public void SetObject(IClipboardObject dataObject)
        {
            if (_currentData != null && _currentData != dataObject)
            {
                _currentData.Clear();
            }

            _currentData = dataObject;

            ClipboardChanged?.Invoke(this, new ClipboardEventArgs(_currentData, ClipboardEventType.Set));
        }
Example #3
0
 /// <summary>
 /// Initializes a new class of the ClipboardEventArgs
 /// </summary>
 /// <param name="newObject">Gets the object that was inputed into the clipboard</param>
 /// <param name="eventType">Gets the type of the event</param>
 public ClipboardEventArgs(IClipboardObject newObject, ClipboardEventType eventType)
 {
     NewObject = newObject;
     EventType = eventType;
 }