-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
10 lines (10 loc) · 10.3 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
<!doctype html><html lang=en dir=auto><head><meta name=generator content="Hugo 0.121.2"><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name=robots content="index, follow"><title>唐璞玉</title>
<meta name=description content="一个记录技术路线的博客"><meta name=author content="唐璞玉"><link rel=canonical href=https://sugarbearr.github.io/><link crossorigin=anonymous href=/assets/css/stylesheet.4599eadb9eb2ad3d0a8d6827b41a8fda8f2f4af226b63466c09c5fddbc8706b7.css integrity="sha256-RZnq256yrT0KjWgntBqP2o8vSvImtjRmwJxf3byHBrc=" rel="preload stylesheet" as=style><link rel=icon href=https://sugarbearr.github.io/favicon.ico><link rel=icon type=image/png sizes=16x16 href=https://sugarbearr.github.io/favicon-16x16.png><link rel=icon type=image/png sizes=32x32 href=https://sugarbearr.github.io/favicon-32x32.png><link rel=apple-touch-icon href=https://sugarbearr.github.io/apple-touch-icon.png><link rel=mask-icon href=https://sugarbearr.github.io/safari-pinned-tab.svg><meta name=theme-color content="#2e2e33"><meta name=msapplication-TileColor content="#2e2e33"><link rel=alternate type=application/rss+xml href=https://sugarbearr.github.io/index.xml><link rel=alternate type=application/json href=https://sugarbearr.github.io/index.json><noscript><style>#theme-toggle,.top-link{display:none}</style><style>@media(prefers-color-scheme:dark){:root{--theme:rgb(29, 30, 32);--entry:rgb(46, 46, 51);--primary:rgb(218, 218, 219);--secondary:rgb(155, 156, 157);--tertiary:rgb(65, 66, 68);--content:rgb(196, 196, 197);--code-block-bg:rgb(46, 46, 51);--code-bg:rgb(55, 56, 62);--border:rgb(51, 51, 51)}.list{background:var(--theme)}.list:not(.dark)::-webkit-scrollbar-track{background:0 0}.list:not(.dark)::-webkit-scrollbar-thumb{border-color:var(--theme)}}</style></noscript><meta property="og:title" content="唐璞玉"><meta property="og:description" content="一个记录技术路线的博客"><meta property="og:type" content="website"><meta property="og:url" content="https://sugarbearr.github.io/"><meta name=twitter:card content="summary"><meta name=twitter:title content="唐璞玉"><meta name=twitter:description content="一个记录技术路线的博客"><script type=application/ld+json>{"@context":"https://schema.org","@type":"Organization","name":"唐璞玉","url":"https://sugarbearr.github.io/","description":"一个记录技术路线的博客","thumbnailUrl":"https://sugarbearr.github.io/favicon.ico","sameAs":["https://github.com/"]}</script></head><body class=list id=top><script>localStorage.getItem("pref-theme")==="dark"?document.body.classList.add("dark"):localStorage.getItem("pref-theme")==="light"?document.body.classList.remove("dark"):window.matchMedia("(prefers-color-scheme: dark)").matches&&document.body.classList.add("dark")</script><header class=header><nav class=nav><div class=logo><a href=https://sugarbearr.github.io/ accesskey=h title="唐璞玉 (Alt + H)">唐璞玉</a><div class=logo-switches><button id=theme-toggle accesskey=t title="(Alt + T)"><svg id="moon" xmlns="http://www.w3.org/2000/svg" width="24" height="18" viewBox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z"/></svg><svg id="sun" xmlns="http://www.w3.org/2000/svg" width="24" height="18" viewBox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="5"/><line x1="12" y1="1" x2="12" y2="3"/><line x1="12" y1="21" x2="12" y2="23"/><line x1="4.22" y1="4.22" x2="5.64" y2="5.64"/><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"/><line x1="1" y1="12" x2="3" y2="12"/><line x1="21" y1="12" x2="23" y2="12"/><line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/></svg></button></div></div><ul id=menu><li><a href=https://sugarbearr.github.io/archives/ title=Archives><span>Archives</span></a></li><li><a href=https://sugarbearr.github.io/tags/ title=Tags><span>Tags</span></a></li><li><a href=https://sugarbearr.github.io/search/ title="Search (Alt + /)" accesskey=/><span>Search</span></a></li></ul></nav></header><main class=main><article class="first-entry home-info"><header class=entry-header><h1>Hi there 👋</h1></header><div class=entry-content>Welcome to my blog</div><footer class=entry-footer><div class=social-icons><a href=https://github.com/ target=_blank rel="noopener noreferrer me" title=Github><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37.0 00-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44.0 0020 4.77 5.07 5.07.0 0019.91 1S18.73.65 16 2.48a13.38 13.38.0 00-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07.0 005 4.77 5.44 5.44.0 003.5 8.55c0 5.42 3.3 6.61 6.44 7A3.37 3.37.0 009 18.13V22"/></svg></a></div></footer></article><article class=post-entry><header class=entry-header><h2 class=entry-hint-parent>webview2在wpf中的应用</h2></header><div class=entry-content><p>开发环境 运行环境:.Net 6
开发环境:Visual Studio 2022 17.1.3
框架语言:WPF
安装WebView2 通过Package Manager控制台安装 Install-Package Microsoft.Web.WebView2 通过Nuget包管理器安装 !https://s1.ax1x.com/2022/04/09/LinhIe.png
在窗体中添加名字空间: xmlns:wv2="clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf" 引用WebView2控件: <wv2:WebView2 x:Name="webview" Grid.Row="1" Source="<https://www.bilibili.com>" /> 使用WebView2 关于CoreWebView2 💡 Note:默认情况下,如果控件中没有设置Source属性,CoreWebView2是没有初始化的,此时需要我们手动初始化CoreWebView2,CoreWebView2初始化有以下两种方式:
第一种:调用EnsureCoreWebView2Async()方法 if (webView.CoreWebView2 == null) { await webView.EnsureCoreWebView2Async(); } 第二种:为Source属性赋值 webView.Source = new Url("<https://www.bilibili.com>"); 常用设置 从初始化方式说起: var env = await CoreWebView2Environment.CreateAsync(); await webView.EnsureCoreWebView2Async(env); 这和我们最开始讲的初始化相比,多传了一个env变量参数来初始化。这个变量的工厂函数定义如下:
public static async Task<CoreWebView2Environment> CreateAsync( string browserExecutableFolder = null, string userDataFolder = null, CoreWebView2EnvironmentOptions options = null) 从以上代码可以看出,这个工厂函数它可以传入三个参数:
browserExecutableFolder userDataFolder options 第一个参数是选择Edge Runtime,默认为长绿版本,但我们也可以选择固定版本,当我们要使用固定版本时,需要做以下操作:...</p></div><footer class=entry-footer><span title='2024-01-18 22:18:15 +0800 CST'>January 18, 2024</span> · 2 min · 唐璞玉</footer><a class=entry-link aria-label="post link to webview2在wpf中的应用" href=https://sugarbearr.github.io/posts/webview2%E5%9C%A8wpf%E4%B8%AD%E7%9A%84%E5%BA%94%E7%94%A8/></a></article><article class=post-entry><header class=entry-header><h2 class=entry-hint-parent>Rx.NET</h2></header><div class=entry-content><p>编程范式: 编程范式分为命令式编程、声明式编程、函数式编程和响应式编程。
命令式编程: 命令式编程的主要思想是关注计算机执行的步骤,即一步一步告诉计算机先做什么再做什么。 //1. 声明变量 List<int> results = new List<int>(); //2. 循环变量 foreach(var num in Enumerable.Range(1,10)) { //3. 添加条件 if (num > 5) { //4. 添加处理逻辑 results.Add(num); Console.WriteLine(num); } } 声明式编程: 声明式编程是以数据结构的形式来表达程序执行的逻辑。它的主要思想是告诉计算机应该做什么,但不指定具体要怎么做。 var nums = from num in Enumerable.Range(1,10) where num > 5 select num 函数式编程: 主要思想是把运算过程尽量写成一系列嵌套的函数调用。 Enumerable.Range(1, 10).Where(num => num > 5).ToList().ForEach(Console.WriteLine); 响应式编程: 响应式编程是一种面向数据流和变化传播的编程范式,旨在简化事件驱动应用的实现。响应式编程专注于如何创建依赖于变更的数据流并对变化做出响应。 IObservable<int> nums = Enumerable.Range(1, 10).ToObservable(); IDisposable subscription = nums.Where(num => num > 5).Subscribe(Console.WriteLine); subscription.Dispose(); Rx....</p></div><footer class=entry-footer><span title='2024-01-15 22:32:33 +0800 CST'>January 15, 2024</span> · 3 min · 唐璞玉</footer><a class=entry-link aria-label="post link to Rx.NET" href=https://sugarbearr.github.io/posts/rx.net/></a></article></main><footer class=footer><span>© 2024 <a href=https://sugarbearr.github.io/>唐璞玉</a></span></footer><a href=#top aria-label="go to top" title="Go to Top (Alt + G)" class=top-link id=top-link accesskey=g><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 6" fill="currentcolor"><path d="M12 6H0l6-6z"/></svg></a><script>let menu=document.getElementById("menu");menu&&(menu.scrollLeft=localStorage.getItem("menu-scroll-position"),menu.onscroll=function(){localStorage.setItem("menu-scroll-position",menu.scrollLeft)}),document.querySelectorAll('a[href^="#"]').forEach(e=>{e.addEventListener("click",function(e){e.preventDefault();var t=this.getAttribute("href").substr(1);window.matchMedia("(prefers-reduced-motion: reduce)").matches?document.querySelector(`[id='${decodeURIComponent(t)}']`).scrollIntoView():document.querySelector(`[id='${decodeURIComponent(t)}']`).scrollIntoView({behavior:"smooth"}),t==="top"?history.replaceState(null,null," "):history.pushState(null,null,`#${t}`)})})</script><script>var mybutton=document.getElementById("top-link");window.onscroll=function(){document.body.scrollTop>800||document.documentElement.scrollTop>800?(mybutton.style.visibility="visible",mybutton.style.opacity="1"):(mybutton.style.visibility="hidden",mybutton.style.opacity="0")}</script><script>document.getElementById("theme-toggle").addEventListener("click",()=>{document.body.className.includes("dark")?(document.body.classList.remove("dark"),localStorage.setItem("pref-theme","light")):(document.body.classList.add("dark"),localStorage.setItem("pref-theme","dark"))})</script></body></html>