使用Blazor开发桌面应用程序(.NET)

.NET 专栏收录该内容
¥59.90 ¥99.00
146篇文章
AI摘要

本文介绍了如何利用Blazor与Electron.NET框架开发桌面应用程序。首先创建Blazor项目,接着安装并初始化Electron.NET,配置相关设置,然后构建并运行应用。最后,通过示例展示在Blazor应用中创建桌面窗口并显示内容。

使用Blazor开发桌面应用程序(.NET)

Blazor是一种基于Web技术的.NET框架,可以用于构建现代化的Web应用程序。然而,Blazor也可以用于开发桌面应用程序,为开发人员提供了一种使用C#和.NET技术构建跨平台应用程序的方式。本文将介绍如何使用Blazor开发桌面应用程序,并提供相应的源代码示例。

Blazor桌面应用程序的开发依赖于Electron.NET,它是一个将Blazor应用程序打包为可在桌面上运行的Electron应用程序的工具。下面是一系列的步骤,展示了如何使用Blazor和Electron.NET开发桌面应用程序。

步骤1:创建Blazor应用程序
首先,我们需要创建一个Blazor应用程序。可以使用以下命令在命令行中创建一个新的Blazor应用程序:

dotnet new blazorwasm -o MyBlazorApp

这将创建一个名为"MyBlazorApp"的新文件夹,并在其中生成Blazor应用程序的基本结构。

步骤2:安装Electron.NET
接下来,我们需要安装Electron.NET。可以使用以下命令在Blazor应用程序的根目录中安装Electron.NET:

dotnet tool install ElectronNET.CLI -g

步骤3:初始化Electron.NET
安装完Electron.NET后,我们需要在Blazor应用程序的根目录中初始化Electron.NET。可以使用以下命令执行初始化:

electronize init
<
使用.NET5、Blazor和Electron.NET构建跨平台桌面应用 Electron.NET是一个嵌入了ASP.NET Core的Electron的封装,通过Electron.NET可以构建基于.NET5的跨平台的桌面应用,使得开发人员只需要使用ASP.NET Core和 Blazor就可以胜任桌面应用的开发工作。 开发环境# 操作系统Windows/macOS/Linux .NET5.0 npm 创建新项目# 创建文件夹 mkdir ElectronNETDemon 创建解决方案 dotnet new sln 创建项目Electr 阅读详情

相关推荐

.Net8.0 Blazor Hybird 桌面端 (WPF/Winform) 发布到 Win7+

Win7+ 运行 Blazor Hybird 桌面端 (WPF/Winform) 依赖的环境

alex_zoucn的博客 5907

ASP.NET Blazor托管模型有哪些?

今天我们来说说Blazor的三种部署方式,如果大家还不了解Blazor,那么我先简单介绍下BlazorBlazor 是一种 .NET 前端 Web 框架,在单个编程模型中同时支持服务器端呈现和客户端交互性:● 使用 C# 创建丰富的交互式 UI。● 共享使用 .NET 编写的服务器端和客户端应用逻辑。● 将 UI 呈现为 HTML 和 CSS,以支持众多浏览器,其中包括移动浏览器。● 使用 .NET 和 Blazor 生成混合桌面和移动应用。

Maybe_ch的博客 8234

.NET技术在桌面应用与跨平台开发中的最新进展

随着现代软件开发需求的增长,跨平台与桌面应用开发成为开发者关注的重点。.NET技术在这一领域取得了显著进展,特别是在桌面应用和跨平台开发方面。本文探讨了.NET在桌面应用开发中的现代化进程,如WinForms和WPF的跨平台支持,以及MAUI作为跨平台桌面应用的新希望。同时,.NET 6/7在跨平台开发中的进展,包括Blazor与MAUI的结合,以及云原生与微服务的支持,也被详细分析。未来,.NET将继续推动统一平台、AI与机器学习集成,以及更广泛的跨平台支持,为开发者提供更高效、灵活的开发工具,助力构建创

