示例#1
0
文件: Import.cs 项目: ghotm/V2RayGCon
        public override void Update(JObject config)
        {
            content = I18N.AnalysingImport;

            var plainText = config.ToString();

            if (cboxGlobalImport.Checked)
            {
                var configWithGlobalImports =
                    Misc.Utils.ImportItemList2JObject(
                        setting.GetGlobalImportItems(), false, true, false);

                Misc.Utils.MergeJson(ref configWithGlobalImports, config);
                plainText = configWithGlobalImports.ToString();
            }

            VgcApis.Misc.Utils.RunInBackground(() =>
            {
                string result = ParseConfig(plainText);
                setting.LazyGC();

                VgcApis.Misc.UI.RunInUiThread(editor, () =>
                {
                    content = result;
                });
            });
        }
示例#2
0
        FormSimpleEditor()
        {
            InitializeComponent();

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

            VgcApis.Misc.UI.AutoSetFormIcon(this);

            this.FormClosed += (s, a) =>
            {
                setting.LazyGC();
            };
        }
        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();
            };
        }
示例#4
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);
        }
示例#5
0
        private void FormConfiger_Load(object sender, EventArgs e)
        {
            setting.RestoreFormRect(this);

            InitToolsPanel();
            this.configer = InitConfiger();

            SetTitle(configer.GetAlias());
            ToggleToolsPanel(isShowPanel);

            chkIsV4.Checked = setting.isUseV4;

            editor = configer
                     .GetComponent <Controllers.ConfigerComponet.Editor>()
                     .GetEditor();

            editor.Click += OnMouseLeaveToolsPanel;
            BindServerEvents();

            this.FormClosing += (s, a) =>
            {
                if (!configer.IsConfigSaved())
                {
                    a.Cancel = !Misc.UI.Confirm(I18N.ConfirmCloseWinWithoutSave);
                }
            };

            this.FormClosed += (s, a) =>
            {
                formSearch?.Close();
                editor.Click -= OnMouseLeaveToolsPanel;
                toolsPanelController.Dispose();
                ReleaseServerEvents();
                configer.Cleanup();
                editor?.Dispose();
                setting.SaveFormRect(this);
                setting.LazyGC();
            };

            configer.UpdateServerMenusLater();
        }
示例#6
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();
        }
示例#7
0
 private void FormMain_FormClosing(object sender, FormClosingEventArgs e)
 {
     setting.SaveFormRect(this);
     setting.LazyGC();
 }