Ejemplo n.º 1
0
 public ShellViewModel(Services.Settings settings, IDialogManager dialogManager)
 {
     _settings = settings;
     _projectRepository = new ProjectRepositoryViewModel(settings);
     _dialogManager = dialogManager;
     DisplayName = "Solutionizer";
 }
Ejemplo n.º 2
0
        public TabPlugin(FlowLayoutPanel flyPanel)
        {
            setting    = Services.Settings.Instance;
            pluginServ = Services.PluginsServer.Instance;

            this.flyPanel = flyPanel;

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

            InitPanel();
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
0
        FormMain(
            Services.Settings settings,
            Services.LuaServer luaServer,
            Services.FormMgrSvc formMgr)
        {
            this.settings  = settings;
            this.luaServer = luaServer;
            this.formMgr   = formMgr;

            InitializeComponent();
            VgcApis.Misc.UI.AutoSetFormIcon(this);
            this.Text = string.Format(I18N.LunaScrMgr, Properties.Resources.Version);
        }
Ejemplo n.º 5
0
        public static FormMain CreateForm(
            Services.Settings settings,
            Services.LuaServer luaServer,
            Services.FormMgrSvc formMgr)
        {
            FormMain r = null;

            VgcApis.Misc.UI.Invoke(() =>
            {
                r = new FormMain(settings, luaServer, formMgr);
            });
            return(r);
        }
Ejemplo n.º 6
0
        FormConfiger(string originalConfigString)
        {
            setting = Services.Settings.Instance;
            servers = Services.Servers.Instance;

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

            VgcApis.Misc.UI.AutoSetFormIcon(this);
        }
Ejemplo n.º 7
0
        public static FormMain CreateForm(
            Services.Settings settings,
            VgcApis.Interfaces.Services.IServersService vgcServers)
        {
            FormMain form = null;

            VgcApis.Misc.UI.Invoke(() =>
            {
                form = new FormMain(settings, vgcServers);
            });

            return(form);
        }
Ejemplo n.º 8
0
 public Misc(
     VgcApis.Interfaces.Services.IApiService api,
     Services.Settings settings,
     Services.FormMgrSvc formMgr)
 {
     this.settings = settings;
     this.formMgr  = formMgr;
     vgcNotifier   = api.GetNotifierService();
     vgcUtils      = api.GetUtilsService();
     vgcSlinkMgr   = api.GetShareLinkMgrService();
     vgcServer     = api.GetServersService();
     vgcSettings   = api.GetSettingService();
 }
Ejemplo n.º 9
0
        public TabSetting(
            ComboBox cboxLanguage,
            ComboBox cboxPageSize,
            CheckBox chkServAutoTrack,
            TextBox tboxMaxCoreNum,
            ComboBox cboxRandomSelectServerLatency,
            CheckBox chkPortableMode,
            CheckBox chkSetUseV4,

            CheckBox chkSetIsSupportSelfSignedCert,
            ComboBox cboxSettingsUtlsFingerprint,
            CheckBox chkSettingsEnableUtlsFingerprint,

            CheckBox chkSetEnableStat,
            CheckBox chkSetUpdateUseProxy,
            CheckBox chkSetCheckVgcUpdateWhenAppStart,
            CheckBox chkSetCheckV2rayCoreUpdateWhenAppStart,

            Button btnBrowseDebugLogFile,
            TextBox tboxDebugLogFilePath,
            CheckBox chkIsEnableDebugLogFile)
        {
            this.setting = Services.Settings.Instance;
            this.servers = Services.Servers.Instance;

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

            this.chkSetIsSupportSelfSignedCert = chkSetIsSupportSelfSignedCert;
            this.cboxSettingsUtlsFingerprint   = cboxSettingsUtlsFingerprint;
            this.chkSetIsEnableUtlsFingerprint = chkSettingsEnableUtlsFingerprint;

            this.chkSetEnableStat = chkSetEnableStat;

            this.chkSetCheckVgcUpdateWhenAppStart       = chkSetCheckVgcUpdateWhenAppStart;
            this.chkSetCheckV2RayCoreUpdateWhenAppStart = chkSetCheckV2rayCoreUpdateWhenAppStart;

            this.btnBrowseDebugLogFile   = btnBrowseDebugLogFile;
            this.tboxDebugLogFilePath    = tboxDebugLogFilePath;
            this.chkIsEnableDebugLogFile = chkIsEnableDebugLogFile;
            this.chkSetUpdateUseProxy    = chkSetUpdateUseProxy;

            InitElement();
            BindEvents();
        }
Ejemplo n.º 10
0
        public SubscriptionUI(
            Subscription subsCtrl,
            Models.Datas.SubscriptionItem subscriptItem)
        {
            InitializeComponent();

            this.subsCtrl = subsCtrl;

            servers  = Services.Servers.Instance;
            settings = Services.Settings.Instance;

            // tab page is lazy, do not call this in Load().
            InitControls(subscriptItem);
        }
Ejemplo n.º 11
0
        FormSimpleEditor()
        {
            InitializeComponent();

            setting  = Services.Settings.Instance;
            slinkMgr = Services.ShareLinkMgr.Instance;

            VgcApis.Misc.UI.AutoSetFormIcon(this);

            this.FormClosed += (s, a) =>
            {
                setting.LazyGC();
            };
        }
Ejemplo n.º 12
0
        public static FormMain CreateForm(
            VgcApis.Interfaces.Services.IApiService api,
            Services.Settings settings,
            Services.LuaServer luaServer,
            Services.FormMgr formMgr)
        {
            FormMain r = null;

            VgcApis.Misc.UI.Invoke(() =>
            {
                r = new FormMain(api, settings, luaServer, formMgr);
            });
            return(r);
        }
Ejemplo n.º 13
0
 FormMain(
     VgcApis.Interfaces.Services.IApiService api,
     Services.Settings settings,
     Services.LuaServer luaServer,
     Services.FormMgr formMgr)
 {
     this.api       = api;
     this.formMgr   = formMgr;
     this.settings  = settings;
     this.luaServer = luaServer;
     InitializeComponent();
     VgcApis.Misc.UI.AutoSetFormIcon(this);
     this.Text = Properties.Resources.Name + " v" + Properties.Resources.Version;
 }
Ejemplo n.º 14
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();
        }
