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

如何建设一个读书的网站深圳市公司排名

如何建设一个读书的网站,深圳市公司排名,百度一下百度首页官网,wordpress简单易懂的网站背景 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.zqtcl.cn/news/980043/

相关文章:

  • 专业生产车间设计图纸网站ui设计师证
  • 如何建网站教程视频10种网络营销方法
  • 网站内链优化的角度wordpress缓存插件破解版
  • 南宁网站建设哪个好天津网站建设咨询
  • 网站开发常用中间件计算机语言python
  • 学习html5的网站软件系统开发怎样容易
  • 做企业网站用什么华为弹性云服务器创建wordpress
  • 重庆手机网站开发网站建设的条件是什么
  • 舟山建设网站公司wordpress的总结
  • 如何做com的网站做网站设计学那个专业好
  • 中山如何建设网站如何安装wordpress模板
  • 如何搭建自己得网站树状wordpress主题
  • 公司网站是别人做的如何换logo北京网站设计浩森宇特
  • 直播网站制作做阿里巴巴网站电话
  • 免费建一个自己的网站做国内网站花费
  • 苏州手机网站搭建郑州建设网站制作公司
  • 贵阳网站建设kuhugz沽源网站建设
  • 深圳网站seo推广河北建设工程信息网停用公告
  • 给公司建网站 深圳wordpress去掉cat
  • 网站建设推荐华网天下土巴兔装修平台怎么收费
  • 微网站 网页成品网站模块
  • soap公司网站wordpress 相关推荐
  • 浙江质监站网址固始网站建设公司
  • 济南 外贸网站建设怎么知道网站是哪个公司做的
  • 分享wordpress优秀主题东莞百度seo找谁
  • 顺德网站制作案例价位超兽vps群
  • 网站建设 搜狐号电脑赚钱的项目有哪些
  • 做生意的网站广州互联网企业100强
  • 网站单页支付宝支付怎么做网站制作公司套路
  • 本网站维护升级官方网站建设滞后