コード例 #1
0
 private void ShowPopup(string text, string clipboardText = null)
 {
     if (clipboardText == null || clipboardText.Length < 1)
     {
         System.Windows.Forms.Clipboard.Clear();
         PassCopy popup = new PassCopy(text);
         popup.Show();
     }
     else
     {
         System.Windows.Forms.Clipboard.SetText(clipboardText);
         PassCopy popup = new PassCopy(text);
         popup.Show();
     }
 }
コード例 #2
0
 public void CopyOwnText(string text)
 {
     if (text.Length == 0)
     {
         Clipboard.Clear();
         SystemSounds.Beep.Play();
         PassCopy passcopy = new PassCopy();
         passcopy.Show();
     }
     else
     {
         Clipboard.SetText(text);
         PassCopy passCopy = new PassCopy(text);
         passCopy.Show();
     }
 }
コード例 #3
0
        public string GetCurrentLine(string text)
        {
            SetText(text);
            if (_lineNum == 0)
            {
                PassCopy popup = new PassCopy();
                popup.Show();
                System.Windows.Forms.Clipboard.Clear();
                SystemSounds.Beep.Play();
                return("Cannot copy the text");
            }

            if (txtLines.Length > _lineNum && txtLines[_lineNum - 1].Length > 0)
            {
                string   tempLine = txtLines[_lineNum - 1];
                PassCopy popup    = new PassCopy(tempLine);
                popup.Show();
                System.Windows.Forms.Clipboard.SetText(tempLine);
                return("The current line has been copied");
            }
            else if (txtLines[_lineNum - 1].Length == 0)
            {
                PassCopy popup = new PassCopy("Empty line");
                popup.Show();
                System.Windows.Forms.Clipboard.Clear();
                SystemSounds.Beep.Play();
                return("Empty line");
            }

            else
            {
                PassCopy popup = new PassCopy();
                popup.Show();
                System.Windows.Forms.Clipboard.Clear();
                SystemSounds.Beep.Play();
            }
            return("Cannot copy the text");
        }