예제 #1
0
        public void ScanQrcode()
        {
            void Success(string link)
            {
                // no comment ^v^
                if (link == StrConst.Nobody3uVideoUrl)
                {
                    Lib.UI.VisitUrl(I18N.VisitWebPage, StrConst.Nobody3uVideoUrl);
                    return;
                }

                var msg = Lib.Utils.CutStr(link, 90);

                setting.SendLog($"QRCode: {msg}");
                slinkMgr.ImportLinkWithOutV2cfgLinks(link);
            }

            void Fail()
            {
                MessageBox.Show(I18N.NoQRCode);
            }

            Lib.QRCode.QRCode.ScanQRCode(Success, Fail);
        }
예제 #2
0
        ContextMenuStrip CreateMenu()
        {
            var menu = new ContextMenuStrip();

            var factor = Lib.UI.GetScreenScalingFactor();

            if (factor > 1)
            {
                menu.ImageScalingSize = new System.Drawing.Size(
                    (int)(menu.ImageScalingSize.Width * factor),
                    (int)(menu.ImageScalingSize.Height * factor));
            }

            menu.Items.AddRange(new ToolStripMenuItem[] {
                new ToolStripMenuItem(
                    I18N.MainWin,
                    Properties.Resources.WindowsForm_16x,
                    (s, a) => Views.WinForms.FormMain.ShowForm()),

                new ToolStripMenuItem(
                    I18N.OtherWin,
                    Properties.Resources.CPPWin32Project_16x,
                    new ToolStripMenuItem[] {
                    new ToolStripMenuItem(
                        I18N.ConfigEditor,
                        Properties.Resources.EditWindow_16x,
                        (s, a) => new Views.WinForms.FormConfiger()),
                    new ToolStripMenuItem(
                        I18N.GenQRCode,
                        Properties.Resources.AzureVirtualMachineExtension_16x,
                        (s, a) => Views.WinForms.FormQRCode.ShowForm()),
                    new ToolStripMenuItem(
                        I18N.Log,
                        Properties.Resources.FSInteractiveWindow_16x,
                        (s, a) => Views.WinForms.FormLog.ShowForm()),
                    new ToolStripMenuItem(
                        I18N.Options,
                        Properties.Resources.Settings_16x,
                        (s, a) => Views.WinForms.FormOption.ShowForm()),
                }),

                new ToolStripMenuItem(
                    I18N.ScanQRCode,
                    Properties.Resources.ExpandScope_16x,
                    (s, a) => {
                    void Success(string link)
                    {
                        // no comment ^v^
                        if (link == StrConst.Nobody3uVideoUrl)
                        {
                            Lib.UI.VisitUrl(I18N.VisitWebPage, StrConst.Nobody3uVideoUrl);
                            return;
                        }

                        var msg = Lib.Utils.CutStr(link, 90);
                        setting.SendLog($"QRCode: {msg}");
                        slinkMgr.ImportLinkWithOutV2cfgLinks(link);
                    }

                    void Fail()
                    {
                        MessageBox.Show(I18N.NoQRCode);
                    }

                    Lib.QRCode.QRCode.ScanQRCode(Success, Fail);
                }),

                new ToolStripMenuItem(
                    I18N.ImportLink,
                    Properties.Resources.CopyLongTextToClipboard_16x,
                    (s, a) => {
                    string links = Lib.Utils.GetClipboardText();
                    slinkMgr.ImportLinkWithOutV2cfgLinks(links);
                }),

                new ToolStripMenuItem(
                    I18N.DownloadV2rayCore,
                    Properties.Resources.ASX_TransferDownload_blue_16x,
                    (s, a) => Views.WinForms.FormDownloadCore.GetForm()),
            });