WPF实战学习笔记21-自定义首页添加对话服务

自定义首页添加对话服务

定义接口与实现

添加自定义添加对话框接口

添加文件:Mytodo.Dialog.IDialogHostAware.cs

using Prism.Commands;
using Prism.Services.Dialogs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;namespace Mytodo.Dialog
{public interface IDialogHostAware{/// <summary>/// DialoHost名称/// </summary>string DialogHostName { get; set; }/// <summary>/// 打开过程中执行/// </summary>/// <param name="parameters"></param>void OnDialogOpend(IDialogParameters parameters);/// <summary>/// 确定/// </summary>DelegateCommand SaveCommand { get; set; }/// <summary>/// 取消/// </summary>DelegateCommand CancelCommand { get; set; }}
}

添加自定义添加对话框显示接口

注意dialogHostName应与view中dialoghost 的Identifier属性一致

using Prism.Services.Dialogs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;namespace Mytodo.Dialog
{public interface  IDialogHostService:IDialogService{/// <summary>/// 显示Dialog方法/// </summary>/// <param name="name"></param>/// <param name="parameters"></param>/// <param name="dialogHostName"></param>/// <returns></returns>Task<IDialogResult> ShowDialog(string name, IDialogParameters parameters, string dialogHostName = "Root");}
}

实现IDialogHostService接口

添加文件:Mytodo.Dialog.DialogHostService.cs

DialogHostService实现了自定义的IDialogHostService接口,以及DialogService类.

DialogService:可参考https://www.cnblogs.com/chonglu/p/15159387.html

Prism提供了一组对话服务, 封装了常用的对话框组件的功能, 例如:

  • RegisterDialog/IDialogService (注册对话及使用对话)
  • 打开对话框传递参数/关闭对话框返回参数
  • 回调通知对话结果
using MaterialDesignThemes.Wpf;
using Prism.Ioc;
using Prism.Mvvm;
using Prism.Services.Dialogs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;namespace Mytodo.Dialog
{public class DialogHostService:DialogService, IDialogHostService{private readonly IContainerExtension containerExtension;public DialogHostService(IContainerExtension containerExtension) : base(containerExtension){this.containerExtension = containerExtension;}public async Task<IDialogResult> ShowDialog(string name, IDialogParameters parameters, string dialogHostName = "Root"){if (parameters == null)parameters = new DialogParameters();//从容器当中去除弹出窗口的实例var content = containerExtension.Resolve<object>(name);//验证实例的有效性 if (!(content is FrameworkElement dialogContent))throw new NullReferenceException("A dialog's content must be a FrameworkElement");if (dialogContent is FrameworkElement view && view.DataContext is null && ViewModelLocator.GetAutoWireViewModel(view) is null)ViewModelLocator.SetAutoWireViewModel(view, true);if (!(dialogContent.DataContext is IDialogHostAware viewModel))throw new NullReferenceException("A dialog's ViewModel must implement the IDialogAware interface");viewModel.DialogHostName = dialogHostName;DialogOpenedEventHandler eventHandler = (sender, eventArgs) =>{if (viewModel is IDialogHostAware aware){aware.OnDialogOpend(parameters);}eventArgs.Session.UpdateContent(content);};return (IDialogResult)await DialogHost.Show(dialogContent, viewModel.DialogHostName, eventHandler);}}
}

添加对应的窗体

添加AddMemoView

添加文件Mytodo.Views.Dialogs.AddMemoView.xaml

<UserControlx:Class="Mytodo.Views.Dialogs.AddMemoView"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:d="http://schemas.microsoft.com/expression/blend/2008"xmlns:local="clr-namespace:Mytodo.Views"xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"xmlns:md="http://materialdesigninxaml.net/winfx/xaml/themes"d:DesignHeight="450"d:DesignWidth="800"mc:Ignorable="d"><Grid Width="400"><Grid.RowDefinitions><RowDefinition Height="auto" /><RowDefinition /><RowDefinition Height="auto" /></Grid.RowDefinitions><TextBlockPadding="20,10"FontSize="20"FontWeight="Bold"Text="添加备忘录" /><DockPanel Grid.Row="1" LastChildFill="False"><TextBoxMargin="20,0"md:HintAssist.Hint="请输入备忘录概要"DockPanel.Dock="Top"Text="{Binding Model.Title}" /><TextBoxMinHeight="100"Margin="20,10"md:HintAssist.Hint="请输入备忘录内容"AcceptsReturn="True"DockPanel.Dock="Top"Text="{Binding Model.Content}"TextWrapping="Wrap" /></DockPanel><StackPanelGrid.Row="2"Margin="10"HorizontalAlignment="Right"Orientation="Horizontal"><ButtonMargin="0,0,10,0"Command="{Binding CancelCommand}"Content="取消"Style="{StaticResource MaterialDesignOutlinedButton}" /><Button Command="{Binding SaveCommand}" Content="确定" /></StackPanel></Grid>
</UserControl>

添加文件:Mytodo.Views.Dialogs.AddMemoViewmodel.cs

using MaterialDesignThemes.Wpf;
using Mytodo.Dialog;
using MyToDo.Share.Models;
using Prism.Commands;
using Prism.Mvvm;
using Prism.Services.Dialogs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;namespace Mytodo.ViewModels.Dialogs
{internal class AddMemoViewModel : BindableBase, IDialogHostAware{public AddMemoViewModel(){SaveCommand = new DelegateCommand(Save);CancelCommand = new DelegateCommand(Cancel);}private MemoDto model;public MemoDto Model{get { return model; }set { model = value; RaisePropertyChanged(); }}private void Cancel(){if (DialogHost.IsDialogOpen(DialogHostName))DialogHost.Close(DialogHostName, new DialogResult(ButtonResult.No));}private void Save(){if (string.IsNullOrWhiteSpace(Model.Title) ||string.IsNullOrWhiteSpace(model.Content)) return;if (DialogHost.IsDialogOpen(DialogHostName)){//确定时,把编辑的实体返回并且返回OKDialogParameters param = new DialogParameters();param.Add("Value", Model);DialogHost.Close(DialogHostName, new DialogResult(ButtonResult.OK, param));}}public string DialogHostName { get; set; }public DelegateCommand SaveCommand { get; set; }public DelegateCommand CancelCommand { get; set; }public void OnDialogOpend(IDialogParameters parameters){if (parameters.ContainsKey("Value")){Model = parameters.GetValue<MemoDto>("Value");}elseModel = new MemoDto();}}
}

添加AddTodoView

添加文件Mytodo.Views.Dialogs.AddtodoView.xaml

<UserControlx:Class="Mytodo.Views.TodoView"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:cv="clr-namespace:Mytodo.Common.Converters"xmlns:d="http://schemas.microsoft.com/expression/blend/2008"xmlns:i="http://schemas.microsoft.com/xaml/behaviors"xmlns:local="clr-namespace:Mytodo.Views"xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"xmlns:md="http://materialdesigninxaml.net/winfx/xaml/themes"d:DesignHeight="450"d:DesignWidth="800"mc:Ignorable="d"><UserControl.Resources><ResourceDictionary><cv:IntToVisibilityConveter x:Key="IntToVisility" /></ResourceDictionary></UserControl.Resources><md:DialogHost><md:DrawerHost IsRightDrawerOpen="{Binding IsRightOpen}"><md:DrawerHost.RightDrawerContent><DockPanelMinWidth="200"MaxWidth="240"Margin="2"LastChildFill="False"><TextBlockMargin="10"DockPanel.Dock="Top"FontFamily="微软雅黑"FontSize="20"FontWeight="Bold"Text="{Binding RightContentTitle}" /><StackPanelMargin="10"DockPanel.Dock="Top"Orientation="Horizontal"><TextBlockMargin="5"VerticalAlignment="Center"FontFamily="微软雅黑"FontSize="14"Text="状态" /><ComboBox Margin="5" SelectedIndex="{Binding CurrDto.Status}"><ComboBoxItem Content="已完成" FontSize="12" /><ComboBoxItem Content="未完成" FontSize="12" /></ComboBox></StackPanel><TextBoxMargin="10"md:HintAssist.Hint="待办事项标题"DockPanel.Dock="Top"FontFamily="微软雅黑"FontSize="12"Text="{Binding CurrDto.Title}" /><TextBoxMinHeight="50"Margin="10"md:HintAssist.Hint="待办事项内容"DockPanel.Dock="Top"FontFamily="微软雅黑"FontSize="12"Text="{Binding CurrDto.Content}"TextWrapping="Wrap" /><ButtonMargin="10,5"HorizontalAlignment="Center"Command="{Binding ExecuteCommand}"CommandParameter="保存"Content="保存"DockPanel.Dock="Top" /></DockPanel></md:DrawerHost.RightDrawerContent><Grid><Grid.RowDefinitions><RowDefinition Height="auto" /><RowDefinition /></Grid.RowDefinitions><StackPanel Margin="15,10" Orientation="Horizontal"><TextBoxWidth="200"md:HintAssist.Hint="查找待办事项"md:TextFieldAssist.HasClearButton="True"FontFamily="微软雅黑"FontSize="14"Text="{Binding SearchString, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"><TextBox.InputBindings><KeyBindingKey="Enter"Command="{Binding ExecuteCommand}"CommandParameter="查询" /></TextBox.InputBindings></TextBox><TextBlockMargin="10"FontSize="14"Text="筛选" /><ComboBoxWidth="auto"MinWidth="30"FontFamily="微软雅黑"FontSize="14"SelectedIndex="{Binding SelectIndex}"><ComboBoxItem Content="全部" /><ComboBoxItem Content="已完成" /><ComboBoxItem Content="未完成" /></ComboBox></StackPanel><ButtonMargin="10,0"HorizontalAlignment="Right"Command="{Binding ExecuteCommand}"CommandParameter="添加"Content="+ 添加到待办"FontFamily="微软雅黑"FontSize="14" /><StackPanelGrid.Row="1"VerticalAlignment="Center"Visibility="{Binding TodoDtos.Count, Converter={StaticResource IntToVisility}}"><md:PackIconWidth="120"Height="120"HorizontalAlignment="Center"Kind="ClipboardText" /><TextBlockMargin="0,10"HorizontalAlignment="Center"FontSize="18"Text="尝试添加一些待办事项,以便在此处查看它们。" /></StackPanel><ItemsControlGrid.Row="1"Margin="10"ItemsSource="{Binding TodoDtos}"><ItemsControl.ItemsPanel><ItemsPanelTemplate><WrapPanel /></ItemsPanelTemplate></ItemsControl.ItemsPanel><ItemsControl.ItemTemplate><DataTemplate><Border MinWidth="200" Margin="10"><Border.Style><Style TargetType="Border"><Style.Triggers><DataTrigger Binding="{Binding Status}" Value="0"><Setter Property="Background" Value="#1E90FF" /></DataTrigger><DataTrigger Binding="{Binding Status}" Value="1"><Setter Property="Background" Value="#3CB371" /></DataTrigger></Style.Triggers></Style></Border.Style><Grid MinHeight="150"><!--  给项目添加行为  --><i:Interaction.Triggers><i:EventTrigger EventName="MouseLeftButtonUp"><i:InvokeCommandAction Command="{Binding DataContext.SelectedCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}" CommandParameter="{Binding}" /></i:EventTrigger></i:Interaction.Triggers><Grid.RowDefinitions><RowDefinition Height="auto" /><RowDefinition /></Grid.RowDefinitions><DockPanel Panel.ZIndex="2" LastChildFill="False"><TextBlockMargin="10,10"FontFamily="黑体"FontSize="14"Text="{Binding Title}" /><!--<md:PackIconMargin="10,10"VerticalContentAlignment="Top"DockPanel.Dock="Right"Kind="More" />--><md:PopupBoxMargin="5"Panel.ZIndex="1"DockPanel.Dock="Right"><ButtonPanel.ZIndex="2"Command="{Binding DataContext.DeleteCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}"CommandParameter="{Binding}"Content="删除" /></md:PopupBox></DockPanel><TextBlockGrid.Row="1"Margin="10,5"FontFamily="黑体"FontSize="12"Opacity="0.7"Text="{Binding Content}" /><Canvas Grid.RowSpan="2" ClipToBounds="True"><BorderCanvas.Top="10"Canvas.Right="-50"Width="120"Height="120"Background="#FFFFFF"CornerRadius="100"Opacity="0.1" /><BorderCanvas.Top="80"Canvas.Right="-30"Width="120"Height="120"Background="#FFFFFF"CornerRadius="100"Opacity="0.1" /></Canvas><BorderGrid.RowSpan="2"Background="#ffcccc"CornerRadius="5"Opacity="0.3" /></Grid></Border></DataTemplate></ItemsControl.ItemTemplate></ItemsControl></Grid></md:DrawerHost></md:DialogHost>
</UserControl>

添加文件:Mytodo.Views.Dialogs.AddTodoViewmodel.cs

using Mytodo.Common.Models;
using Mytodo.Service;
using Prism.Commands;
using Prism.Ioc;
using Prism.Mvvm;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using MyToDo.Share.Models;
using System.Threading.Tasks;
using Prism.Regions;
using System.Windows;namespace Mytodo.ViewModels
{public class TodoViewModel: NavigationViewModel{#region 命令定义/// <summary>/// 展开侧边栏/// </summary>public DelegateCommand OpenRightContentCmd { set; get; }/// <summary>/// 打开选择的项/// </summary>public DelegateCommand<ToDoDto> SelectedCommand { get; set; }/// <summary>/// 添加、编辑 项/// </summary>public DelegateCommand<string> ExecuteCommand { get; set; }/// <summary>/// 删除项/// </summary>public DelegateCommand<ToDoDto> DeleteCommand { get; set; }#endregion#region 属性定义/// <summary>/// 项目状态/// </summary>public int SelectIndex{get { return selectIndex; }set { selectIndex = value; RaisePropertyChanged(); }}/// <summary>/// 当前选中项/// </summary>public ToDoDto? CurrDto{get { return currDto; }set { currDto = value; RaisePropertyChanged(); }}/// <summary>/// 指示侧边栏是否展开/// </summary>public bool IsRightOpen{get { return isRightOpen; }set { isRightOpen = value; RaisePropertyChanged(); }}/// <summary>/// todo集合/// </summary>public ObservableCollection<ToDoDto>? TodoDtos{get { return todoDtos; }set { todoDtos = value; RaisePropertyChanged(); }}/// <summary>/// 右侧侧边栏标题/// </summary>public string RightContentTitle{get { return rightContentTitle; }set { rightContentTitle = value;RaisePropertyChanged(); }}/// <summary>/// 要搜索的字符串/// </summary>public string SearchString{get { return search; }set { search = value; RaisePropertyChanged(); }}#endregion#region 重要字段定义private readonly ITodoService service;#endregion#region 字段定义private int selectIndex;private ToDoDto currDto;private bool isRightOpen;private ObservableCollection<ToDoDto>? todoDtos;private string rightContentTitle;private string search;#endregion#region 命令方法/// <summary>/// 删除指定项/// </summary>/// <param name="dto"></param>async private void DeleteItem(ToDoDto dto){var delres = await service.DeleteAsync(dto.Id);if (delres.Status){var model = TodoDtos.FirstOrDefault(t => t.Id.Equals(dto.Id));TodoDtos.Remove(dto);}}private void ExceuteCmd(string obj){switch (obj){case "添加":Add(); break;case "查询":Query();break;case "保存":Save(); break;}}/// <summary>/// 保存消息/// </summary>private async void Save(){try{if (string.IsNullOrWhiteSpace(CurrDto.Title) || string.IsNullOrWhiteSpace(CurrDto.Content))return;UpdateLoding(true);if(CurrDto.Id>0) //编辑项{var updateres = await service.UpdateAsync(CurrDto);if (updateres.Status){UpdateDataAsync();}else{MessageBox.Show("更新失败");}}else{       //添加项var add_res =   await service.AddAsync(CurrDto);//刷新if (add_res.Status) //如果添加成功{TodoDtos.Add(add_res.Result);}else{MessageBox.Show("添加失败");}}}catch{}finally{IsRightOpen = false;//卸载数据加载窗体UpdateLoding(false);}}/// <summary>/// 打开待办事项弹窗/// </summary>void Add(){CurrDto = new ToDoDto();IsRightOpen = true;}private void Query(){GetDataAsync();}/// <summary>/// 根据条件更新数据/// </summary>async void UpdateDataAsync(){int? Status = SelectIndex == 0 ? null : SelectIndex == 2 ? 1 : 0;var todoResult = await service.GetAllFilterAsync(new MyToDo.Share.Parameters.TodoParameter { PageIndex = 0, PageSize = 100, Search = SearchString, Status = Status });if (todoResult.Status){todoDtos.Clear();foreach (var item in todoResult.Result.Items)todoDtos.Add(item);}}/// <summary>/// 获取所有数据/// </summary>async void GetDataAsync(){//调用数据加载页面UpdateLoding(true);//更新数据UpdateDataAsync();//卸载数据加载页面UpdateLoding(false);}/// <summary>/// 弹出详细信息/// </summary>/// <param name="obj"></param>private async void Selected(ToDoDto obj){var todores = await service.GetFirstOfDefaultAsync(obj.Id);if(todores.Status){CurrDto = todores.Result;IsRightOpen = true;RightContentTitle = "我的待办";}}#endregionpublic TodoViewModel(ITodoService service,IContainerProvider provider) : base(provider){//初始化对象TodoDtos = new ObservableCollection<ToDoDto>();  RightContentTitle = "添加血雨待办";//初始化命令SelectedCommand         = new DelegateCommand<ToDoDto>(Selected);OpenRightContentCmd     = new DelegateCommand(Add);ExecuteCommand          = new DelegateCommand<string>(ExceuteCmd);DeleteCommand           = new DelegateCommand<ToDoDto>(DeleteItem);this.service = service;}public override void OnNavigatedTo(NavigationContext navigationContext){base.OnNavigatedTo(navigationContext);GetDataAsync();}}
}

修改绑定

修改文件:"Mytodo.Views.IndexView.xaml

Background="{Binding Color}"
CornerRadius="5"
Opacity="0.9">
<Border.Style><ButtonWidth="30"Height="30"Margin="10"VerticalAlignment="Top"Command="{Binding ExecuteCommand}"CommandParameter="新增待办"Content="{materialDesign:PackIcon Kind=Add}"DockPanel.Dock="Right"Style="{StaticResource MaterialDesignFloatingActionAccentButton}" /><ButtonWidth="30"Height="30"Margin="10"VerticalAlignment="Top"Command="{Binding ExecuteCommand}"CommandParameter="新增备忘"Content="{materialDesign:PackIcon Kind=Add}"DockPanel.Dock="Right"Style="{StaticResource MaterialDesignFloatingActionAccentButton}" />

依赖注入

修改文件:Mytodo.App.xmal.cs

protected override void RegisterTypes(IContainerRegistry containerRegistry)
{//注册服务containerRegistry.GetContainer().Register<HttpRestClient>(made: Parameters.Of.Type<string>(serviceKey: "webUrl"));containerRegistry.GetContainer().RegisterInstance(@"Http://localhost:19007/", serviceKey: "webUrl");containerRegistry.Register<ITodoService, TodoService>();containerRegistry.Register<IMemoService, MemoService>();containerRegistry.Register<IDialogHostService, DialogHostService>();//注册对话框containerRegistry.RegisterForNavigation<AddTodoView,AddTodoViewModel>();containerRegistry.RegisterForNavigation<AddMemoView,AddMemoViewModel>();containerRegistry.RegisterForNavigation<AboutView, AboutViewModel>();containerRegistry.RegisterForNavigation<SysSetView, SysSetViewModel>();containerRegistry.RegisterForNavigation<SkinView, SkinViewModel>();containerRegistry.RegisterForNavigation<IndexView, IndexViewModel>();containerRegistry.RegisterForNavigation<TodoView, TodoViewModel>();containerRegistry.RegisterForNavigation<MemoView, MemoViewModel>();containerRegistry.RegisterForNavigation<SettingsView, SettingsViewModel>();
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/15656.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

css 定位优先级

在 CSS 中&#xff0c;有三种常见的定位方式&#xff1a;static&#xff08;静态定位&#xff09;、relative&#xff08;相对定位&#xff09;和absolute&#xff08;绝对定位&#xff09;。它们之间的优先级如下&#xff1a; absolute >relative >static也就是说&…

Windows驱动开发

开发Windows驱动程序时&#xff0c;debug比较困难&#xff0c;并且程序容易导致系统崩溃&#xff0c;这时可以使用Virtual Box进行程序调试&#xff0c;用WinDbg在主机上进行调试。 需要使用的工具&#xff1a; Virtual Box&#xff1a;用于安装虚拟机系统&#xff0c;用于运…

Github Copilot在JetBrains软件中登录Github失败的解决方案

背景 我在成功通过了Github Copilot的学生认证之后&#xff0c;在VS Code和PyCharm中安装了Github Copilot插件&#xff0c;但在PyCharm中插件出现了问题&#xff0c;在登录Github时会一直Retrieving Github Device Code&#xff0c;最终登录失败。 我尝试了网上修改DNS&…

PLC1200使用CB1241RS485通讯模块做从站进行Modbus Rtu通信

1、接口及协议 通信接口&#xff1a;RS485 数据位&#xff1a;8个 奇偶校验位&#xff1a;无 停止位&#xff1a;1个 波特率&#xff1a;9600 输出编码格式&#xff1a;ModbusRTU 2、设备组态 添加新设备&#xff08;PLC&#xff09;->设备和网络管理->点击PLC-&…

音频转文字软件免费版让你快速完成转换

音频转文字技术是一种将音频文件转换为文本形式的技术&#xff0c;它可以帮助人们更方便地获取和处理音频信息。在实际生活和工作中&#xff0c;我们可能会遇到需要将音频转换为文字的情况&#xff0c;比如听取会议录音、收听讲座、学习外语等等。那么&#xff0c;你知道音频转…

计算机网络——传输层

文章目录 **1 传输层提供的服务****1.1 传输层的功能****1.2 传输层的寻址与端口** **2 UDP协议****2.1 UDP数据报****2.2 UDP校验** **3 TCP协议****3.1 TCP协议的特点****3.2 TCP报文段****3.3 TCP连接管理****3.4 TCP可靠传输****3.5 TCP流量控制****3.6 TCP拥塞控制** 1 传…

向上取整再分析

先看两个简单的数学问题&#xff1a; 一个青蛙跳跃一次的长度为3&#xff0c;现在它垂直于马路方向要跳跃整条马路。假定马路的宽为x长&#xff1f; 问&#xff1a;它最少需要跳跃几次能够完全跳过这条马路&#xff1f; 一个房间可以住6个人&#xff0c;现在来了一群人&#x…

八、用 ChatGPT 帮助排查生产事故

目录 一、实验介绍 二、背景 三、故障排查概述 3.1 生产环境故障排查涉及的角色

07mysql查询语句之子查询

#1.查询和Zlotkey相同部门的员工姓名和工资 SELECT last_name,salary FROM employees WHERE department_id IN ( SELECT department_id FROM employees WHERE last_name Zlotkey ); #2.查询工资比公司平均工资高的员工的员工号&#xff0…

某拍房数据采集

某拍房数据采集 某拍房数据采集声明1.逆向目标2.寻找加密位置3.分析加密参数4.python代码书写 某拍房数据采集 声明 本文章中所有内容仅供学习交流&#xff0c;抓包内容、敏感网址、数据接口均已做脱敏处理&#xff0c;严禁用于商业用途和非法用途&#xff0c;否则由此产生的…

flask创建数据库连接池

flask创建数据库连接池 在Python中&#xff0c;您可以使用 Flask-SQLAlchemy 这个扩展来创建一个数据库连接池。Flask-SQLAlchemy 是一个用于 Flask 框架的 SQLAlchemy 操作封装&#xff0c;实现了 ORM(Object Relational Mapper)。ORM 主要用于将类与数据库中的表建立映射关系…

接口自动化测试-Jmeter+ant+jenkins实战持续集成(详细)

目录&#xff1a;导读 前言一、Python编程入门到精通二、接口自动化项目实战三、Web自动化项目实战四、App自动化项目实战五、一线大厂简历六、测试开发DevOps体系七、常用自动化测试工具八、JMeter性能测试九、总结&#xff08;尾部小惊喜&#xff09; 前言 1、下载安装配置J…

uniapp实现带参数二维码

view <view class"canvas"><!-- 二维码插件 width height设置宽高 --><canvas canvas-id"qrcode" :style"{width: ${qrcodeSize}px, height: ${qrcodeSize}px}" /></view> script import uQRCode from /utils/uqrcod…

Stable-Diffusion-Webui部署SDXL0.9报错参数shape不匹配解决

问题 已经在model/stable-diffusion文件夹下放进去了sdxl0.9的safetensor文件&#xff0c;但是在切换model的时候&#xff0c;会报错model的shape不一致。 解决方法 git pullupdate一些web-ui项目就可以&#xff0c;因为当前项目太老了&#xff0c;没有使用最新的版本。

Kubernetes集群管理 —追踪 Kubernetes 系统组件、代理

一、追踪 Kubernetes 系统组件 特性状态&#xff1a; Kubernetes v1.27 [beta] 系统组件追踪功能记录各个集群操作的时延信息和这些操作之间的关系。 Kubernetes 组件基于 gRPC 导出器的 OpenTelemetry 协议 发送追踪信息&#xff0c;并用 OpenTelemetry Collector 收集追踪…

【【51单片机AD/DA的分析】】

51单片机AD/DA的分析 看似单片机实验&#xff0c;其实是要学好数电 模数转换 与 数模转换 运算放大器 DA的转换就是利用运算放大器实现的 输出电压v0-(D7~D0)/256 x (VrefxRfb)/R D7~D0 就是我们控制的按键看输入多少 然后再划分256份 Vref是我们设置的一个基准电压 PWM 这种…

用牛鲨水豚赚取SUI的机会又来喽,500万SUI奖励等你来领!

刚刚结束的第一轮Bullshark Quest真是一次惊心动魄的体验&#xff01;我们非常感激社区成员的积极参与以及对Sui生态系统的关注。此轮获奖者的奖励已于美国时间2023年7月28日&#xff0c;在Quest门户网站上公布。参与者点击“Claim”即可将奖励领取至Sui钱包。请注意&#xff0…

Opencv Win10+Qt+Cmake 开发环境搭建

文章目录 一.Opencv安装二.Qt搭建opencv开发环境 一.Opencv安装 官网下载Opencv安装包 双击下载的软件进行解压 3. 系统环境变量添加 二.Qt搭建opencv开发环境 创建一个新的Qt项目(Non-Qt Project) 打开创建好的项目中的CMakeLists.txt&#xff0c;添加如下代码 # openc…

TC3XX - MCAL知识点(十三):IOM EB-tresos配置说明及代码浅析

目录 1、概述 2、EB-tresos配置 2.1、配置目标 2.2、Port配置 2.3、SMU配置 2.3.1、SmuCoreAlarmGlobalConfig

neo4j教程-Cypher操作

Cypher基础操作 Cypher是图形存储数据库Neo4j的查询语言&#xff0c;Cypher是通过模式匹配Neo4j数据库中的节点和关系&#xff0c;从而对数据库Neo4j中的节点和关系进行一系列的相关操作。 下面&#xff0c;通过一张表来介绍一下常用的Neo4j操作命令及相关说明&#xff0c;具…