Example #1
0
        public Import(
            FlowLayoutPanel flyPanel,
            Button btnAdd)
        {
            this.setting = Service.Setting.Instance;

            this.flyPanel = flyPanel;
            this.btnAdd   = btnAdd;

            InitPanel();
            BindEvent();
        }
Example #2
0
        public TabPlugin(FlowLayoutPanel flyPanel)
        {
            setting    = Service.Setting.Instance;
            pluginServ = Service.PluginsServer.Instance;

            this.flyPanel = flyPanel;

            curPluginInfos = pluginServ.GetterAllPluginsInfo();
            setting.SavePluginInfoItems(curPluginInfos);
            MarkdownCurOption();

            InitPanel();
        }
Example #3
0
        public void Run(
            Service.Cache cache,
            Service.Setting setting,
            Service.Servers servers)
        {
            this.cache   = cache;
            this.servers = servers;
            this.setting = setting;

            server        = new Service.Core(setting);
            server.OnLog += OnLogHandler;
            server.OnCoreStatusChanged += OnCoreStateChangedHandler;
        }
Example #4
0
 public Configer(
     Service.Setting setting,
     Service.Cache cache,
     Service.ConfigMgr configMgr,
     Service.Servers servers,
     VgcApis.Models.Datas.CoreInfo coreInfo)
 {
     this.configMgr = configMgr;
     this.setting   = setting;
     this.cache     = cache;
     this.servers   = servers;
     this.coreInfo  = coreInfo;
 }
Example #5
0
        FormMain()
        {
            setting = Service.Setting.Instance;
            servers = Service.Servers.Instance;

            InitializeComponent();

#if DEBUG
            this.Icon = Properties.Resources.icon_light;
#endif

            this.Show();
        }
Example #6
0
        FormMain()
        {
            setting = Service.Setting.Instance;
            servers = Service.Servers.Instance;

            InitializeComponent();

#if DEBUG
            this.Icon = Properties.Resources.icon_light;
#endif
            Lib.UI.AutoScaleToolSripControls(this, 16);
            this.Show();
        }
Example #7
0
        FormQRCode()
        {
            setting   = Service.Setting.Instance;
            servIndex = 0;
            linkType  = 0;

            InitializeComponent();

#if DEBUG
            this.Icon = Properties.Resources.icon_light;
#endif
            this.Show();
        }
Example #8
0
        public MenuItemsServer(
            // for invoke ui refresh
            MenuStrip menuContainer,

            // system proxy
            ToolStripMenuItem curSysProxySummary,
            ToolStripMenuItem copyCurPacUrl,
            ToolStripMenuItem visitCurPacDebuggerUrl,
            ToolStripMenuItem clearSysProxy,
            ToolStripMenuItem restartPACServer,
            ToolStripMenuItem stopPACServer,

            // misc
            ToolStripMenuItem refreshSummary,
            ToolStripMenuItem deleteAllServers,
            ToolStripMenuItem deleteSelected,

            // copy
            ToolStripMenuItem copyAsV2rayLinks,
            ToolStripMenuItem copyAsVmessLinks,
            ToolStripMenuItem copyAsSubscriptions,

            // batch op
            ToolStripMenuItem speedTestOnSelected,
            ToolStripMenuItem modifySelected,
            ToolStripMenuItem packSelected,
            ToolStripMenuItem stopSelected,
            ToolStripMenuItem restartSelected,

            // view
            ToolStripMenuItem moveToTop,
            ToolStripMenuItem moveToBottom,
            ToolStripMenuItem foldPanel,
            ToolStripMenuItem expansePanel,
            ToolStripMenuItem sortBySpeed,
            ToolStripMenuItem sortBySummary)
        {
            cache     = Service.Cache.Instance;
            servers   = Service.Servers.Instance;
            setting   = Service.Setting.Instance;
            pacServer = Service.PacServer.Instance;

            this.menuContainer = menuContainer; // for invoke ui update

            InitCtrlSorting(sortBySpeed, sortBySummary);
            InitCtrlView(moveToTop, moveToBottom, foldPanel, expansePanel);
            InitCtrlCopyToClipboard(copyAsV2rayLinks, copyAsVmessLinks, copyAsSubscriptions);
            InitCtrlMisc(refreshSummary, deleteSelected, deleteAllServers);
            InitCtrlBatchOperation(stopSelected, restartSelected, speedTestOnSelected, modifySelected, packSelected);
            InitCtrlSysProxy(curSysProxySummary, copyCurPacUrl, visitCurPacDebuggerUrl, clearSysProxy, restartPACServer, stopPACServer);
        }
