Provides methods to place data on and retrieve data from the system clipboard. This class cannot be inherited.
コード例 #1
0
ファイル: Clipboard.cs プロジェクト: zachS93/VsVim
        public static void SetText(string text)
        {
            DataObject dataObject = new DataObject();

            dataObject.SetText(text);

            WPFClipboard.SetDataObject(dataObject, false);
        }
コード例 #2
0
ファイル: MainWindow.xaml.cs プロジェクト: lkytal/ClipBase
 private void StackPanel_MouseUp(object sender, MouseButtonEventArgs e)
 {
     if (e.ClickCount == 1)
     {
         Clipboard.SetText(pnlContent.SelectedItem.ToString());
         Hide();
     }
 }
コード例 #3
0
 public void CopyCurrentTime()
 {
     Clipboard.SetText(MediaPlayer.Time.ToString());
     NotifyOfPropertyChange(() => CanPasteFilmEndTime);
     NotifyOfPropertyChange(() => CanPasteEndTime);
     NotifyOfPropertyChange(() => CanPasteStartTime);
     NotifyOfPropertyChange(() => CanAddFirstJumper);
 }
コード例 #4
0
ファイル: MainWindow.xaml.cs プロジェクト: lkytal/ClipBase
 private void PnlContentKeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Return)
     {
         Clipboard.SetText(pnlContent.SelectedItem.ToString());
         Hide();
     }
 }
コード例 #5
0
 private void UxGpuLog_OnMouseRightButtonDown(object sender, MouseButtonEventArgs e)
 {
     try {
         Clipboard.SetText(uxGpuLog.Text);
         MessageBox.Show(this, "Copied to Clipboard");
     }
     catch {
     }
 }
コード例 #6
0
ファイル: MainWindow.xaml.cs プロジェクト: Stromberg90/Frame
        void CopyPathToClipboard(object sender, RoutedEventArgs e)
        {
            if (!tabControlManager.CanExcectute())
            {
                return;
            }

            Clipboard.SetText($"\"{tabControlManager.CurrentTab.Path}\"");
        }
コード例 #7
0
ファイル: MainWindow.xaml.cs プロジェクト: Stromberg90/Frame
        void CopyFilenameToClipboard(object sender, RoutedEventArgs e)
        {
            if (!tabControlManager.CanExcectute())
            {
                return;
            }

            Clipboard.SetText($"\"{Path.GetFileName(tabControlManager.CurrentTab.Path)}\"");
        }
コード例 #8
0
        //Upload Image to Imgur and returns URL to Imgur
        private async Task <string> UploadImgur(byte[] cimg, string WindowName)
        {
            string response = await _imgur.Upload(cimg, WindowName);

            //Copy Link to Clipboard
            Clipboard.SetText(response);

            return(response);
        }
コード例 #9
0
 public void SetClipboardText(string s)
 {
     if (!CheckAccess())
     {
         //[WXP] Replaced Lambda to new Func/Action
         Dispatcher.Invoke(new Action(() => SetClipboardText(s)));
         return;
     }
     Clipboard.SetText(s);
 }
コード例 #10
0
            protected override async Task ExecuteAsync(ClipboardImplementationViewModel parameter)
            {
                var dataObject = new DataObject();

                DataObjectExtensions.SetLinkedWClipboardId(dataObject, parameter.Model.ClipboardObject.Id);

                await parameter.Model.Factory.WriteToDataObject(parameter.Model, dataObject);

                SysClipboard.SetDataObject(dataObject, false);
            }
コード例 #11
0
 private void PopulateFile()
 {
     Clipboard.Clear();
     Clipboard.SetText(replayPath);
     Thread.Sleep(500);
     SendKeys.SendWait("^v");
     Thread.Sleep(150);
     SendKeys.SendWait("{ENTER}");
     Clipboard.Clear();
 }
コード例 #12
0
 public LayoutBase()
 {
     CopyNameClipboardCommand    = new RelayCommand <object>(delegate { Clipboard.SetText(ServiceProvider.Settings.SelectedBitmap.FileItem.FileName); });
     OpenExplorerCommand         = new RelayCommand <object>(OpenInExplorer);
     OpenViewerCommand           = new RelayCommand <object>(OpenViewer);
     DeleteItemCommand           = new RelayCommand <object>(DeleteItem);
     ImageDoubleClickCommand     = new RelayCommand <object>(delegate { ServiceProvider.WindowsManager.ExecuteCommand(WindowsCmdConsts.FullScreenWnd_Show); });
     _worker.DoWork             += worker_DoWork;
     _worker.RunWorkerCompleted += _worker_RunWorkerCompleted;
 }
