C# wpf程序
--App.xaml
namespace WpfMyproject
{
/// <summary>
/// App.xaml 的交互逻辑
/// </summary>
public partial class App : PrismApplication
{
protected override Window CreateShell()
{
return Container.Resolve<MainView>();
}
protected override void RegisterTypes(IContainerRegistry containerRegistry)
{
第二种方式
//containerRegistry.RegisterForNavigation<AutoView>();
//containerRegistry.RegisterForNavigation<ManuView>();
//containerRegistry.RegisterForNavigation<SetView>();
//containerRegistry.RegisterForNavigation<ParameterView>();
//containerRegistry.RegisterForNavigation<StatisticView>();
//containerRegistry.RegisterForNavigation<AlarmView>();
//containerRegistry.RegisterForNavigation<UserView>();
}
protected override IModuleCatalog CreateModuleCatalog()
{
return new DirectoryModuleCatalog() {ModulePath = @".\Modules" };
}
}
}
--MainView.xaml
<Window.Resources>
<Style x:Key="MenuButtonStyle" TargetType="Button">
<Setter Property="Margin" Value="5,5"/>
<Setter Property="Width" Value="100"/>
<Setter Property="Height" Value="60"/>
<Setter Property="FontSize" Value="20"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="Background" Value="#666666"/>
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="100"/>
<RowDefinition/>
<RowDefinition Height="60"/>
</Grid.RowDefinitions>
<Border Grid.Row="0" Background="#333366"/>
<Border Grid.Row="2" Background="#cccccc"/>
<Border Grid.Row="3" Background="Green"/>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100"/>
<ColumnDefinition/>
<ColumnDefinition Width="200"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0">
<TextBlock Margin="0,40" Text="图片" Width="100" FontSize="30" Foreground="Yellow" />
</StackPanel>
<StackPanel Grid.Column="2">
<TextBlock Margin="0,20" Text="当前登录用户:" FontSize="18" Foreground="Purple"/>
</StackPanel>
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="40"/>
<RowDefinition/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0">
<TextBlock Margin="0,5" Text="智能控制系统" Width="100" FontSize="20" Foreground="White"/>
</StackPanel>
<StackPanel Grid.Row="1" Orientation="Horizontal">
<Button Style="{StaticResource MenuButtonStyle}" Content="自动" Command="{Binding OpenCommand}" CommandParameter="AutoView"/>
<Button Style="{StaticResource MenuButtonStyle}" Content="手动" Command="{Binding OpenCommand}" CommandParameter="ManuView"/>
<Button Style="{StaticResource MenuButtonStyle}" Content="设置" Command="{Binding OpenCommand}" CommandParameter="SetView"/>
<Button Style="{StaticResource MenuButtonStyle}" Content="参数" Command="{Binding OpenCommand}" CommandParameter="ParameterView"/>
<Button Style="{StaticResource MenuButtonStyle}" Content="统计" Command="{Binding OpenCommand}" CommandParameter="StatisticView"/>
<Button Style="{StaticResource MenuButtonStyle}" Content="报警" Command="{Binding OpenCommand}" CommandParameter="AlarmView"/>
<Button Style="{StaticResource MenuButtonStyle}" Content="登录" Command="{Binding OpenCommand}" CommandParameter="UserView"/>
</StackPanel>
</Grid>
</Grid>
<!--//第一种方式-->
<!--<ContentControl Grid.Row="1" Content="{Binding Body}"/>-->
<!--//第二种方式-->
<ContentControl Grid.Row="1" prism:RegionManager.RegionName="ContentRegion"/>
</Grid>
--MainViewModel
namespace WpfMyproject.ViewModels
{
public class MainViewModel : BindableBase
{
//第一种方式
//public DelegateCommand<string> OpenCommand { get; private set; }
//public MainViewModel()
//{
// OpenCommand = new DelegateCommand<string>(Open);
//}
//private object body;
//public object Body
//{
// get { return body; }
// set { body = value; RaisePropertyChanged(); }
//}
//private void Open(string obj)
//{
// switch (obj)
// {
// case "AutoView": Body = new AutoView(); break;
// case "ManuView": Body = new ManuView(); break;
// case "SetView": Body = new SetView(); break;
// case "ParameterView": Body = new ParameterView(); break;
// case "StatisticView": Body = new StatisticView(); break;
// case "AlarmView": Body = new AlarmView(); break;
// case "UserView": Body = new UserView(); break;
// }
//}
//第二种方式
private readonly IRegionManager regionManager;
public DelegateCommand<string> OpenCommand { get; private set; }
public MainViewModel(IRegionManager regionManager)
{
OpenCommand = new DelegateCommand<string>(Open);
this.regionManager = regionManager;
}
private void Open(string obj)
{
regionManager.Regions["ContentRegion"].RequestNavigate(obj);
}
}
}
相关文章:
C# wpf程序
--App.xaml namespace WpfMyproject { /// <summary> /// App.xaml 的交互逻辑 /// </summary> public partial class App : PrismApplication { protected override Window CreateShell() { return Container.R…...

4G WWAN设备类型
WWAN设备类型 USB dongle是设备接入互联网的重要方式之一,典型的通过USB接口与主设备连接,然后主设备通过4G/5G接入互联网,作为移动宽带设备,它有那些设备类型及暴露方式呢? 移动宽带设备类型:ModemManage…...

windows环境下安装elasticsearch、kibana
通过本文可以快速在windows系统上安装elasticsearch、kibana环境。 当你用Integer类型的时候,要非常小心,因为100等于100、但是200不等于200,当然,如果你会一点小花招,也可以让100不等于100、让200等于200。(运算符比较…...

Java Selenium WebDriver 网页填报
一、windows环境安装配置 1.安装chrome浏览器 在“关于chrome”界面,查看浏览器版本号 2.下载chromeDriver 在https://registry.npmmirror.com/binary.html?pathchromedriver/下载对应版本的驱动(如果浏览器版本过新,建议下载最接近的版…...

【NLP概念源和流】 06-编码器-解码器模型(6/20 部分)
一、说明 在机器翻译等任务中,我们必须从一系列输入词映射到一系列输出词。读者必须注意,这与“序列标记”不同,在“序列标记”中,该任务是将序列中的每个单词映射到预定义的类,如词性或命名实体任务。 作者生成 在上面的...

运维必备的免费在线画图工具,你觉得哪个最好用呢
都说一图胜千言,一个IT工程师如果能画的一手好图,无论是在方案选项、还是技术交流,都能快速表达自己的想法,让你的思路更加的直观明了;市面上的制图工具有很多,下面就推荐几款好用且免费的工具,…...

skywalking全链路追踪
文章目录 一、介绍二、全链路追踪1. 测试1 - 正常请求2. 测试2 - 异常请求 三、过滤非业务请求链路1. 链路忽略插件2. 配置3. 测试 一、介绍 在上一篇文章skywalking安装教程中我们介绍了skywalking的作用以及如何将其集成到我们的微服务项目中。本篇文章我们介绍在微服务架构…...

Nacos配置中心设置Mongodb
目录 1.common模块导入nacos config依赖 2.common模块新建bootstrap.yaml 3.在自己的模块导入common模块依赖 4.打开nacos新建配置,发布 5.运行服务并测试 效果:在部署完成后,其他人可以自动连接到你本地mongoDB数据库,无需再…...

【Spring Boot】请求参数传json对象,后端采用(map)CRUD案例(101)
请求参数传json对象,后端采用(map)接收的前提条件: 1.Spring Boot 的Controller接受参数采用:RequestBody 2.需要一个Json工具类,将json数据转成Map; 工具类:Json转Map import com…...

微软开测“Moment4”启动包:Win11 23H2要来了
近日, 有用户在Win11最新的7月累积更新中发现,更新文件中已经开始出现了对“Moment4”的引用。 具体来说,在7月累积更新中,微软加入了“Microsoft-Windows-UpdateTargeting-ClientOS-SV2Moment4-EKB”“Microsoft-Windows-23H2Ena…...

SpringCloud《Eureka、Ribbon、Feign、Hystrix、Zuul》作用简单介绍
概述 SpringCloud是一个全家桶,包含多个组件。 本文主要介绍几个重要组件,也就是Eureka、Ribbon、Feign、Hystrix、Zuul这几个组件。 一、业务场景介绍 业务流程,支付订单功能 订单服务改变为已支付订单服务调用库存服务,扣减…...
运维项目—K8S命令
文章目录 一、基本操作1、命名空间kubectl get ns 获取命名空间kubectl get ns default -o yaml 以yaml的格式查看某个nskubectl describe ns hoc-prod 查看某个ns详情1、命名空间与Podkubectl get pods --all-namespaces查看所有命名空间下的所有podkubectl get pod -A查看所有…...
java框架整合Springmvc+···+maven
框架整合: Springmvc Mybatis Shiro(权限) REST(服务) WebService(服务) JMS(消息) Lucene(搜搜引擎) Quartz(定时调度) Bootstrap Html5(支持PC、IOS、Android) 系统模块: 1. 用户管理: 用户信…...

答辩PPT怎么做?在线PPT软件哪个好?
又是一年毕业季,相信很多毕业生都开始准备论文答辩,有些同学正在为论文奋夜苦战,有些则是为论文答辩PPT而烦恼。做PPT要用什么软件好呢?这篇文章就来告诉你。 当下有很多PPT制作工具,其中自然也包括Office三件套。这些…...

Astro + Vercel 快速搭建自己的博客网站
Astro 和 Vercel 彼此相得益彰,前者提供出色的开发者体验,用于构建现代静态站点,而后者负责部署和托管代码。 两者结合我们就可以轻轻松松零成本搭建自己的博客网站。查看示例。 步骤 1,创建评论仓库 在部署博客之前ÿ…...
TensorFlow
什么是 TensorFlow TensorFlow是一个开源的机器学习框架,由Google于2015年推出。它被设计用来构建深度神经网络和其他机器学习模型,从而可以实现图像识别、语音识别、自然语言处理、推荐系统、搜索引擎、预测和控制等应用。TensorFlow是一个基于数据流图…...

【iOS RunLoop】
文章目录 前言-什么是RunLoop?默认情况下主线程的RunLoop原理 1. RunLoop对象RunLoop对象的获取 CFRunLoopRef源码部分(引入线程相关) 2. RunLoop和线程3. RunLoop相关的类RunLoop相关类的实现CFRunLoopModeRef五种运行模式CommonModes CFRun…...

阿里云平台注册及基础使用
首先进入阿里云官网: 阿里云-计算,为了无法计算的价值 点击右上角“登录/注册”,如果没有阿里云账号则需要注册。 注册界面: 注册完成后需要开通物联网平台公共实例: 注册成功后的登录: 同样点击右上角的…...

Mr. Cappuccino的第58杯咖啡——MacOS配置Maven和Java环境
MacOS配置Maven和Java环境 查看Mac使用的是哪个shell下载并准备Maven下载Maven配置前准备 下载并安装JDK下载JDK安装JDK 配置Maven和Java环境添加配置加载配置 验证环境 查看Mac使用的是哪个shell echo $SHELL如果使用的是bash,则使用以下命令 open ~/.bash_profi…...

linux Ubuntu 更新镜像源、安装sudo、nvtop
1.更换镜像源 vi ~/.pip/pip.conf在打开的文件中输入: pip.conf [global] index-url https://pypi.tuna.tsinghua.edu.cn/simple按下:wq保存并退出。 2.安装nvtop 如果输入指令apt install nvtop报错: E: Unable to locate package nvtop 需要更新一下apt&a…...
[特殊字符] 智能合约中的数据是如何在区块链中保持一致的?
🧠 智能合约中的数据是如何在区块链中保持一致的? 为什么所有区块链节点都能得出相同结果?合约调用这么复杂,状态真能保持一致吗?本篇带你从底层视角理解“状态一致性”的真相。 一、智能合约的数据存储在哪里…...

树莓派超全系列教程文档--(61)树莓派摄像头高级使用方法
树莓派摄像头高级使用方法 配置通过调谐文件来调整相机行为 使用多个摄像头安装 libcam 和 rpicam-apps依赖关系开发包 文章来源: http://raspberry.dns8844.cn/documentation 原文网址 配置 大多数用例自动工作,无需更改相机配置。但是,一…...

【配置 YOLOX 用于按目录分类的图片数据集】
现在的图标点选越来越多,如何一步解决,采用 YOLOX 目标检测模式则可以轻松解决 要在 YOLOX 中使用按目录分类的图片数据集(每个目录代表一个类别,目录下是该类别的所有图片),你需要进行以下配置步骤&#x…...

HarmonyOS运动开发:如何用mpchart绘制运动配速图表
##鸿蒙核心技术##运动开发##Sensor Service Kit(传感器服务)# 前言 在运动类应用中,运动数据的可视化是提升用户体验的重要环节。通过直观的图表展示运动过程中的关键数据,如配速、距离、卡路里消耗等,用户可以更清晰…...
Git常用命令完全指南:从入门到精通
Git常用命令完全指南:从入门到精通 一、基础配置命令 1. 用户信息配置 # 设置全局用户名 git config --global user.name "你的名字"# 设置全局邮箱 git config --global user.email "你的邮箱example.com"# 查看所有配置 git config --list…...

基于Java+VUE+MariaDB实现(Web)仿小米商城
仿小米商城 环境安装 nodejs maven JDK11 运行 mvn clean install -DskipTestscd adminmvn spring-boot:runcd ../webmvn spring-boot:runcd ../xiaomi-store-admin-vuenpm installnpm run servecd ../xiaomi-store-vuenpm installnpm run serve 注意:运行前…...
【学习笔记】erase 删除顺序迭代器后迭代器失效的解决方案
目录 使用 erase 返回值继续迭代使用索引进行遍历 我们知道类似 vector 的顺序迭代器被删除后,迭代器会失效,因为顺序迭代器在内存中是连续存储的,元素删除后,后续元素会前移。 但一些场景中,我们又需要在执行删除操作…...

Rust 开发环境搭建
环境搭建 1、开发工具RustRover 或者vs code 2、Cygwin64 安装 https://cygwin.com/install.html 在工具终端执行: rustup toolchain install stable-x86_64-pc-windows-gnu rustup default stable-x86_64-pc-windows-gnu 2、Hello World fn main() { println…...
微服务通信安全:深入解析mTLS的原理与实践
🔥「炎码工坊」技术弹药已装填! 点击关注 → 解锁工业级干货【工具实测|项目避坑|源码燃烧指南】 一、引言:微服务时代的通信安全挑战 随着云原生和微服务架构的普及,服务间的通信安全成为系统设计的核心议题。传统的单体架构中&…...
【Kafka】Kafka从入门到实战:构建高吞吐量分布式消息系统
Kafka从入门到实战:构建高吞吐量分布式消息系统 一、Kafka概述 Apache Kafka是一个分布式流处理平台,最初由LinkedIn开发,后成为Apache顶级项目。它被设计用于高吞吐量、低延迟的消息处理,能够处理来自多个生产者的海量数据,并将这些数据实时传递给消费者。 Kafka核心特…...