Example #9
0
        public Subscription(
            FlowLayoutPanel flyPanel,
            Button btnAdd,
            Button btnUpdate)
        {
            this.setting = Service.Setting.Instance;

            this.flyPanel  = flyPanel;
            this.btnAdd    = btnAdd;
            this.btnUpdate = btnUpdate;

            InitPanel();
            BindEvent();
        }
Example #10
0
        public FormConfiger()
        {
            InitializeComponent();

            // I18N = Lib.Utils.I18N;
            // resData = Lib.Utils.resData;

            settings = Service.Setting.Instance;

            InitScintilla();
            InitForm();

            this.Show();
        }
Example #11
0
        FormLog()
        {
            setting        = Service.Setting.Instance;
            maxNumberLines = setting.maxLogLines;

            InitializeComponent();

            this.FormClosed += (s, e) => setting.OnLog -= LogReceiver;

            Lib.UI.SetFormLocation <FormLog>(this, Model.Data.Enum.FormLocations.BottomLeft);

            this.Show();
            setting.OnLog += LogReceiver;
        }
Example #12
0
        public Import(
            Panel container,
            CheckBox globalImport,
            Button expand,
            Button clearCache,
            Button copy)
        {
            this.setting = Service.Setting.Instance;

            this.editor           = Lib.UI.CreateScintilla(container, true);
            this.cboxGlobalImport = globalImport;
            DataBinding();
            AttachEvent(expand, clearCache, copy);
        }
Example #13
0
        public MenuItems(
            ToolStripMenuItem simVmessServer,
            ToolStripMenuItem importLinkFromClipboard,
            ToolStripMenuItem exportAllServer,
            ToolStripMenuItem importFromFile,
            ToolStripMenuItem checkUpdate,
            ToolStripMenuItem toolMenuItemAbout,
            ToolStripMenuItem toolMenuItemHelp,
            ToolStripMenuItem configEditor,
            ToolStripMenuItem QRCode,
            ToolStripMenuItem log,
            ToolStripMenuItem options,
            ToolStripMenuItem downloadV2rayCore,
            ToolStripMenuItem removeV2rayCore)
        {
            setting = Service.Setting.Instance;

            downloadV2rayCore.Click += (s, a) => Views.FormDownloadCore.GetForm();

            removeV2rayCore.Click += (s, a) => RemoveV2RayCore();

            simVmessServer.Click +=
                (s, a) => Views.FormSimAddVmessClient.GetForm();

            importLinkFromClipboard.Click += (s, a) =>
            {
                string links = Lib.Utils.GetClipboardText();
                setting.ImportLinks(links);
            };

            exportAllServer.Click += (s, a) => ExportAllServersToTextFile();

            importFromFile.Click += (s, a) => ImportServersFromTextFile();

            checkUpdate.Click += (s, a) => CheckVGCUpdate();

            toolMenuItemAbout.Click += (s, a) =>
                                       Lib.UI.VisitUrl(I18N("VistPorjectPage"), Properties.Resources.ProjectLink);

            toolMenuItemHelp.Click += (s, a) =>
                                      Lib.UI.VisitUrl(I18N("VistWikiPage"), Properties.Resources.WikiLink);

            configEditor.Click += (s, a) => new Views.FormConfiger();

            QRCode.Click += (s, a) => Views.FormQRCode.GetForm();

            log.Click += (s, a) => Views.FormLog.GetForm();

            options.Click += (s, a) => Views.FormOption.GetForm();
        }