这里只有干货:从 Modbus 通信到 MES 对接,从 YOLO 训练到工控机部署,带你搞定工业软件开发全流程。 1409

Blazor开发WEB程序

Blazor从0到1开发一个项目所遇到的问题汇总

揽月凡尘 2765

使用.NET Core和Blazor创建多图像 ICO 文件的桌面应用:Icollator2项目解析

WebWindow是一个允许将Web内容直接嵌入桌面应用程序中的技术。它为开发者提供了一个桥梁,使得原本只能运行在浏览器中的Web应用也能以桌面应用的形式运行。Blazor是微软推出的一个框架,它使得开发者可以使用C#等.NET语言来构建Web前端应用程序。开发者可以在Blazor中编写他们熟悉的.NET代码,并通过WebAssembly技术在浏览器中执行。

weixin_33506815的博客 1005

blazor-electron-app:使用Electron在跨平台桌面应用程序上探索Syncfusion Blazor组件

Electron上的Syncfusion Blazor服务器端应用程序 先决条件 • 或 • 运行应用程序 打开命令提示符,并使用以下命令行克隆存储库。 git clone https://github.com/SyncfusionExamples/blazor-electron-app 导航到应用程序文件夹,然后使用以下命令行运行该应用程序。 cd blazor-electron-app dotnet electronize start 该应用程序将在Electron Shell上启动。

BlazorDesktop

BlazorDesktop

BlazorHybridDesktop:Blazor混合桌面测试

BlazorHybridDesktop Blazor混合桌面测试

blazor-desktop-crossplatform-sample:使用.NET 6 Blazor Desktop实施的真正跨平台Web和桌面Blazor应用程序的真正早期被黑客入侵的例子

跨平台Blazor Desktop示例 这个被黑客入侵的示例展示了一个Blazor桌面(使用.NET 6中提供的官方API)应用程序,该应用程序既可以在Web浏览器中运行,也可以在官方WinForms包装的早期版本中运行。 本文以默认的Blazor服务器模板为例,该模板比.NET 6 Preview 2公告中的模板更漂亮。 要运行它, /BlazorDesktopTest/BlazorDesktopTest.sln在Visual Studio 16.9中打开/BlazorDesktopTest/BlazorDesktopTest.sln ,并安装.NET 6 Preview 2 SDK,并打开“启用预览.NET SDK”。 然后,您可以F5 BlazorDesktopTest和BlazorWinFormsApp项目。 此代码包含来自aspnetcore主存储库的大量内容,主要是因为尚未

ArcGIS 10.2.2自带Python 2.7.5环境配置全攻略:从pip安装到gdal、arcpy调用

本文详细指导如何在ArcGIS 10.2.2自带的Python 2.7.5环境中进行高效配置。核心内容包括安装pip包管理器、部署gdal等关键地理数据处理库,并确保arcpy模块的无缝调用。通过解决路径配置与PyCharm集成问题,帮助用户在此经典环境中构建稳定、兼容的地理信息自动化工作流,有效连接ArcGIS桌面功能与Python脚本编程。

moon9的博客 767

银河麒麟V10+QT6.0中文输入法环境搭建全攻略(附镜像加速技巧)

本文提供了在银河麒麟V10操作系统上为QT6.0搭建中文输入法环境的完整实战指南。文章详细介绍了从系统准备、镜像源优化、QT6安装器获取与加速安装,到编译Fcitx5输入法插件依赖库、深度配置环境变量与项目的全流程。重点分享了使用国内镜像源加速安装的技巧,解决了国产化开发中QT应用无法输入中文的常见难题,旨在帮助开发者快速构建稳定高效的开发环境。

weixin_29204749的博客 391

图片数据爬取工具Image-Downloader的安装和使用

文章目录1、python安装2、下载chromedriver并配置3、下载phantomjs并配置.4、安装相关python库5、使用 安装包地址:https://github.com/sczhengyabin/Image-Downloader 下载: 方式一:打开cmd,输入: git clone https://github.com/sczhengyabin/Image-Downloader.git 方式二:打开网址 1、python安装 该数据爬取工具要求python>=3.5,由于

