Beispiel #1
0
        public FormMain(
            Services.Settings settings,
            VgcApis.Models.IServices.IServersService vgcServers)
        {
            this.settings   = settings;
            this.vgcServers = vgcServers;
            InitializeComponent();

            this.FormClosing += (s, a) => formMainCtrl?.Cleanup();
            VgcApis.Libs.UI.AutoSetFormIcon(this);
            formMainCtrl = InitFormMainCtrl();
        }
Beispiel #2
0
        private void FormMain_Load(object sender, EventArgs e)
        {
            slinkMgr = Services.ShareLinkMgr.Instance;
            setting  = Services.Settings.Instance;

            setting.RestoreFormRect(this);

            formMainCtrl = InitFormMainCtrl();
            BindToolStripButtonToMenuItem();

            setting.OnPortableModeChanged += UpdateFormTitle;
            UpdateFormTitle(this, EventArgs.Empty);
        }
Beispiel #3
0
        Controllers.FormMainCtrl InitFormMainCtrl()
        {
            var ctrl = new Controllers.FormMainCtrl(
                settings,

                lvStatsTable,

                resetToolStripMenuItem,
                resizeByTitleToolStripMenuItem,
                resizeByContentToolStripMenuItem);

            return(ctrl);
        }
Beispiel #4
0
        public FormMain(
            Services.Settings settings,
            VgcApis.Interfaces.Services.IServersService vgcServers)
        {
            this.settings   = settings;
            this.vgcServers = vgcServers;
            InitializeComponent();

            VgcApis.Misc.UI.DoubleBuffered(lvStatsTable, true);

            this.FormClosing += (s, a) => formMainCtrl?.Cleanup();
            VgcApis.Misc.UI.AutoSetFormIcon(this);
            formMainCtrl = InitFormMainCtrl();
        }
Beispiel #5
0
        private void FormMain_Load(object sender, EventArgs e)
        {
            UpdateFormTitle(this, EventArgs.Empty);
            setting.RestoreFormRect(this);

            // https://alexpkent.wordpress.com/2011/05/11/25/
            // 添加新控件的时候会有bug,不显示新控件
            // ToolStripManager.LoadSettings(this);

            this.FormClosing += (s, a) =>
            {
                if (updateTitleTimer != null)
                {
                    updateTitleTimer.Stop();
                    updateTitleTimer.Tick -= UpdateFormTitle;
                    updateTitleTimer.Dispose();
                }
            };

            this.FormClosed += (s, a) =>
            {
                setting.SaveFormRect(this);
                // ToolStripManager.SaveSettings(this);
                formMainCtrl.Cleanup();
                setting.LazyGC();
            };

            formMainCtrl = InitFormMainCtrl();
            BindToolStripButtonToMenuItem();

            updateTitleTimer = new Timer
            {
                Interval = 2000,
            };
            updateTitleTimer.Tick += UpdateFormTitle;
            updateTitleTimer.Start();
        }