Ejemplo n.º 15
0
        FormSimAddVmessClient()
        {
            InitializeComponent();
            Fill(cboxKCP, Models.Datas.Table.kcpTypes);

            setting  = Services.Settings.Instance;
            slinkMgr = Services.ShareLinkMgr.Instance;

            VgcApis.Misc.UI.AutoSetFormIcon(this);

            this.FormClosed += (s, a) =>
            {
                setting.LazyGC();
            };
        }
Ejemplo n.º 16
0
        LuaCoreCtrl CreateLuaCoreCtrl(
            Services.Settings settings,
            VgcApis.Models.IServices.IApiService api)
        {
            var luaApis = new Models.Apis.LuaApis(settings, api);

            luaApis.SetRedirectLogWorker(Log);

            var coreSettings = new Models.Data.LuaCoreSetting();

            var ctrl = new LuaCoreCtrl();

            ctrl.Run(settings, coreSettings, luaApis);
            return(ctrl);
        }
Ejemplo n.º 17
0
        public Import(
            Panel container,
            CheckBox globalImport,
            Button btnExpand,
            Button btnClearCache,
            Button btnCopy,
            Button btnSaveAs)
        {
            this.setting   = Services.Settings.Instance;
            this.configMgr = Services.ConfigMgr.Instance;

            this.editor           = Misc.UI.CreateScintilla(container, true);
            this.cboxGlobalImport = globalImport;
            DataBinding();
            AttachEvent(btnExpand, btnClearCache, btnCopy, btnSaveAs);
        }
Ejemplo n.º 18
0
        FormDownloadCore()
        {
            setting = Services.Settings.Instance;
            servers = Services.Servers.Instance;

            InitializeComponent();
            InitUI();

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

            VgcApis.Misc.UI.AutoSetFormIcon(this);
        }
Ejemplo n.º 19
0
        public FlyServer(
            Form formMain,
            FlowLayoutPanel panel,
            ToolStripLabel lbMarkFilter,
            ToolStripComboBox cboxMarkeFilter,
            ToolStripStatusLabel tslbTotal,
            ToolStripDropDownButton tsdbtnPager,
            ToolStripStatusLabel tslbPrePage,
            ToolStripStatusLabel tslbNextPage,
            ToolStripMenuItem miResizeFormMain)
        {
            servers = Services.Servers.Instance;
            setting = Services.Settings.Instance;

            this.formMain       = formMain;
            this.flyPanel       = panel;
            this.cboxMarkFilter = cboxMarkeFilter;
            this.tsdbtnPager    = tsdbtnPager;
            this.tslbTotal      = tslbTotal;
            this.tslbPrePage    = tslbPrePage;
            this.tslbNextPage   = tslbNextPage;

            this.welcomeItem = new Views.UserControls.WelcomeUI();

            lazyFlyPanelUpdater = new VgcApis.Libs.Tasks.LazyGuy(
                RefreshFlyPanelWorker, flyPanelUpdateInterval, 2000)
            {
                Name = "FormMain.RefreshFlyPanelWorker()",
            };

            lazyStatusBarUpdater = new VgcApis.Libs.Tasks.LazyGuy(
                UpdateStatusBarWorker, statusBarUpdateInterval, 3000)
            {
                Name = "FormMain.UpdateStatusBarWorker()", // disable debug logging
            };

            lazySearchResultDisplayer = new VgcApis.Libs.Tasks.LazyGuy(
                ShowSearchResultNow, 1300, 1000)
            {
                Name = "FormMain.ShowSearchResultNow()",
            };

            InitFormControls(lbMarkFilter, miResizeFormMain);
            BindDragDropEvent();
            RefreshFlyPanelLater();
            WatchServers();
        }
