public void SetClipboardText(string text, Action<ClipboardDataItem> errorCallback)
 {
     DisableNotifications();
     try
     {
         Clipboard.SetText(text);
     }
     catch (Exception ex)
     {
         var item = new ClipboardDataItem(string.Format(Resources.ClipboardException, ex.Message), true);
         errorCallback?.Invoke(item);
     }
     EnableNotifications();
 }
 private static string GetUniqueKey(Message message, ClipboardDataItem data)
 {
     var key = $"{message.HWnd}{message.Msg}{data.Snippet}{data.NumberOfLines}";
     return Convert.ToBase64String(Encoding.Default.GetBytes(key));
 }
 private bool CanDeleteItem(ClipboardDataItem item)
 {
     return true;
 }
 private bool CanCopyToClipboard(ClipboardDataItem item)
 {
     return true;
 }
 private void AddStringToHistoryCollection(ClipboardDataItem item)
 {
     if (!String.IsNullOrEmpty(item.Data))
     {
         HistoryCollection.AddItem(item);
     }
 }
 private void OnClipboardUpdate(ClipboardDataItem item)
 {
     AddStringToHistoryCollection(item);
 }
 private void DeleteItem(ClipboardDataItem item)
 {
     HistoryCollection.Remove(item);
 }
 private void CopyToClipboard(ClipboardDataItem item)
 {
     _clipboardService.SetClipboardText(item.Data, errorItem =>
     {
         HistoryCollection.AddItem(errorItem);
     });
 }