Example #14
0
        public FormConfiger(string originalConfigString = null)
        {
            setting = Service.Setting.Instance;
            servers = Service.Servers.Instance;

            isShowPanel = setting.isShowConfigerToolsPanel;
            formSearch  = null;
            InitializeComponent();
            formTitle = this.Text;
            this.originalConfigString = originalConfigString;

            VgcApis.Libs.UI.AutoSetFormIcon(this);
            this.Show();
        }
Example #15
0
        public FormConfiger(string originalConfigString = null)
        {
            setting    = Service.Setting.Instance;
            formSearch = null;
            InitializeComponent();
            formTitle = this.Text;
            this.originalConfigString = originalConfigString;

#if DEBUG
            this.Icon = Properties.Resources.icon_light;
#endif

            this.Show();
        }
Example #16
0
        FormSimAddVmessClient()
        {
            InitializeComponent();
            Fill(cboxKCP, Model.Data.Table.kcpTypes);
            setting = Service.Setting.Instance;

#if DEBUG
            this.Icon = Properties.Resources.icon_light;
#endif
            this.Show();

            this.FormClosed += (s, a) =>
            {
                setting.LazyGC();
            };
        }
        FormSimAddVmessClient()
        {
            InitializeComponent();
            Fill(cboxKCP, Model.Data.Table.kcpTypes);

            servers = Service.Servers.Instance;
            setting = Service.Setting.Instance;

            VgcApis.Libs.UI.AutoSetFormIcon(this);
            this.Show();

            this.FormClosed += (s, a) =>
            {
                setting.LazyGC();
            };
        }
Example #18
0
        public Import(
            Panel container,
            CheckBox globalImport,
            Button btnExpand,
            Button btnClearCache,
            Button btnCopy,
            Button btnSaveAs)
        {
            this.setting   = Service.Setting.Instance;
            this.configMgr = Service.ConfigMgr.Instance;

            this.editor           = Lib.UI.CreateScintilla(container, true);
            this.cboxGlobalImport = globalImport;
            DataBinding();
            AttachEvent(btnExpand, btnClearCache, btnCopy, btnSaveAs);
        }
Example #19
0
        public TabPlugin(
            FlowLayoutPanel flyPanel,
            Button btnUpdate)
        {
            setting    = Service.Setting.Instance;
            pluginServ = Service.PluginsServer.Instance;

            this.flyPanel  = flyPanel;
            this.btnUpdate = btnUpdate;

            curPluginInfos = setting.GetPluginInfoItems();
            MarkdownCurOption();

            InitPanel();
            BindEvent();
        }
Example #20
0
        FormDownloadCore()
        {
            InitializeComponent();
            InitUI();
            setting = Service.Setting.Instance;
            core    = Service.Core.Instance;

            this.FormClosed += (s, e) =>
            {
                if (downloader != null)
                {
                    downloader.Cancel();
                }
            };

            this.Show();
        }
Example #21
0
        public Subscription(
            FlowLayoutPanel flyPanel,
            Button btnAdd,
            Button btnUpdate,
            CheckBox chkSubsIsUseProxy)
        {
            this.setting = Service.Setting.Instance;
            this.servers = Service.Servers.Instance;

            this.flyPanel          = flyPanel;
            this.btnAdd            = btnAdd;
            this.btnUpdate         = btnUpdate;
            this.chkSubsIsUseProxy = chkSubsIsUseProxy;

            chkSubsIsUseProxy.Checked = setting.isUpdateUseProxy;
            InitPanel();
            BindEvent();
        }
Example #22
0
        FormDownloadCore()
        {
            setting = Service.Setting.Instance;
            servers = Service.Servers.Instance;

            InitializeComponent();
            InitUI();

            this.FormClosed += (s, e) =>
            {
                downloader?.Cleanup();
                setting.LazyGC();
            };

            VgcApis.Libs.UI.AutoSetFormIcon(this);

            this.Show();
        }
Example #23
0
        public FormLog()
        {
            core    = Service.Core.Instance;
            setting = Service.Setting.Instance;

            maxNumberLines = setting.maxLogLines;

            InitializeComponent();

            core.OnLog += LogReceiver;

            this.FormClosed += (s, e) =>
            {
                core.OnLog -= LogReceiver;
            };

            this.Show();
        }