Beispiel #6
0
        private Controllers.FormMainCtrl InitFormMainCtrl()
        {
            var ctrl = new Controllers.FormMainCtrl();

            ctrl.Plug(new Controllers.FormMainComponent.FlyServer(
                          this,
                          flyServerListContainer,
                          toolStripLabelMarkFilter,
                          toolStripComboBoxMarkFilter,
                          toolStripStatusLabelTotal,
                          toolStripDropDownButtonPager,
                          toolStripStatusLabelPrePage,
                          toolStripStatusLabelNextPage,
                          toolStripMenuItemResize));

            ctrl.Plug(new Controllers.FormMainComponent.MenuItemsBasic(
                          this,
                          pluginToolStripMenuItem,

                          toolMenuItemSimAddVmessServer,
                          toolMenuItemImportLinkFromClipboard,
                          toolMenuItemExportAllServerToFile,
                          toolMenuItemImportFromFile,
                          toolMenuItemAbout,
                          toolMenuItemHelp,
                          toolMenuItemConfigEditor,
                          toolMenuItemQRCode,
                          toolMenuItemLog,
                          toolMenuItemOptions,
                          toolStripMenuItemDownLoadV2rayCore,
                          toolStripMenuItemRemoveV2rayCore,
                          toolMenuItemCheckUpdate));

            ctrl.Plug(new Controllers.FormMainComponent.MenuItemsSelect(

                          /*
                           * ToolStripMenuItem selectAllCurPage,
                           * ToolStripMenuItem invertSelectionCurPage,
                           * ToolStripMenuItem selectNoneCurPage,
                           */
                          selectAllCurPageToolStripMenuItem,
                          invertSelectionCurPageToolStripMenuItem,
                          selectNoneCurPageToolStripMenuItem1,

                          /*
                           * ToolStripMenuItem selectAllAllPages,
                           * ToolStripMenuItem invertSelectionAllPages,
                           * ToolStripMenuItem selectNoneAllPages,
                           */
                          selectAllAllPagesToolStripMenuItem,
                          invertSelectionAllPagesToolStripMenuItem,
                          selectNoneAllPagesToolStripMenuItem,

                          /*
                           * ToolStripMenuItem selectAutorunAllPages,
                           * ToolStripMenuItem selectNoMarkAllPages,
                           * ToolStripMenuItem selectNoSpeedTestAllPages,
                           * ToolStripMenuItem selectRunningAllPages,
                           * ToolStripMenuItem selectTimeoutAllPages,
                           * ToolStripMenuItem selectUntrackAllPages,
                           */
                          selectAutorunAllPagesToolStripMenuItem,
                          selectNoMarkAllPagesToolStripMenuItem,
                          selectNoSpeedTestAllPagesToolStripMenuItem,
                          selectRunningAllPagesToolStripMenuItem,
                          selectTimeoutAllPagesToolStripMenuItem,
                          selectUntrackAllPagesToolStripMenuItem,

                          /*
                           * ToolStripMenuItem selectAllAllServers,
                           * ToolStripMenuItem invertSelectionAllServers,
                           * ToolStripMenuItem selectNoneAllServers,
                           */
                          selectAllAllServersToolStripMenuItem,
                          invertSelectionAllServersToolStripMenuItem,
                          selectNoneAllServersToolStripMenuItem,

                          /*
                           * ToolStripMenuItem selectAutorunAllServers,
                           * ToolStripMenuItem selectNoMarkAllServers,
                           * ToolStripMenuItem selectNoSpeedTestAllServers,
                           * ToolStripMenuItem selectRunningAllServers,
                           * ToolStripMenuItem selectTimeoutAllServers,
                           * ToolStripMenuItem selectUntrackAllServers,
                           */
                          selectAutorunAllServersToolStripMenuItem,
                          selectNoMarkAllServersToolStripMenuItem,
                          selectNoSpeedTestAllServersToolStripMenuItem,
                          selectRunningAllServersToolStripMenuItem,
                          selectTimeoutAllServersToolStripMenuItem,
                          selectUntrackAllServersToolStripMenuItem));

            ctrl.Plug(new Controllers.FormMainComponent.MenuItemsServer(
                          //// misc
                          //ToolStripMenuItem refreshSummary,
                          //ToolStripMenuItem deleteAllServers,
                          //ToolStripMenuItem deleteSelected,
                          refreshSummaryToolStripMenuItem,
                          deleteAllServersToolStripMenuItem,
                          deleteSelectedServersToolStripMenuItem,

                          //// copy
                          //ToolStripMenuItem copyAsV2cfgLinks,
                          //ToolStripMenuItem copyAsVmessLinks,
                          //ToolStripMenuItem copyAsSubscriptions,
                          toolStripMenuItemCopyAsV2cfgLink,
                          toolStripMenuItemCopyAsVmessLink,
                          toolStripMenuItemCopyAsVeeLink,
                          toolStripMenuItemCopyAsVmessSubscription,
                          toolStripMenuItemCopyAsVeeSubscription,

                          //// batch op
                          toolStripMenuItemStopBatchSpeedTest,
                          toolStripMenuItemRunBatchSpeedTest,
                          toolStripMenuItemModifySettings,
                          toolStripMenuItemStopSelected,
                          toolStripMenuItemRestartSelected,

                          //// view
                          //ToolStripMenuItem moveToTop,
                          //ToolStripMenuItem moveToBottom,
                          //ToolStripMenuItem sortBySpeed,
                          //ToolStripMenuItem sortBySummary)
                          toolStripMenuItemMoveToTop,
                          toolStripMenuItemMoveToBottom,
                          toolStripMenuItemSortBySpeedTest,
                          toolStripMenuItemSortByDateT,
                          toolStripMenuItemSortBySummary));

            return(ctrl);
        }
Beispiel #7
0
 private void FormMain_Shown(object sender, EventArgs e)
 {
     formMainCtrl = InitFormMainCtrl();
     formMainCtrl.Run();
 }