SetText() public static method

For Windows XAML Phone Applications use a separate app to push items to the Clipboard
public static SetText ( string text ) : void
text string
return void
Exemplo n.º 1
0
        //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 { }
            }
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
 public void CopyUrl()
 {
     if (Link != null)
     {
         Clipboard.SetText(Link.ToString());
     }
 }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        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());
        }
Exemplo n.º 6
0
        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);
            }
        }
Exemplo n.º 7
0
        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.");
        }
Exemplo n.º 8
0
        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);
            }
        }
Exemplo n.º 9
0
        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");
        }
Exemplo n.º 10
0
        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);
            }
        }
Exemplo n.º 11
0
        //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));
            }
        }
Exemplo n.º 12
0
        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);
                }
            });
        }
Exemplo n.º 13
0
 private void PnlContentKeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Return)
     {
         Clipboard.SetText(pnlContent.SelectedItem.ToString());
         Hide();
     }
 }
Exemplo n.º 14
0
 private void StackPanel_MouseUp(object sender, MouseButtonEventArgs e)
 {
     if (e.ClickCount == 1)
     {
         Clipboard.SetText(pnlContent.SelectedItem.ToString());
         Hide();
     }
 }
Exemplo n.º 15
0
 public void CopyCurrentTime()
 {
     Clipboard.SetText(MediaPlayer.Time.ToString());
     NotifyOfPropertyChange(() => CanPasteFilmEndTime);
     NotifyOfPropertyChange(() => CanPasteEndTime);
     NotifyOfPropertyChange(() => CanPasteStartTime);
     NotifyOfPropertyChange(() => CanAddFirstJumper);
 }
Exemplo n.º 16
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);
        }
Exemplo n.º 17
0
        void CopyFilenameToClipboard(object sender, RoutedEventArgs e)
        {
            if (!tabControlManager.CanExcectute())
            {
                return;
            }

            Clipboard.SetText($"\"{Path.GetFileName(tabControlManager.CurrentTab.Path)}\"");
        }
Exemplo n.º 18
0
        void CopyPathToClipboard(object sender, RoutedEventArgs e)
        {
            if (!tabControlManager.CanExcectute())
            {
                return;
            }

            Clipboard.SetText($"\"{tabControlManager.CurrentTab.Path}\"");
        }
Exemplo n.º 19
0
 private void UxGpuLog_OnMouseRightButtonDown(object sender, MouseButtonEventArgs e)
 {
     try {
         Clipboard.SetText(uxGpuLog.Text);
         MessageBox.Show(this, "Copied to Clipboard");
     }
     catch {
     }
 }
Exemplo n.º 20
0
        private void MainWindow_OnActivated(object sender, EventArgs e)
        {
            var text = Clipboard.GetText();

            if (text.StartsWith(LSUriScheme.FullName))
            {
                Clipboard.SetText("");
                LSUriScheme.HandleUrl(text, this);
            }
        }
Exemplo n.º 21
0
 private void OnCopy()
 {
     try
     {
         Clipboard.SetText(MessageText);
     }
     catch (System.Exception)
     {
     }
 }
Exemplo n.º 22
0
 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");
 }
Exemplo n.º 23
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);
 }
Exemplo n.º 24
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;
 }
Exemplo n.º 25
0
        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());
        }
Exemplo n.º 26
0
 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);
        }
Exemplo n.º 28
0
        private void PasteClipboardEntry([CanBeNull] ClipboardEntry item)
        {
            if (item == null)
            {
                return;
            }

            TextChosen?.Invoke(this, new TextChosenEventArgs(null));
            Clipboard.SetText(item.Value);
            _inputter.PasteFromClipboard().Forget();
        }
Exemplo n.º 29
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);
        }
Exemplo n.º 30
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;
            }
        }