//Upload byte[] to imgur and give user a response private async Task UploadImageToImgur(byte[] cimg, string WindowName) { string link = await UploadImgur(cimg, WindowName); if (link.StartsWith("http://")) { Clipboard.SetText(link); PlayBlop(); //Catch internal toast exceptions & process start exception try { if (FileIO.OpenAfterUpload) { Process.Start(link); } await SuccessToast.ShowAsync(Properties.strings.linkclipboard, TimeSpan.FromSeconds(5)); } catch { } } else { //Catch internal toast exceptions try { await ErrorToast.ShowAsync(string.Format(Properties.strings.uploadingError, link), TimeSpan.FromSeconds(5)); } catch { } } }
private async void GetInvite(object sender = null, EventArgs e = null) { string link = "https://discordapp.com/oauth2/authorize?client_id=" + Settings.ClientID + @"&scope=bot"; Clipboard.SetText(link); await Console.Log("Copied link to clipboard: " + link); }
public void CopyUrl() { if (Link != null) { Clipboard.SetText(Link.ToString()); } }
private void OnCopyNativeWordsMenuItemClick(object sender, RoutedEventArgs e) { var words = WordsDataGrid.SelectedItems.OfType <WordInfo>(); var text = string.Join("\r\n", words.Select(x => x.NativeWord)); Clipboard.SetText(text); }
static void CopyToClipboard <T>(Dictionary <double, T[]> set, List <double> hValues) { StringBuilder result = new StringBuilder(); double[] columns = set.Keys.ToArray(); for (int h = 0; h < hValues.Count; ++h) { result.Append(hValues[h]).Append('\t'); for (int i = 0; i < columns.Length; ++i) { var next = set[columns[i]][h]; if (next != null) { if (i != columns.Length - 1) { result.Append(next.ToString()).Append('\t'); } else { result.AppendLine(next.ToString()); } } } } Clipboard.SetText(result.ToString()); }
private void MainWindow_OnActivated(object sender, EventArgs e) { if (FirstTimeActivated) { FirstTimeActivated = false; var allAssemblies = new List <LeagueSharpAssembly>(); foreach (var profile in Config.Instance.Profiles) { allAssemblies.AddRange(profile.InstalledAssemblies); } allAssemblies = allAssemblies.Distinct().ToList(); PrepareAssemblies(allAssemblies, Config.Instance.FirstRun || Config.Instance.UpdateOnLoad, true); } var text = Clipboard.GetText(); if (text.StartsWith(LSUriScheme.FullName)) { Clipboard.SetText(""); LSUriScheme.HandleUrl(text, this); } }
public void TextContaningTabIsPasedIntoAnIntellisenseTextBoxExpectedTabInsertedEventIsRaised() { bool eventRaised = false; IntellisenseTextBox sender = null; EventManager.RegisterClassHandler(typeof(IntellisenseTextBox), IntellisenseTextBox.TabInsertedEvent, new RoutedEventHandler((s, e) => { eventRaised = true; sender = s as IntellisenseTextBox; })); Clipboard.SetText("Cake\t"); IntellisenseTextBox textBox = new IntellisenseTextBox(); textBox.CreateVisualTree(); textBox.Paste(); Assert.IsTrue(eventRaised, "The 'IntellisenseTextBox.TabInsertedEvent' wasn't raised when text containing a tab was pasted into the IntellisenseTextBox."); Assert.AreEqual(textBox, sender, "The IntellisenseTextBox in which the text containg a tab was pasted was different from the one which raised teh event."); }
public void TextContaningNoTabIsPasedIntoAnIntellisenseTextBoxExpectedTabInsertedEventNotRaised() { var preserveClipboard = Clipboard.GetText(); try { bool eventRaised = false; EventManager.RegisterClassHandler(typeof(IntellisenseTextBox), IntellisenseTextBox.TabInsertedEvent, new RoutedEventHandler((s, e) => { eventRaised = true; })); Clipboard.SetText("Cake"); IntellisenseTextBox textBox = new IntellisenseTextBox(); textBox.CreateVisualTree(); textBox.Paste(); Assert.IsFalse(eventRaised, "The 'IntellisenseTextBox.TabInsertedEvent' was raised when text that didn't contain a tab was pasted into the IntellisenseTextBox."); } finally { Clipboard.SetText(preserveClipboard); } }
public void RemoteServerUITests_EditRemoteWebSource_WebSourceIsEdited() { const string TextToSearchWith = "Dev2GetCountriesWebService"; //Edit remote web source ExplorerUIMap.DoubleClickSource(TextToSearchWith, "WEB SRC", RemoteServerName); var actualLeftTitleText = WebSourceWizardUIMap.GetLeftTitleText(); var actualRightTitleText = WebSourceWizardUIMap.GetRightTitleText(); Assert.AreEqual("Edit - Dev2GetCountriesWebService", actualLeftTitleText); Assert.AreEqual(remoteConnectionString, actualRightTitleText); WebSourceWizardUIMap.EnterTextIntoWizardTextBox(3, "?extension=json&prefix=b"); WebSourceWizardUIMap.PressButtonOnWizard(3); SaveDialogUIMap.ClickSave(); //Change it back ExplorerUIMap.DoubleClickSource(TextToSearchWith, "WEB SRC", RemoteServerName); //Get textbox text var persistClipboard = Clipboard.GetText(); KeyboardCommands.SendTabs(3); WebSourceWizardUIMap.PressCtrlC(); WebSourceWizardUIMap.EnterTextIntoWizardTextBox(0, "?extension=json&prefix=a"); WebSourceWizardUIMap.PressButtonOnWizard(3); string query = Clipboard.GetText(); Clipboard.SetText(persistClipboard); SaveDialogUIMap.ClickSave(); Assert.AreEqual("?extension=json&prefix=b", query, "Cannot change remote web source"); }
private void btnCopy_Click(object sender, RoutedEventArgs e) { if (_edtXPath.SelectionLength > 0) { string text = _edtXPath.SelectedText; Clipboard.SetText(text); } else { DataObject dobj = new DataObject(); dobj.SetText(_edtXPath.Text); try { IHighlighter highlighter = new DocumentHighlighter( _edtXPath.Document, _edtXPath.SyntaxHighlighting.MainRuleSet); string html = HtmlClipboard.CreateHtmlFragment( _edtXPath.Document, highlighter, null, new HtmlOptions()); HtmlClipboard.SetHtml(dobj, html); } catch { //ignore } Clipboard.SetDataObject(dobj); } }
//Upload byte[] to imgur and give user a response private async Task HandleLink(string link) { //Link is http or https if (link.StartsWith("http")) { Clipboard.SetText(link); PlayBlop(); Action action = delegate { Process.Start(link); }; if (FileIO.OpenAfterUpload) { Process.Start(link); action = null; } Notification = new Notification(strings.linkclipboard, Notification.NotificationType.Success, true, action); await Notification.ShowAsync(); //await SuccessToast.ShowAsync(strings.linkclipboard, // TimeSpan.FromSeconds(3)); } else { Notification = new Notification(string.Format(strings.uploadingError, link), Notification.NotificationType.Error, true, ActionTroubleshoot); await Notification.ShowAsync(); //await ErrorToast.ShowAsync(string.Format(strings.uploadingError, link), // TimeSpan.FromSeconds(5)); } }
private void onCopyPasteReceived() { if (!m_isReceivingShortcuts) { return; } Application.Current.Dispatcher.InvokeAsync(() => { try { var cpContent = Clipboard.GetText(); var output = ProcessInput(cpContent); if (output == null) { return; } inputText.Text = cpContent; SetOutputText(output); var move = moveCheckbox.IsChecked ?? false; if (move) { var cursorPos = GetCursorPos(); Left = cursorPos.X - this.Width / 2; if (cursorPos.Y - this.Height / 2 < 0) { this.Top = 0; } else { Top = cursorPos.Y - this.Height / 2; } Activate(); } var toClipboard = this.toClipboard.IsChecked ?? false; if (toClipboard) { Clipboard.SetText(output); Mediator.Send(new ShowNotificationCommand { Message = "Pretty print successful!" }); } } catch (Exception e) { ShowErrorMessage(e.Message); } }); }
private void PnlContentKeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Return) { Clipboard.SetText(pnlContent.SelectedItem.ToString()); Hide(); } }
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); }
//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); }
void CopyFilenameToClipboard(object sender, RoutedEventArgs e) { if (!tabControlManager.CanExcectute()) { return; } Clipboard.SetText($"\"{Path.GetFileName(tabControlManager.CurrentTab.Path)}\""); }
void CopyPathToClipboard(object sender, RoutedEventArgs e) { if (!tabControlManager.CanExcectute()) { return; } Clipboard.SetText($"\"{tabControlManager.CurrentTab.Path}\""); }
private void UxGpuLog_OnMouseRightButtonDown(object sender, MouseButtonEventArgs e) { try { Clipboard.SetText(uxGpuLog.Text); MessageBox.Show(this, "Copied to Clipboard"); } catch { } }
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.SetText(Helper.DeckToIdString(deck.GetSelectedDeckVersion())); this.ShowMessage("", "copied ids to clipboard").Forget(); Log.Info("Copied " + deck.GetSelectedDeckVersion().GetDeckInfo() + " to clipboard"); }
public void SetClipboardText(string s) { if (!CheckAccess()) { //[WXP] Replaced Lambda to new Func/Action Dispatcher.Invoke(new Action(() => SetClipboardText(s))); return; } Clipboard.SetText(s); }
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 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()); }
private void PopulateFile() { Clipboard.Clear(); Clipboard.SetText(replayPath); Thread.Sleep(500); SendKeys.SendWait("^v"); Thread.Sleep(150); SendKeys.SendWait("{ENTER}"); Clipboard.Clear(); }
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 PasteClipboardEntry([CanBeNull] ClipboardEntry item) { if (item == null) { return; } TextChosen?.Invoke(this, new TextChosenEventArgs(null)); Clipboard.SetText(item.Value); _inputter.PasteFromClipboard().Forget(); }
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); }
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; } }