private void SearchByAuthorIdAction(MoeSite arg1, string arg2) { SearchControl.CurrentSelectedSite = arg1; SearchControl.MoeSitesLv2ComboBox.SelectedIndex = 1; SearchControl.KeywordTextBox.Text = arg2; SearchButtonOnClick(null, null); }
public void Init(Settings setting, MoeSite site) { Setting = setting; Site = site; MainBrower.IsBrowserInitializedChanged += MainBrowerOnIsBrowserInitializedChanged; MainBrower.Loaded += MainBrowerOnLoaded; AuthButton.Click += AuthButtonOnClick; GoToLoginPageButton.Click += GoToLoginPageButtonOnClick; }
public async Task Init(Settings setting, MoeSite site) { Site = site; DataContext = setting; Closing += OnClosing; this.SetWindowFluent(setting); try { MainBrowser.CoreWebView2InitializationCompleted += MainBrowserOnCoreWebView2InitializationCompleted; if (MainBrowser == null) { return; } var option = new CoreWebView2EnvironmentOptions(); switch (NetOperator.GetProxyMode(setting, site.SiteSettings)) { case Settings.ProxyModeEnum.None: option.AdditionalBrowserArguments = "--no-proxy-server"; break; case Settings.ProxyModeEnum.Custom: option.AdditionalBrowserArguments = $"--proxy-server=http://{setting.ProxySetting}"; break; case Settings.ProxyModeEnum.Ie: break; } Environment = await CoreWebView2Environment.CreateAsync(null, App.AppDataDir, option); AuthButton.Click += AuthButtonOnClick; GoToLoginPageButton.Click += GoToLoginPageButtonOnClick; var _ = MainBrowser.EnsureCoreWebView2Async(Environment); } catch (Exception ex) { var result = MessageBox.Show(this, "未找到WebView2组件,需要下载吗?(需要Webview2组件才能显示网页登录界面)", App.DisplayName, MessageBoxButton.YesNo, MessageBoxImage.Question); if (result == MessageBoxResult.Yes) { "https://go.microsoft.com/fwlink/p/?LinkId=2124703".GoUrl(); } Ex.Log(ex); Close(); } }
public MoeItem(MoeSite site, SearchPara para) { Site = site; Para = para; ChildrenItems.CollectionChanged += delegate { OnPropertyChanged(nameof(ChildrenItemsCount)); }; Urls.CollectionChanged += delegate { OnPropertyChanged(nameof(FileType)); OnPropertyChanged(nameof(DownloadUrlInfo)); }; para.Session.PropertyChanged += (_, args) => { if (args.PropertyName == nameof(SearchSession.CurrentDownloadType)) { OnPropertyChanged(nameof(DownloadUrlInfo)); OnPropertyChanged(nameof(FileType)); } }; }
public NetOperator(Settings settings, MoeSite site, double timeout = 40) { Settings = settings; Site = site; Timeout = timeout; HttpClientHandler = new HttpClientHandler { Proxy = GetProxy(), // ServerCertificateCustomValidationCallback = delegate { return true; }, }; //if (GetProxyMode(Settings, Site.SiteSettings) != Settings.ProxyModeEnum.None) //{ // HttpClientHandler.SslProtocols = SslProtocols.Tls12; //} ProgressMessageHandler = new ProgressMessageHandler(HttpClientHandler); Client = new HttpClient(ProgressMessageHandler); var agent = Agents[new Random().Next(0, Agents.Length - 1)]; Client.DefaultRequestHeaders.UserAgent.ParseAdd(agent); Client.Timeout = TimeSpan.FromSeconds(Timeout); }