Example #1
0
        private void listViewBlockRewardTransactionHistory_MouseClick(object sender, MouseEventArgs e)
        {
            try
            {
                ListViewItem item = listViewBlockRewardTransactionHistory.GetItemAt(5, e.Y);
                if (item == null)
                {
                    return;
                }
                for (int ix = item.SubItems.Count - 1; ix >= 0; --ix)
                {
                    if (item.SubItems[ix].Bounds.Contains(e.Location))
                    {
                        Clipboard.SetText(item.SubItems[ix].Text);
#if WINDOWS
                        new Thread(() =>
                                   ClassFormPhase.MessageBoxInterface(item.SubItems[ix].Text + " " + ClassTranslation.GetLanguageTextFromOrder("TRANSACTION_HISTORY_WALLET_COPY_TEXT"), string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Error))
                        .Start();
#else
                        LinuxClipboard.SetText(item.SubItems[ix].Text);
                        new Thread(delegate()
                        {
                            MethodInvoker invoker = () => MessageBox.Show(ClassFormPhase.WalletXiropht, item.SubItems[ix].Text + " " + ClassTranslation.GetLanguageTextFromOrder("TRANSACTION_HISTORY_WALLET_COPY_TEXT"));
                            BeginInvoke(invoker);
                        }).Start();
#endif
                        return;
                    }
                }
            }
            catch
            {
            }
        }
        private void ButtonCopyWalletInformation_Click(object sender, EventArgs e)
        {
#if WINDOWS
            Clipboard.SetText(labelYourPublicKey.Text + " " + Environment.NewLine +
                              labelYourPrivateKey.Text + " " + Environment.NewLine +
                              labelYourPinCode.Text);


            ClassFormPhase.MessageBoxInterface(
                ClassTranslation.GetLanguageTextFromOrder(
                    ClassTranslationEnumeration.createwalletsubmenubuttoncopywalletinformationcontenttext),
                ClassTranslation.GetLanguageTextFromOrder(
                    ClassTranslationEnumeration.createwalletsubmenubuttoncopywalletinformationtitletext), MessageBoxButtons.OK,
                MessageBoxIcon.Question);
#else
            LinuxClipboard.SetText(labelYourPublicKey.Text + " " + Environment.NewLine +
                                   labelYourPrivateKey.Text + " " + Environment.NewLine +
                                   labelYourPinCode.Text);


            MessageBox.Show(Program.WalletXiropht,
                            ClassTranslation.GetLanguageTextFromOrder(ClassTranslationEnumeration.createwalletsubmenubuttoncopywalletinformationcontenttext),
                            ClassTranslation.GetLanguageTextFromOrder(ClassTranslationEnumeration.createwalletsubmenubuttoncopywalletinformationtitletext), MessageBoxButtons.OK, MessageBoxIcon.Question);
#endif
        }
Example #3
0
 public static void SetText(string text)
 {
     if (OperatingSystem.IsWindows())
     {
         WindowsClipboard.SetText(text);
     }
     else if (OperatingSystem.IsLinux())
     {
         LinuxClipboard.SetText(text);
     }
     else if (OperatingSystem.IsMacOS())
     {
         OsxClipboard.SetText(text);
     }
 }
        private void listViewBlockExplorer_MouseClick(object sender, MouseEventArgs e)
        {
            try
            {
                var item = listViewBlockExplorer.GetItemAt(0, e.Y);

                var found = false;
                if (item == null)
                {
                    return;
                }
                for (var ix = item.SubItems.Count - 1; ix >= 0; --ix)
                {
                    if (item.SubItems[ix].Bounds.Contains(e.Location))
                    {
                        if (!found)
                        {
                            found = true;
                            Clipboard.SetText(item.SubItems[ix].Text);
#if WINDOWS
                            Task.Factory.StartNew(() =>
                                                  ClassFormPhase.MessageBoxInterface(
                                                      item.SubItems[ix].Text + " " +
                                                      ClassTranslation.GetLanguageTextFromOrder(
                                                          ClassTranslationEnumeration.transactionhistorywalletcopytext),
                                                      string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Information))
                            .ConfigureAwait(false);
#else
                            LinuxClipboard.SetText(item.SubItems[ix].Text);
                            Task.Factory.StartNew(() =>
                            {
                                MethodInvoker invoker =
                                    () => MessageBox.Show(Program.WalletXiropht, item.SubItems[ix].Text + " " + ClassTranslation.GetLanguageTextFromOrder(ClassTranslationEnumeration.transactionhistorywalletcopytext));
                                BeginInvoke(invoker);
                            }).ConfigureAwait(false);
#endif
                            return;
                        }
                    }
                }
            }
            catch
            {
            }
        }