Ejemplo n.º 20
0
        public FormMainCtrl(
            Services.Settings settings,

            ListView dataView,

            ToolStripMenuItem miReset,
            ToolStripMenuItem miResizeByTitle,
            ToolStripMenuItem miResizeByContent)
        {
            this.settings = settings;

            this.dataView = dataView;

            this.miReset           = miReset;
            this.miResizeByContent = miResizeByContent;
            this.miResizeByTitle   = miResizeByTitle;
        }
Ejemplo n.º 21
0
        public void Run(
            VgcApis.Interfaces.Services.IApiService api,
            Services.Settings settings,
            Services.LuaServer luaServer)
        {
            this.settings    = settings;
            this.luaServer   = luaServer;
            this.luaCoreCtrl = CreateLuaCoreCtrl(settings, api);

            InitControls();
            BindEvents();

            ReloadScriptName();

            repaintCtrl = new VgcApis.Libs.Views.RepaintCtrl(rtboxOutput);
            logUpdater.Run();
        }
Ejemplo n.º 22
0
        LuaCoreCtrl CreateLuaCoreCtrl(
            Services.Settings settings,
            VgcApis.Interfaces.Services.IApiService api)
        {
            var luaApis = new Models.Apis.LuaApis(settings, api);

            luaApis.Prepare();
            luaApis.SetRedirectLogWorker(Log);

            var coreSettings = new Models.Data.LuaCoreSetting()
            {
                isLoadClr = true,
            };
            var ctrl = new LuaCoreCtrl(true);

            ctrl.Run(settings, coreSettings, luaApis);
            return(ctrl);
        }
Ejemplo n.º 23
0
        public static FormEditor CreateForm(
            VgcApis.Interfaces.Services.IApiService api,
            Services.Settings settings,
            Services.LuaServer luaServer,
            Services.FormMgrSvc formMgr,

            Models.Data.LuaCoreSetting initialCoreSettings)
        {
            FormEditor r = null;

            VgcApis.Misc.UI.Invoke(() =>
            {
                r = new FormEditor(
                    api, settings, luaServer, formMgr,

                    initialCoreSettings);
            });
            return(r);
        }
Ejemplo n.º 24
0
        public FormLog()
        {
            setting = Services.Settings.Instance;

            InitializeComponent();

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

            Misc.UI.SetFormLocation <FormLog>(this, Models.Datas.Enums.FormLocations.BottomLeft);
            VgcApis.Misc.UI.AutoSetFormIcon(this);
        }
Ejemplo n.º 25
0
        public TabDefaults(
            ComboBox cboxDefImportMode,
            TextBox tboxDefImportAddr,

            CheckBox chkImportSsShareLink,
            CheckBox chkImportTrojanShareLink,
            CheckBox chkImportBypassCnSite,
            CheckBox chkImportInjectGlobalImport,

            CheckBox chkSetSpeedtestIsUse,
            ComboBox cboxDefSpeedtestUrl,
            TextBox tboxSetSpeedtestCycles,
            ComboBox cboxDefSpeedtestExpectedSize,
            TextBox tboxSetSpeedtestTimeout,

            TextBox tboxDefVmessDecodeTemplateUrl,
            CheckBox chkDefVmessDecodeTemplateEnabled,

            RichTextBox exRTBoxDefCustomInbounds)
        {
            this.setting = Services.Settings.Instance;

            this.tboxDefVmessDecodeTemplateUrl    = tboxDefVmessDecodeTemplateUrl;
            this.chkDefVmessDecodeTemplateEnabled = chkDefVmessDecodeTemplateEnabled;

            this.exRTBoxDefCustomInbounds = exRTBoxDefCustomInbounds;

            // Do not put these lines of code into InitElement.
            this.cboxDefImportMode            = cboxDefImportMode;
            this.tboxDefImportAddr            = tboxDefImportAddr;
            this.chkImportSsShareLink         = chkImportSsShareLink;
            this.chkImportTrojanShareLink     = chkImportTrojanShareLink;
            this.chkImportBypassCnSite        = chkImportBypassCnSite;
            this.chkImportInjectGlobalImport  = chkImportInjectGlobalImport;
            this.chkSetSpeedtestIsUse         = chkSetSpeedtestIsUse;
            this.cboxDefSpeedtestUrl          = cboxDefSpeedtestUrl;
            this.tboxSetSpeedtestCycles       = tboxSetSpeedtestCycles;
            this.cboxDefSpeedtestExpectedSize = cboxDefSpeedtestExpectedSize;
            this.tboxSetSpeedtestTimeout      = tboxSetSpeedtestTimeout;

            InitElement();
        }