Example #24
0
        public ServerUI(Controller.CoreServerCtrl serverItem)
        {
            setting = Service.Setting.Instance;
            servers = Service.Servers.Instance;

            this.serverItem = serverItem;
            InitializeComponent();

            this.foldingButtonIcons = new Bitmap[] {
                Properties.Resources.StepBackArrow_16x,
                Properties.Resources.StepOverArrow_16x,
            };

            this.formHeight = new int[] {
                this.Height,  // collapseLevel= 0
                this.cboxInbound.Top,
            };
        }
Example #25
0
        public Configer(int serverIndex = -1)
        {
            setting        = Service.Setting.Instance;
            ssServer       = new SSServer();
            ssClient       = new SSClient();
            streamSettings = new StreamSettings();
            vmessClient    = new VmessClient();
            vmessServer    = new VmessServer();
            editor         = new Editor();
            vgc            = new VGC();

            separator  = Model.Data.Table.sectionSeparator;
            sections   = Model.Data.Table.configSections;
            preSection = 0;

            LoadConfig(serverIndex);
            editor.content = config.ToString();
            UpdateData();
        }
Example #26
0
        public FormLog()
        {
            setting = Service.Setting.Instance;

            InitializeComponent();

            this.FormClosed += (s, e) =>
            {
                if (updateLogTimer != null)
                {
                    updateLogTimer.Stop();
                    updateLogTimer.Tick -= UpdateLog;
                    updateLogTimer.Dispose();
                }
            };

            Lib.UI.SetFormLocation <FormLog>(this, Model.Data.Enum.FormLocations.BottomLeft);
            VgcApis.Libs.UI.AutoSetFormIcon(this);
        }
Example #27
0
        FormDownloadCore()
        {
            setting = Service.Setting.Instance;

            InitializeComponent();
            InitUI();

            this.FormClosed += (s, e) =>
            {
                downloader?.Cleanup();
                setting.LazyGC();
            };

#if DEBUG
            this.Icon = Properties.Resources.icon_light;
#endif

            this.Show();
        }
Example #28
0
        public ServerUI(
            VgcApis.Models.Interfaces.ICoreServCtrl serverItem)
        {
            setting  = Service.Setting.Instance;
            servers  = Service.Servers.Instance;
            slinkMgr = Service.ShareLinkMgr.Instance;

            this.coreServCtrl = serverItem;
            InitializeComponent();

            this.foldingButtonIcons = new Bitmap[] {
                Properties.Resources.StepBackArrow_16x,
                Properties.Resources.StepOverArrow_16x,
            };

            this.formHeight = new int[] {
                this.Height,  // collapseLevel= 0
                this.cboxInbound.Top,
            };
        }
Example #29
0
        public TabSetting(
            ComboBox cboxLanguage,
            ComboBox cboxPageSize,
            CheckBox chkServAutoTrack,
            CheckBox chkPortableMode)
        {
            this.setting = Service.Setting.Instance;

            // Do not put these lines of code into InitElement.
            this.cboxLanguage     = cboxLanguage;
            this.cboxPageSize     = cboxPageSize;
            this.chkServAutoTrack = chkServAutoTrack;
            this.chkPortableMode  = chkPortableMode;

            InitElement(
                cboxLanguage,
                cboxPageSize,
                chkServAutoTrack,
                chkPortableMode);
        }
Example #30
0
        public EnvVar(
            ComboBox cboxImportAlias,
            TextBox tboxImportUrl,
            Button btnInsertImport,
            ComboBox cboxEnvName,
            TextBox tboxEnvValue,
            Button btnInsertEnv)
        {
            setting = Service.Setting.Instance;

            this.cboxEnvName     = cboxEnvName;
            this.cboxImportAlias = cboxImportAlias;
            this.tboxEnvValue    = tboxEnvValue;
            this.tboxImportUrl   = tboxImportUrl;
            this.btnInsertImport = btnInsertImport;
            this.btnInsertEnv    = btnInsertEnv;

            Init();
            BindEvent();
        }