Example #5
0
        private void ButtonCopyWalletInformation_Click(object sender, EventArgs e)
        {
#if WINDOWS
            Clipboard.SetText(labelYourPublicKey.Text + " " + Environment.NewLine +
                              labelYourPrivateKey.Text + " " + Environment.NewLine +
                              labelYourPinCode.Text);


            ClassFormPhase.MessageBoxInterface(
                ClassTranslation.GetLanguageTextFromOrder("CREATE_WALLET_SUBMENU_BUTTON_COPY_WALLET_INFORMATION_CONTENT_TEXT"),
                ClassTranslation.GetLanguageTextFromOrder("CREATE_WALLET_SUBMENU_BUTTON_COPY_WALLET_INFORMATION_TITLE_TEXT"), MessageBoxButtons.OK, MessageBoxIcon.Question);
#else
            LinuxClipboard.SetText(labelYourPublicKey.Text + " " + Environment.NewLine +
                                   labelYourPrivateKey.Text + " " + Environment.NewLine +
                                   labelYourPinCode.Text);


            MessageBox.Show(ClassFormPhase.WalletXiropht,
                            ClassTranslation.GetLanguageTextFromOrder("CREATE_WALLET_SUBMENU_BUTTON_COPY_WALLET_INFORMATION_CONTENT_TEXT"),
                            ClassTranslation.GetLanguageTextFromOrder("CREATE_WALLET_SUBMENU_BUTTON_COPY_WALLET_INFORMATION_TITLE_TEXT"), MessageBoxButtons.OK, MessageBoxIcon.Question);
#endif
        }
        /// <summary>
        ///     Add a context menu into richtextbox control.
        /// </summary>
        /// <param name="rtb"></param>
        public void AddContextMenu(RichTextBox rtb)
        {
            if (rtb.ContextMenuStrip == null)
            {
                var cms = new ContextMenuStrip
                {
                    ShowImageMargin = false
                };

                var tsmiUndo = new ToolStripMenuItem("Undo");
                tsmiUndo.Click += (sender, e) => rtb.Undo();
                cms.Items.Add(tsmiUndo);

                var tsmiRedo = new ToolStripMenuItem("Redo");
                tsmiRedo.Click += (sender, e) => rtb.Redo();
                cms.Items.Add(tsmiRedo);

                cms.Items.Add(new ToolStripSeparator());

                var tsmiCut = new ToolStripMenuItem("Cut");
                tsmiCut.Click += (sender, e) =>
                {
#if WINDOWS
                    rtb.Cut();
#endif
#if LINUX
                    LinuxClipboard.SetText(rtb.Text);
                    rtb.Clear();
#endif
                };
                cms.Items.Add(tsmiCut);

                var tsmiCopy = new ToolStripMenuItem("Copy");
                tsmiCopy.Click += (sender, e) =>
                {
#if WINDOWS
                    rtb.Copy();
#endif
#if LINUX
                    LinuxClipboard.SetText(rtb.Text);
#endif
                };
                cms.Items.Add(tsmiCopy);

                var tsmiDelete = new ToolStripMenuItem("Delete");
                tsmiDelete.Click += (sender, e) => rtb.SelectedText = "";
                cms.Items.Add(tsmiDelete);

                cms.Items.Add(new ToolStripSeparator());

                var tsmiSelectAll = new ToolStripMenuItem("Select All");
                tsmiSelectAll.Click += (sender, e) => rtb.SelectAll();
                cms.Items.Add(tsmiSelectAll);

                cms.Opening += (sender, e) =>
                {
                    tsmiUndo.Enabled      = !rtb.ReadOnly && rtb.CanUndo;
                    tsmiRedo.Enabled      = !rtb.ReadOnly && rtb.CanRedo;
                    tsmiCut.Enabled       = !rtb.ReadOnly && rtb.SelectionLength > 0;
                    tsmiCopy.Enabled      = rtb.SelectionLength > 0;
                    tsmiDelete.Enabled    = !rtb.ReadOnly && rtb.SelectionLength > 0;
                    tsmiSelectAll.Enabled = rtb.TextLength > 0 && rtb.SelectionLength < rtb.TextLength;
                };

                rtb.ContextMenuStrip = cms;
            }
        }