当前位置: 首页 > news >正文

选择邯郸网站制作wordpress会员推广系统

选择邯郸网站制作,wordpress会员推广系统,it网站制作策划,网站制作公司代理背景 MVVM 是一种软件架构模式#xff0c;用于创建用户界面。它将用户界面#xff08;View#xff09;、业务逻辑#xff08;ViewModel#xff09;和数据模型#xff08;Model#xff09;分离开来#xff0c;以提高代码的可维护性和可测试性。 MainWindow 类是 View用于创建用户界面。它将用户界面View、业务逻辑ViewModel和数据模型Model分离开来以提高代码的可维护性和可测试性。 MainWindow 类是 View视图负责用户界面的呈现和交互它是用户直接看到和操作的部分。 LoginVM 类是 ViewModel视图模型它充当了 View 和 Model 之间的中介处理了视图与数据模型之间的交互逻辑以及用户操作的响应逻辑。 LoginModel 类是 Model模型它包含了应用程序的数据和业务逻辑用于存储和处理用户的身份验证信息。 展示 代码 LoginModel.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;namespace WpfApp2 {public class LoginModel{private string _UserName;public string UserName{get { return _UserName; }set{_UserName value;}}private string _Password;public string Password{get { return _Password; }set{_Password value;}}} } LoginVM.cs using Sys tem; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Input;namespace WpfApp2 {public class LoginVM : INotifyPropertyChanged{private MainWindow _main;public LoginVM(MainWindow main){_main main;}public event PropertyChangedEventHandler PropertyChanged;private void RaisePropetyChanged(string propertyName){PropertyChangedEventHandler handler PropertyChanged;if (handler ! null){handler(this, new PropertyChangedEventArgs(propertyName));}}private LoginModel _LoginM new LoginModel();public string UserName{get { return _LoginM.UserName; }set{_LoginM.UserName value;RaisePropetyChanged(UserName);}}public string Password{get { return _LoginM.Password; }set{_LoginM.Password value;RaisePropetyChanged(Password);}}/// summary/// 登录方法/// /summaryvoid Loginfunc(){if (UserName wpf Password 666){MessageBox.Show(OK);Index index new Index();index.Show();//想办法拿到mainwindow_main.Hide();}else{MessageBox.Show(输入的用户名或密码不正确);UserName ;Password ;}}bool CanLoginExecute(){return true;}public ICommand LoginAction{get{return new RelayCommand(Loginfunc,CanLoginExecute);}}} } MainWindow.xaml Window x:ClassWpfApp2.MainWindowxmlnshttp://schemas.microsoft.com/winfx/2006/xaml/presentationxmlns:xhttp://schemas.microsoft.com/winfx/2006/xamlxmlns:dhttp://schemas.microsoft.com/expression/blend/2008xmlns:mchttp://schemas.openxmlformats.org/markup-compatibility/2006xmlns:localclr-namespace:WpfApp2mc:IgnorabledTitleMainWindow Height450 Width800GridGrid.RowDefinitionsRowDefinition Heightauto/RowDefinitionRowDefinition Heightauto/RowDefinitionRowDefinition Height1*/RowDefinitionRowDefinition Height9*/RowDefinition/Grid.RowDefinitionsTextBlock Grid.Row0 Grid.Column0 Text上海市-市图书馆 FontSize18 HorizontalAlignmentCenter/TextBlockStackPanel Grid.Row1 Grid.Column0 Background#0078d4TextBlock Text登录 FontSize22 HorizontalAlignmentCenter ForegroundWheat Margin5/TextBlock /StackPanelGrid Grid.Row3 ShowGridLinesFalse HorizontalAlignmentCenterGrid.RowDefinitionsRowDefinition Height30/RowDefinitionRowDefinition Height30/RowDefinitionRowDefinition Height30/RowDefinitionRowDefinition Height30/RowDefinition/Grid.RowDefinitionsGrid.ColumnDefinitions ColumnDefinition Widthauto/ColumnDefinitionColumnDefinition Width200/ColumnDefinition/Grid.ColumnDefinitionsTextBlock Text用户名 Grid.Row0 Grid.Column0 VerticalAlignmentCenter/TextBlockTextBox Text{Binding UserName} Grid.Row0 Grid.Column1 Margin2 /TextBoxTextBlock Text密码 Grid.Row1 Grid.Column0 VerticalAlignmentCenter/TextBlockTextBox Text{Binding Password} Grid.Row1 Grid.Column1 Margin2/TextBoxCheckBox Grid.ColumnSpan2 Content记住密码 Grid.Row2/CheckBoxlocal:CustomButton ButtonCornerRadius5 BackgroundHoverRed BackgroundPressedGreen Foreground#FFFFFF Background#3C7FF8 Grid.Row3 Grid.Column0 Grid.ColumnSpan2 Command{Binding LoginAction} Height30 VerticalAlignmentTop登录/local:CustomButton/Grid/Grid /Window MainWindow.xaml.cs using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes;namespace WpfApp2 {/// summary/// MainWindow.xaml 的交互逻辑/// /summarypublic partial class MainWindow : Window{LoginVM loginVM;public MainWindow(){InitializeComponent();loginVM new LoginVM(this);this.DataContext loginVM;}} } RelayCommand.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Input;namespace WpfApp2 {public class RelayCommand : ICommand{/// summary/// 命令是否能够执行/// /summaryreadonly Funcbool _canExecute;/// summary/// 命令需要执行的方法/// /summaryreadonly Action _exexute;public RelayCommand(Action exexute,Funcbool canExecute){_canExecute canExecute;_exexute exexute;}public bool CanExecute(object parameter){if (_canExecute null){return true;}return _canExecute();}public void Execute(object parameter){_exexute();}public event EventHandler CanExecuteChanged{add {if (_canExecute ! null){CommandManager.RequerySuggested value;}}remove{if (_canExecute ! null){CommandManager.RequerySuggested - value;}}}} } 自定义按钮CustomButton App.xaml.cs Application x:ClassWpfApp2.Appxmlnshttp://schemas.microsoft.com/winfx/2006/xaml/presentationxmlns:xhttp://schemas.microsoft.com/winfx/2006/xamlxmlns:localclr-namespace:WpfApp2StartupUriMainWindow.xamlApplication.ResourcesResourceDictionaryResourceDictionary.MergedDictionariesResourceDictionary SourceCustomButtonStyles.xaml/ResourceDictionary/ResourceDictionary.MergedDictionaries/ResourceDictionary/Application.Resources /Application CustomButton.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Media;namespace WpfApp2 {public class CustomButton:Button{//依赖属性public CornerRadius ButtonCornerRadius{get { return (CornerRadius)GetValue(ButtonCornerRadiusProperty); }set { SetValue(ButtonCornerRadiusProperty, value); }}// Using a DependencyProperty as the backing store for ButtonCornerRadius. This enables animation, styling, binding, etc...public static readonly DependencyProperty ButtonCornerRadiusProperty DependencyProperty.Register(ButtonCornerRadius, typeof(CornerRadius), typeof(CustomButton));public Brush BackgroundHover{get { return (Brush)GetValue(BackgroundHoverProperty); }set { SetValue(BackgroundHoverProperty, value); }}// Using a DependencyProperty as the backing store for BackgroundHover. This enables animation, styling, binding, etc...public static readonly DependencyProperty BackgroundHoverProperty DependencyProperty.Register(BackgroundHover, typeof(Brush), typeof(CustomButton));public Brush BackgroundPressed{get { return (Brush)GetValue(BackgroundPressedProperty); }set { SetValue(BackgroundPressedProperty, value); }}// Using a DependencyProperty as the backing store for BackgroundPressed. This enables animation, styling, binding, etc...public static readonly DependencyProperty BackgroundPressedProperty DependencyProperty.Register(BackgroundPressed, typeof(Brush), typeof(CustomButton));} } 数据字典 CustombuttonStyles.xaml ResourceDictionary xmlnshttp://schemas.microsoft.com/winfx/2006/xaml/presentationxmlns:xhttp://schemas.microsoft.com/winfx/2006/xamlxmlns:bbclr-namespace:WpfApp2Style TargetType{x:Type bb:CustomButton}Setter PropertyTemplateSetter.ValueControlTemplate TargetType{x:Type bb:CustomButton}Border x:NamebuttonBorder Background{TemplateBinding Background} CornerRadius{TemplateBinding ButtonCornerRadius}TextBlock Text{TemplateBinding Content} HorizontalAlignment{TemplateBinding HorizontalContentAlignment} VerticalAlignment{TemplateBinding VerticalContentAlignment}/TextBlock/Border!--触发器--ControlTemplate.TriggersTrigger PropertyIsMouseOver ValueTrueSetter TargetNamebuttonBorder PropertyBackground Value{Binding BackgroundHover,RelativeSource{RelativeSource TemplatedParent}}/Setter/TriggerTrigger PropertyIsPressed ValueTrueSetter TargetNamebuttonBorder PropertyBackground Value{Binding BackgroundPressed,RelativeSource{RelativeSource TemplatedParent}}/Setter/Trigger/ControlTemplate.Triggers/ControlTemplate/Setter.Value/Setter/Style /ResourceDictionary
http://www.dnsts.com.cn/news/186635.html