Ejemplo n.º 26
0
        public SubscriptionUI(
            Subscription subsCtrl,
            Models.Datas.SubscriptionItem subscriptItem)
        {
            InitializeComponent();

            this.subsCtrl = subsCtrl;

            servers  = Services.Servers.Instance;
            settings = Services.Settings.Instance;

            lazyCounter = new VgcApis.Libs.Tasks.LazyGuy(UpdateServerTotalNow, 1000);

            // tab page is lazy, do not call this in Load().
            InitControls(subscriptItem);

            BindEvent();
            lazyCounter.DoItLater();

            Disposed += (s, a) => Cleanup();
        }
Ejemplo n.º 27
0
        public void Run(
            VgcApis.Models.IServices.IApiService api,
            Services.Settings settings,
            Services.LuaServer luaServer)
        {
            this.settings    = settings;
            this.luaServer   = luaServer;
            this.luaCoreCtrl = CreateLuaCoreCtrl(settings, api);

            InitControls();
            BindEvents();

            ReloadScriptName();
            if (cboxScriptName.Items.Count > 0)
            {
                cboxScriptName.SelectedIndex = 0;
            }

            repaintCtrl = new VgcApis.Libs.Views.RepaintCtrl(rtboxOutput);
            logUpdater.Run();
        }
Ejemplo n.º 28
0
        public ServerUI()
        {
            servers  = Services.Servers.Instance;
            slinkMgr = Services.ShareLinkMgr.Instance;
            settings = Services.Settings.Instance;

            InitializeComponent();

            roundLables = new List <Control>
            {
                rlbSetting,
                rlbInboundMode,
                rlbLastModifyDate,
                rlbRemark,
                rlbTotalNetFlow,
                rlbMark,
                rlbSpeedtest,
            };

            lazyUiUpdater = new VgcApis.Libs.Tasks.LazyGuy(RefreshUiWorker, 400, 3000)
            {
                Name = "ServerUi.RefreshPanel",
            };

            lazyHighlighter = new VgcApis.Libs.Tasks.LazyGuy(
                HighLightKeywordsThen, 400, 1000)
            {
                Name = "ServerUi.HighLight",
            };

            InitButtonBackgroundImage();

            ResetControls();

            foreach (Control item in this.Controls)
            {
                item.MouseEnter += ShowCtrlBtn;
            }
        }
Ejemplo n.º 29
0
        public FormMainCtrl(
            Services.Settings settings,

            TextBox tboxName,
            FlowLayoutPanel flyContent,
            ListBox lstBoxPackages,
            Button btnSave,
            Button btnDelete,
            Button btnChain,
            Button btnPack,

            ComboBox cboxBalancerStrategy,

            Button btnPull,
            Button btnSelectAll,
            Button btnSelectInvert,
            Button btnSelectNone,
            Button btnDeleteSelected,
            Button btnRefreshSelected)
        {
            this.settings = settings;

            this.tboxName             = tboxName;
            this.flyContent           = flyContent;
            this.lstBoxPackages       = lstBoxPackages;
            this.btnDelete            = btnDelete;
            this.btnChain             = btnChain;
            this.btnPack              = btnPack;
            this.btnPull              = btnPull;
            this.btnSave              = btnSave;
            this.cboxBalancerStrategy = cboxBalancerStrategy;

            BindEvent(
                btnSelectAll,
                btnSelectInvert,
                btnSelectNone,
                btnDeleteSelected,
                btnRefreshSelected);
        }
Ejemplo n.º 30
0
        FormEditor(
            VgcApis.Interfaces.Services.IApiService api,
            Services.Settings settings,
            Services.LuaServer luaServer,
            Services.FormMgrSvc formMgr,

            Models.Data.LuaCoreSetting initialCoreSettings)
        {
            this.api                 = api;
            this.formMgr             = formMgr;
            this.initialCoreSettings = initialCoreSettings;

            this.settings  = settings;
            this.luaServer = luaServer;

            InitializeComponent();
            VgcApis.Misc.UI.AutoSetFormIcon(this);
            title = string.Format(I18N.LunaScrEditor, Properties.Resources.Version);

            editor    = Misc.UI.CreateLuaEditor(pnlScriptEditor);
            this.Text = title;
        }
Ejemplo n.º 31
0
 public FormOptionCtrl()
 {
     this.setting = Services.Settings.Instance;
     pluginServ   = Services.PluginsServer.Instance;
 }