|
4 | 4 | using System.Linq; |
5 | 5 | using System.Text.RegularExpressions; |
6 | 6 | using System.Windows; |
| 7 | +using System.Windows.Input; |
7 | 8 | using Dynamo.Logging; |
| 9 | +using Dynamo.UI.Commands; |
8 | 10 | using Dynamo.Wpf.ViewModels.Core; |
9 | 11 |
|
10 | 12 | namespace Dynamo.ViewModels |
@@ -65,7 +67,7 @@ public enum State |
65 | 67 | // In order to stay above these, we need a high ZIndex value. |
66 | 68 | private double zIndex; |
67 | 69 | private Style infoBubbleStyle; |
68 | | - |
| 70 | + |
69 | 71 | [Obsolete] |
70 | 72 | public Direction connectingDirection; |
71 | 73 |
|
@@ -506,6 +508,39 @@ private void InitializeInfoBubble(DynamoViewModel dynamoViewModel) |
506 | 508 |
|
507 | 509 | RefreshNodeInformationalStateDisplay(); |
508 | 510 | } |
| 511 | + |
| 512 | + /// <summary> |
| 513 | + /// Copies the text of an info bubble message to the clipboard |
| 514 | + /// </summary> |
| 515 | + /// <param name="parameter">The InfoBubbleDataPacket to copy</param> |
| 516 | + private void CopyTextToClipboard(object parameter) |
| 517 | + { |
| 518 | + if (parameter is InfoBubbleDataPacket infoBubbleDataPacket) |
| 519 | + { |
| 520 | + try |
| 521 | + { |
| 522 | + System.Windows.Clipboard.SetText(infoBubbleDataPacket.Text); |
| 523 | + Analytics.TrackEvent(Actions.Copy, Categories.NodeOperations, |
| 524 | + infoBubbleDataPacket.Style.ToString(), 1); |
| 525 | + } |
| 526 | + catch (Exception ex) |
| 527 | + { |
| 528 | + DynamoViewModel.Model.Logger.Log(Wpf.Properties.Resources.CopyToClipboardFailedMessage); |
| 529 | + DynamoViewModel.Model.Logger.Log(ex.Message); |
| 530 | + } |
| 531 | + } |
| 532 | + } |
| 533 | + |
| 534 | + /// <summary> |
| 535 | + /// Determines if a message can be copied to clipboard |
| 536 | + /// </summary> |
| 537 | + /// <param name="parameter">The InfoBubbleDataPacket to check</param> |
| 538 | + /// <returns>True if the message can be copied</returns> |
| 539 | + private bool CanCopyTextToClipboard(object parameter) |
| 540 | + { |
| 541 | + return parameter is InfoBubbleDataPacket infoBubbleDataPacket && |
| 542 | + !string.IsNullOrEmpty(infoBubbleDataPacket.Text); |
| 543 | + } |
509 | 544 |
|
510 | 545 | #endregion |
511 | 546 |
|
|
0 commit comments