Exemplo n.º 1
0
        private void ClipboardChanged(Object sender, SharpClipboard.ClipboardChangedEventArgs e)
        {
            Debug.WriteLine(e.ContentType.ToString());
            // Is the content copied of text type?
            if (e.ContentType == SharpClipboard.ContentTypes.Text)
            {
                var text = (string)e.Content;
                Debug.WriteLine(text);
                if (text.IsProductionNumber())
                {
                    var newText = WhatsOnMode ? text.ToWhatsOnProductionNumber() : text.ToCleanProductionNumber();
                    if (newText != text)
                    {
                        ClipboardUtil.TrySetText(newText);
                    }
                }
                else if (text.IsEscapedUncPath())
                {
                    ClipboardUtil.TrySetText(text.UnescapedUncPath());
                }

                text = Clipboard.GetText();
                UpdateHistory(text);
            }
            UpdateIcon();
        }
Exemplo n.º 2
0
        void Copy(object sender, EventArgs e)
        {
            if (!(sender is MenuItem menuItem))
            {
                return;
            }
            var newText = GetTextFromHistory(menuItem);

            if (newText != Clipboard.GetText())
            {
                ClipboardUtil.TrySetText(newText);
            }
        }
Exemplo n.º 3
0
        private void ToggleWhatsOnMode(object sender, EventArgs e)
        {
            _whatsOnModeToggle.Checked = !WhatsOnMode;

            if (!Clipboard.ContainsText())
            {
                return;
            }

            var text = Clipboard.GetText();

            if (!text.IsProductionNumber())
            {
                return;
            }

            text = WhatsOnMode ? text.ToWhatsOnProductionNumber() : text.ToCleanProductionNumber();

            ClipboardUtil.TrySetText(text);
        }