コード例 #13
0
        private void MainWindow_OnActivated(object sender, EventArgs e)
        {
            var text = Clipboard.GetText();

            if (text.StartsWith(LSUriScheme.FullName))
            {
                Clipboard.SetText("");
                LSUriScheme.HandleUrl(text, this);
            }
        }
コード例 #14
0
ファイル: MessageControlVM.cs プロジェクト: poorTiK/Message
 private void OnCopy()
 {
     try
     {
         Clipboard.SetText(MessageText);
     }
     catch (System.Exception)
     {
     }
 }
コード例 #15
0
 internal void ExportIdsToClipboard(Deck deck)
 {
     if (deck == null)
     {
         return;
     }
     Clipboard.SetDataObject(Helper.DeckToIdString(deck.GetSelectedDeckVersion()));
     this.ShowMessage("", "copied ids to clipboard").Forget();
     Log.Info("Copied " + deck.GetSelectedDeckVersion().GetDeckInfo() + " to clipboard");
 }
コード例 #16
0
        private void HandleCopyToClipBoard()
        {
            var builder = new StringBuilder();

            builder.AppendFormat("Exception information.{0}", Environment.NewLine);
            builder.AppendFormat("============================================================={0}", Environment.NewLine);
            ExceptionToString(builder, _toView);
            Clipboard.SetText(builder.ToString());
            MessageBox.Show(this, "Exception details copied to clipboard", "Copy succeeded", MessageBoxButton.OK, MessageBoxImage.Information);
        }
コード例 #17
0
ファイル: frmError.xaml.cs プロジェクト: gilvbp/WinToolkit_v2
        private void BtnClipboard_OnClick(object sender, RoutedEventArgs e)
        {
            Clipboard.Clear();
            StringBuilder builder = new StringBuilder();
            TextWriter    writer  = new StringWriter(builder);

            _exception.XML.Save(writer);

            Clipboard.SetText(builder.ToString());
        }
コード例 #18
0
        public void LayerToClipboard()
        {
            if (SelectedLayer == null || !ActiveWindowHelper.MainWindowActive || !IsActive)
            {
                return;
            }

            // Probably not how the cool kids do it but leveraging on JsonConvert gives flawless serialization
            GeneralHelpers.ExecuteSta(() => Clipboard.SetData("layer", JsonConvert.SerializeObject(SelectedLayer)));
        }
コード例 #19
0
        private void CopyFeaturesToClipboard(object sender, RoutedEventArgs e)
        {
            if (_current == null)
            {
                return;
            }
            var text = _features[Convert.ToInt32(_current.Content.ToString().Split('.')[0])].Aggregate("",
                                                                                                       (current, feature) => current + string.Format("{0}\r\n", feature));

            Clipboard.SetText(text);
        }