wxplol的博客 6672

riscv32-gcc工具链实战:从下载到编译的完整指南

本文提供了一份详尽的riscv32-gcc工具链实战指南,涵盖从官方渠道下载预编译版本、正确选择riscv32-glibc版本、配置环境变量到实战编译的全过程。通过清晰的步骤和避坑指南,帮助开发者快速搭建稳定的RISC-V交叉编译环境,并成功编译从Hello World到Linux内核的程序。

s3t4u的博客 675

Arcgis空间分布方向性分析

Arcgis空间分布方向性分析 一、标准差椭圆方法概述 空间分布方向性分析是指区域经济属性在空间分布上的轮廓和主导方向。 标准差椭圆法是分析空间分布方向性特征的经典方法之一,使用标准差椭圆可 从全局的、空间的角度定量解释经济要素空间分布的中心性、展布性、方向性和 空间形态等整体性特征,因其直观性与有效性已得到广泛应用,已成为 Arc GIS 空间统计模块的常规统计工具。SDE 方法生成的结果为一个椭圆,从其生 成算法来看,首先用平均中心来确定椭圆的圆心,然后由平均中心作为起点 对 X 坐标

端木宛白的博客家园 4万+

YOLOv11 改进 - SPPF模块 | 发论文神器!LSKA注意力改进SPPF,增强多尺度特征提取能力,高效涨点!!!

本文介绍了Large Separable Kernel Attention (LSKA)模块及其在YOLOv11中的结合应用。LSKA旨在解决Visual Attention Networks (VAN)使用大内核卷积时的计算效率问题,通过将2D深度卷积层的卷积核分解为级联的水平和垂直1-D卷积核,降低了计算复杂度和内存占用,且使VAN更关注物体形状。我们将集成LSKA的SPPF_LSKA模块引入YOLOv11,大量实验表明,改进后的模型在对象识别、检测、分割和稳健性测试上表现出色。

魔改工程师的博客 1279

FakeNewsGPT4:通过知识增强的大规模视觉语言模型推进多模态假新闻检测

当前,多模态假新闻的大量涌现导致了显著的分布差异,这一现状亟需我们开发具备广泛适用性的检测器。然而,现有假新闻检测器因特定领域内的训练方式,难以有效获取开放世界中的事实信息。这种训练的封闭性限制了传统检测器的能力,特别是在面对跨域假新闻时,其表现往往不尽如人意。具体而言,开放世界中的假新闻在两个方面具有显著的分布差异:一方面,其操纵内容多种多样,新闻的任一部分都可能受到创意策略的操控;另一方面,真实背景复杂多变,不同地区的新闻背景和主题焦点存在显著差异。

qq_52053775的博客 821

2026年复旦微电数字IC笔试试卷带答案解析

摘要: 本文为复旦微电子MCU/SOC岗位笔试模拟题,涵盖单片机架构、数字电路、存储技术等核心知识点。内容包括: 单选题(30分):考察Cortex-M中断机制、时序分析(建立/保持时间)、逻辑化简、跨时钟域设计(格雷码应用)、存储器特性(NAND Flash操作单元)等; 波形分析(15分):聚焦D触发器行为、时钟分频、建立时间违例判断及跨时钟域同步; 多选题(25分):涉及亚稳态成因与处理、异步FIFO设计要点、MCU低功耗策略、NAND Flash特性及复旦微电市场地位; 简答题(20分):解析建立/

Open 342

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

lwip-2.0.3

lwip是瑞典计算机科学院(SICS)的Adam Dunkels 开发的一个小型开源的TCP/IP协议栈。实现的重点是在保持TCP协议主要功能的基础上减少对RAM 的占用。

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

上一篇: C#中巧妙学习元素分类的方法,不为人知的.NET罪魁祸首
下一篇: .NET 6 环境下使用 Visual Studio 版本的异常处理
普通网友
博客等级 码龄3年 44粉丝 0原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值