public static void SetText(string text) { DataObject dataObject = new DataObject(); dataObject.SetText(text); WPFClipboard.SetDataObject(dataObject, false); }
private void StackPanel_MouseUp(object sender, MouseButtonEventArgs e) { if (e.ClickCount == 1) { Clipboard.SetText(pnlContent.SelectedItem.ToString()); Hide(); } }
public void CopyCurrentTime() { Clipboard.SetText(MediaPlayer.Time.ToString()); NotifyOfPropertyChange(() => CanPasteFilmEndTime); NotifyOfPropertyChange(() => CanPasteEndTime); NotifyOfPropertyChange(() => CanPasteStartTime); NotifyOfPropertyChange(() => CanAddFirstJumper); }
private void PnlContentKeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Return) { Clipboard.SetText(pnlContent.SelectedItem.ToString()); Hide(); } }
private void UxGpuLog_OnMouseRightButtonDown(object sender, MouseButtonEventArgs e) { try { Clipboard.SetText(uxGpuLog.Text); MessageBox.Show(this, "Copied to Clipboard"); } catch { } }
void CopyPathToClipboard(object sender, RoutedEventArgs e) { if (!tabControlManager.CanExcectute()) { return; } Clipboard.SetText($"\"{tabControlManager.CurrentTab.Path}\""); }
void CopyFilenameToClipboard(object sender, RoutedEventArgs e) { if (!tabControlManager.CanExcectute()) { return; } Clipboard.SetText($"\"{Path.GetFileName(tabControlManager.CurrentTab.Path)}\""); }
//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); }
public void SetClipboardText(string s) { if (!CheckAccess()) { //[WXP] Replaced Lambda to new Func/Action Dispatcher.Invoke(new Action(() => SetClipboardText(s))); return; } Clipboard.SetText(s); }
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); }
private void PopulateFile() { Clipboard.Clear(); Clipboard.SetText(replayPath); Thread.Sleep(500); SendKeys.SendWait("^v"); Thread.Sleep(150); SendKeys.SendWait("{ENTER}"); Clipboard.Clear(); }
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; }
private void MainWindow_OnActivated(object sender, EventArgs e) { var text = Clipboard.GetText(); if (text.StartsWith(LSUriScheme.FullName)) { Clipboard.SetText(""); LSUriScheme.HandleUrl(text, this); } }
private void OnCopy() { try { Clipboard.SetText(MessageText); } catch (System.Exception) { } }
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"); }
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); }
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()); }
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))); }
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); }
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); }
/// <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); }
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; } }
private void PasteClipboardEntry([CanBeNull] ClipboardEntry item) { if (item == null) { return; } TextChosen?.Invoke(this, new TextChosenEventArgs(null)); Clipboard.SetText(item.Value); _inputter.PasteFromClipboard().Forget(); }
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)); }
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); }
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"); }
public void PasteBlockStyle(IItemFilterBlockViewModel targetBlockViewModel) { var clipboardText = Clipboard.GetText(); if (string.IsNullOrEmpty(clipboardText)) { return; } _blockTranslator.ReplaceColorBlockItemsFromString(targetBlockViewModel.Block.BlockItems, clipboardText); targetBlockViewModel.RefreshBlockPreview(); }
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)); }
private void txtInsPath_MouseDown(object sender, MouseButtonEventArgs e) { try { Clipboard.SetText(txtInsPath.Text); MessageBox.Show(LangManager.GetLangFromResource("ForgeCopySuccess")); } catch { MessageBox.Show(LangManager.GetLangFromResource("ForgeCopyError")); } }
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); }