コード例 #20
0
        public static IEnumerable <string> ClipBoardStrs()
        {
            if (!Clipboard.ContainsText())
            {
                return(new string[0]);
            }
            string txt = Clipboard.GetText();

            string[] cells = txt.Split(new[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);
            return(cells);
        }
コード例 #21
0
ファイル: ElementTreeViewModel.cs プロジェクト: priyanr/Vixen
        /// <summary>
        /// Method to invoke when the Copy command is executed.
        /// </summary>
        private void Copy()
        {
            List <ElementModel> clipData = new List <ElementModel>();

            clipData.AddRange(SelectedItems.Select(x => x.ElementModel).ToList());

            IDataObject dataObject = new DataObject(ClipboardFormatName);

            dataObject.SetData(clipData);
            Clipboard.SetDataObject(dataObject, true);
        }
コード例 #22
0
        private void LstOutputOnKeyUp(object sender, KeyEventArgs keyEventArgs)
        {
            var key  = keyEventArgs.Key;
            var text = LstOutput.SelectedItem.ToString().Substring(21);

            if (key == Key.C && keyEventArgs.KeyboardDevice.Modifiers == ModifierKeys.Control)
            {
                Clipboard.SetText(text);
                TxtActivity.Text = text;
            }
        }
コード例 #23
0
        private void PasteClipboardEntry([CanBeNull] ClipboardEntry item)
        {
            if (item == null)
            {
                return;
            }

            TextChosen?.Invoke(this, new TextChosenEventArgs(null));
            Clipboard.SetText(item.Value);
            _inputter.PasteFromClipboard().Forget();
        }
コード例 #24
0
ファイル: Clipboard.cs プロジェクト: zachS93/VsVim
        public static string GetText()
        {
            IDataObject dataObj = WPFClipboard.GetDataObject();

            if (dataObj == null || !dataObj.GetDataPresent(typeof(string)))
            {
                return(null);
            }

            return((string)dataObj.GetData(DataFormats.UnicodeText)
                   ?? (string)dataObj.GetData(DataFormats.Text));
        }
コード例 #25
0
        private void Menu_copy_url_Click(object sender, RoutedEventArgs e)
        {
            List <int>    selectedIndexes = GetSelectedIndexes();
            StringBuilder stringBuilder   = new StringBuilder();

            foreach (int item in selectedIndexes)
            {
                stringBuilder.AppendLine(core.Channels[item].URL);
            }
            Clipboard.SetText(stringBuilder.ToString().Trim());
            MessageBox.Show("Links have been copied to clipboard.", "Copy Channels", MessageBoxButton.OK, MessageBoxImage.Asterisk);
        }
コード例 #26
0
        private void BtnClipboard_OnClick(object sender, RoutedEventArgs e)
        {
            var deck = DeckPickerList.SelectedDecks.FirstOrDefault();

            if (deck == null)
            {
                return;
            }
            Clipboard.SetText(Helper.DeckToIdString(deck.GetSelectedDeckVersion()));
            this.ShowMessage("", "copied ids to clipboard").Forget();
            Log.Info("Copied " + deck.GetSelectedDeckVersion().GetDeckInfo() + " to clipboard");
        }
コード例 #27
0
        public void PasteBlockStyle(IItemFilterBlockViewModel targetBlockViewModel)
        {
            var clipboardText = Clipboard.GetText();

            if (string.IsNullOrEmpty(clipboardText))
            {
                return;
            }

            _blockTranslator.ReplaceColorBlockItemsFromString(targetBlockViewModel.Block.BlockItems, clipboardText);
            targetBlockViewModel.RefreshBlockPreview();
        }
コード例 #28
0
        public void MatchPatternTest(string imageName, string patternName)
        {
            var engine      = new RegonizeEngine(_screenHelper);
            var sourceImage = new Image <Bgr, byte>(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $@"..\..\ImageTest\{imageName}"));
            var searchImg   = new Image <Bgr, byte>(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $@"..\..\ImageTest\{patternName}"));

            var result = engine.MatchPattern(sourceImage, searchImg);

            sourceImage.Draw(result, new Bgr(Color.Red), 2);

            Clipboard.SetImage(ConvertBitmap(sourceImage.Bitmap));
        }
コード例 #29
0
 private void txtInsPath_MouseDown(object sender, MouseButtonEventArgs e)
 {
     try
     {
         Clipboard.SetText(txtInsPath.Text);
         MessageBox.Show(LangManager.GetLangFromResource("ForgeCopySuccess"));
     }
     catch
     {
         MessageBox.Show(LangManager.GetLangFromResource("ForgeCopyError"));
     }
 }
コード例 #30
0
        private IntPtr WinProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
        {
            switch (msg)
            {
            case Win32.WmChangecbchain:
                if (wParam == hWndNextViewer)
                {
                    hWndNextViewer = lParam;     //clipboard viewer chain changed, need to fix it.
                }
                else if (hWndNextViewer != IntPtr.Zero)
                {
                    Win32.SendMessage(hWndNextViewer, msg, wParam, lParam);     //pass the message to the next viewer.
                }
                break;

            case Win32.WmDrawclipboard:
                Task.Run(async() =>
                {
                    await mainWindow.Dispatcher.InvokeAsync(async() =>
                    {
                        Win32.SendMessage(hWndNextViewer, msg, wParam, lParam);     //pass the message to the next viewer //clipboard content changed
                        if (Clipboard.ContainsText() && !string.IsNullOrEmpty(Clipboard.GetText().Trim()))
                        {
                            var currentText = Clipboard.GetText().RemoveSpecialCharacters().ToLowerInvariant();

                            if (!string.IsNullOrEmpty(currentText))
                            {
                                await Task.Run(async() =>
                                {
                                    if (cancellationTokenSource.Token.IsCancellationRequested)
                                    {
                                        return;
                                    }

                                    await WhenClipboardContainsTextEventHandler.InvokeSafelyAsync(this,
                                                                                                  new WhenClipboardContainsTextEventArgs {
                                        CurrentString = currentText
                                    }
                                                                                                  );

                                    await FlushCopyCommandAsync();
                                });
                            }
                        }
                    }, DispatcherPriority.Background);
                });

                break;
            }

            return(IntPtr.Zero);
        }