相关文章:

  • 17zwd一起做业网站搭建手机网站
  • 一站式做网站企业怎么 从头开始建设一个网站
  • 行业外贸网站建设网站建设是否包含等保
  • 帮人做淘宝网站骗钱南通哪里学网站建设
  • 邢台规划局网站建设好口碑自适应网站建设
  • 建网站要注意的细节企业网站建设流程步骤
  • 华企在线网站建设南宁哪里做网站
  • 主题公园网站建设免费行情软件网站大全网页版
  • 网站上线要准备什么做视频网站注意什么
  • 网站主持如何做网上销售网站
  • 网站安全检测android studio安装教程
  • 成都网站建设939上海网页制作报价
  • 网站互动推广wordpress 图片样式
  • 德州极速网站建设网络游戏公司排行榜前十名
  • 淮安淮阴网站建设建设vip视频解析网站违法吗
  • 汕头网站排名优化报价组织部信息化建设官方网站
  • 零基础建设网站视频教程网站建设制作开发 小程序开发定制 软件系统开发
  • 优化网站哪家好新媒体营销案例ppt
  • 建设网站分析报告海南平台网站建设平台
  • 土巴兔网站开发技术中国空间站机械臂
  • 深圳做网站的网络网站架构包含哪几个部分
  • 电子商务网站建设与管理总结godaddy的wordpress
  • 江苏双楼建设集团有限公司网站修改wordpress页脚信息
  • 苏州建筑行业网站建设一流的网站建设流程
  • 视频网站开发要求网站维护与建设实训心得
  • 淘宝客搜索网站怎么做上海的公司都有哪些
  • 后盾网原创实战网站建设教程洛阳网站制作公司
  • 自己在哪里做网站怎么能将网站做的不简单
  • 使用ftp软件连接到网站空间网上哪个购物平台最值得信赖
  • 那个可以做棋牌网站wordpress降版本