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

网站公司重庆整站seo

网站公司,重庆整站seo,wordpress中文文档下载,北京中国建设部网站首页因为审美的不同#xff0c;就总有些奇奇怪怪的需求#xff0c;使用框架自带的对话框已经无法满足了#xff0c;这里记录一下我这边初步设计的对话框。别问为啥要用模板嵌套Page来做对话框#xff0c;问就是不想写太多的窗体。。。。 模板窗体#xff08;XAML#xff09;…因为审美的不同就总有些奇奇怪怪的需求使用框架自带的对话框已经无法满足了这里记录一下我这边初步设计的对话框。别问为啥要用模板嵌套Page来做对话框问就是不想写太多的窗体。。。。 模板窗体XAML Window x:Class换成自己的程序集.DialogModelxmlnshttp://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:SCADAmc:IgnorabledWindowStyleNoneWindowStartupLocationCenterScreenAllowsTransparencyTrueBackground#060931ForegroundWhiteTitleDialogModel Height450 Width600Window.ResourcesStyle TargetTypeDockPanel x:KeyDockPanelSetter PropertyBackground Setter.ValueImageBrush ImageSource/Images/top.png//Setter.Value/Setter/StyleStyle TargetTypeStackPanel x:KeyStackPanelSetter PropertyBackground Setter.ValueImageBrush ImageSource/Images/tb_1.png//Setter.Value/Setter/StyleStyle TargetTypeButton x:KeyButtonSetter PropertyBackground Setter.ValueImageBrush ImageSource/Images/btn1.png//Setter.Value/SetterSetter PropertyBorderThickness Value0/Setter PropertyBorderBrush ValueTransparent/Setter PropertyForeground ValueWhite//Style/Window.ResourcesGrid x:NameMyDialogGrid.RowDefinitionsRowDefinition Heightauto/RowDefinition/RowDefinition Heightauto//Grid.RowDefinitions!--头部--DockPanel x:NameTOP Style{StaticResource DockPanel} VerticalAlignmentCenter Height60 Margin0TextBlock Text{Binding DialogTitle} ForegroundWhite FontSize20 VerticalAlignmentCenter Margin20 0 0 0/WrapPanel VerticalAlignmentCenter HorizontalAlignmentRightButton Height20 Margin5 0 5 0 Width20 Padding0 BackgroundTransparent BorderBrushTransparent ForegroundWhite x:NamebtnMin Content— /Button Height20 Margin5 0 5 0 Width20 Padding0 BackgroundTransparent BorderBrushTransparent ForegroundWhite x:NamebtnMax Content❐ /Button Height20 Margin5 0 5 0 Width20 Padding0 BackgroundTransparent BorderBrushTransparent ForegroundWhite x:NamebtnClose Content╳//WrapPanel/DockPanel!--内容--Frame x:NameMainFrame Content{Binding CurrentPage} Grid.Row1 NavigationUIVisibilityHidden BorderThickness0/StackPanel Grid.Row2 Style{StaticResource StackPanel} Visibility{Binding ISVisible}WrapPanel HorizontalAlignmentRight Button Style{StaticResource Button} Margin 0 10 20 10 ClickConfirm Height40 Width120 Content确定 /Button Style{StaticResource Button} Margin 0 10 10 10 Height40 Width120 ClickCancel Content取消 //WrapPanel/StackPanel/Grid /Window 模板窗体cs /// summary /// DialogModel.xaml 的交互逻辑 /// /summary public partial class DialogModel : Window, INotifyPropertyChanged {public event PropertyChangedEventHandler PropertyChanged;/// summary/// 消息通知方法/// /summary/// param namepropertyname/parampublic void OnPropertyChanged([CallerMemberName] string propertyname ){PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyname));}public DialogModel(Page page, string title,string Visible Visible){InitializeComponent();DataContext this;ISVisible Visible;CurrentPage page;DialogTitle title;btnMin.Click (s, e) { this.WindowState WindowState.Minimized; };btnMax.Click (s, e) {if (this.WindowState WindowState.Maximized)this.WindowState WindowState.Normal;else{this.ResizeMode ResizeMode.NoResize;this.WindowState WindowState.Maximized;}};btnClose.Click (s, e) { this.Close(); };TOP.MouseMove (s, e) {if (e.LeftButton MouseButtonState.Pressed){this.DragMove();}};}#region 字段属性private string title;/// summary/// 对话框标题/// /summarypublic string DialogTitle{get { return title; }set{title value; OnPropertyChanged();}}private Page currentpage;public Page CurrentPage{get { return currentpage; }set{currentpage value; OnPropertyChanged();}}private string visible;/// summary/// 是否显示确认取消按钮组,Visible-显示Collapsed隐藏/// /summarypublic string ISVisible{get { return visible; }set{visible value; OnPropertyChanged();}}#endregion/// summary/// 确认方法此处未返回值是因为主要内容都在Page里面。业务逻辑都在Page中。你也可以放置在此处具体如何传值得靠你自己/// /summaryprivate void Confirm(object sender, RoutedEventArgs e){this.DialogResult true;this.Close();}/// summary/// 取消方法/// /summaryprivate void Cancel(object sender, RoutedEventArgs e){this.Close();} } PageXAML,引用了materialDesign库没有的话用你自己定义的page就好 Page x:Class*****.Pages.Userxmlnshttp://schemas.microsoft.com/winfx/2006/xaml/presentationxmlns:xhttp://schemas.microsoft.com/winfx/2006/xamlxmlns:mchttp://schemas.openxmlformats.org/markup-compatibility/2006 xmlns:dhttp://schemas.microsoft.com/expression/blend/2008 xmlns:localclr-namespace:SCADA.Pagesxmlns:materialDesignhttp://materialdesigninxaml.net/winfx/xaml/themesmc:Ignorabled ForegroundWhited:DesignHeight450 d:DesignWidth400TitleUserPage.ResourcesStyle TargetTypeGrid x:KeyGridSetter PropertyBackgroundSetter.ValueImageBrush ImageSource/Images/tb_1.png//Setter.Value/Setter/Style/Page.ResourcesGrid Style{StaticResource Grid}StackPanel Margin16 Width300 HorizontalAlignmentCenter VerticalAlignmentCenterTextBox Margin10 Text{Binding UserName}materialDesign:HintAssist.HintUserName/TextBox Margin10 Text{Binding Account}materialDesign:HintAssist.HintAccount/TextBox Margin10 Text{Binding PassWord}materialDesign:HintAssist.HintPassWord/ComboBox x:NameCurrentRole SelectionChangedRoleChange Margin10 materialDesign:ComboBoxAssist.MaxLength2 DisplayMemberPathName SelectedValuePathId ItemsSource{Binding Roles} materialDesign:HintAssist.Hint请选择用户角色 materialDesign:HintAssist.HintOpacity.26 IsEditableTrue/ComboBoxCheckBox Margin10 Content是否启用 IsChecked{Binding IsActive} /StackPanel HorizontalAlignmentRight OrientationHorizontalButton Margin0,8,8,0 ClickConfirm Content确认/ButtonButton Margin0,8,8,0 ClickCancel Content取消/Button/StackPanel/StackPanel/Grid /PagePage.cs /// summary /// User.xaml 的交互逻辑 /// /summary public partial class User : Page, INotifyPropertyChanged {#region 通知public event PropertyChangedEventHandler PropertyChanged;/// summary/// 消息通知方法/// /summary/// param namepropertyname/parampublic void OnPropertyChanged([CallerMemberName] string propertyname ){PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyname));}#endregion //这里的数据库用的EF这里为啥这样写参考我前面的动态配置EF连接字符串的文章,此处可删string SQLConnection EFConnection.GetConnection(., sa, 123456, XYDB, false);public User(){InitializeComponent();DataContext this;//必要//下面可删除//Roles new ListSelectRole();//Notice.MainUI Application.Current.MainWindow;//string config SysConfig.GetConfig(SysConfig.PathBase, SysSet);//if (config ! null)//{// var mo JsonConvert.DeserializeObjectSystemSetModel(config);// SQLConnection EFConnection.GetConnection(mo.DbIP, mo.DbAccount, mo.DbPassWord, mo.DbName, false);//}在此初始化所有角色//using (var db new DBEntities(SQLConnection))//{// var role db.SysRoles.Where(m m.IsActive).ToList();// if (role ! null role.Count 0)// {// foreach (var item in role)// {// SelectRole role1 new SelectRole();// role1.Id item.Id;// role1.Name item.RoleName;// Roles.Add(role1);// }// }//}}#region 属性字段private Guid id;/// summary/// Id/// /summarypublic Guid Id{get { return id; }set{id value;OnPropertyChanged();//参数可以不写}}private string username;/// summary///用户名/// /summarypublic string UserName{get { return username; }set{username value; OnPropertyChanged();}}private string account;/// summary///账号/// /summarypublic string Account{get { return account; }set{account value; OnPropertyChanged();}}private string password;/// summary///密码/// /summarypublic string PassWord{get { return password; }set{password value; OnPropertyChanged();}}private bool isactive;/// summary/// 状态/// /summarypublic bool IsActive{get { return isactive; }set{isactive value;OnPropertyChanged();}}private bool isadd true;/// summary/// 是否添加用户用于辨别确认方法是添加还是编辑/// /summarypublic bool IsAdd{get { return isadd; }set{isadd value;OnPropertyChanged();}}private Guid roleid;/// summary/// 选定的角色Id/// /summarypublic Guid RoleId{get { return roleid; }set{roleid value;OnPropertyChanged();//参数可以不写}}private ListSelectRole roles;/// summary/// 可选的角色列表/// /summarypublic ListSelectRole Roles{get { return roles; }set{roles value;OnPropertyChanged();}}#endregion/// summary/// 添加/编辑/// /summary/// param namesender/param/// param namee/paramprivate void Confirm(object sender, RoutedEventArgs e){try{//下面的逻辑替换成自己的//using (var db new DBEntities(SQLConnection))//{// //添加用户// if (IsAdd)// {// var Current db.SysUsers.FirstOrDefault(m m.Account Account);// if (Current null)// {// SysUser user new SysUser();// user.Id Guid.NewGuid();// user.Name UserName;// user.Account Account;// user.PassWord PassWord;// user.IsActive IsActive;// user.CreateTime DateTime.Now;// user.LoginNum 0;// user.LoginTime DateTime.Now;// User_Role user_Role new User_Role();// user_Role.Id Guid.NewGuid();// user_Role.UserId user.Id;// user_Role.RoleId RoleId;// user.User_Role.Add(user_Role);// db.SysUsers.Add(user);// db.SaveChanges();// Notice.SuccessNotification_Dark(添加成功, 20, 5);// // 获取当前页面所在的窗体// Window window Window.GetWindow(this);// // 检查是否找到窗体并关闭它// if (window ! null)// {// window.Close();// }// }// else// {// Notice.WarningNotification_Dark($当前用户账号已存在!, 20, 5);// }// }//编辑用户// else// {// var Current db.SysUsers.FirstOrDefault(m m.Id ! Id m.Account Account);// if (Current null)// {// var User db.SysUsers.FirstOrDefault(m m.Id Id);// if (User ! null)// {// db.Entry(User).State EntityState.Detached;//取消跟踪免得修改主键冲突// User.Name UserName;// User.Account Account;// User.PassWord PassWord;// User.IsActive IsActive;// var role User.User_Role.FirstOrDefault();// if (role ! null)//有配置角色// {// role.RoleId RoleId;// db.User_Role.Add(role);// }// else//无配置角色// {// User_Role userRole new User_Role();// userRole.Id Guid.NewGuid();// userRole.UserId User.Id;// userRole.RoleId RoleId;// db.User_Role.Add(userRole);// }// db.Entry(User).State EntityState.Modified;// db.SaveChanges();// Notice.SuccessNotification_Dark(编辑成功, 20, 5);// // 获取当前页面所在的窗体// Window window Window.GetWindow(this);// // 检查是否找到窗体并关闭它// if (window ! null)// {// window.Close();// }// }// else// {// Notice.FailtureNotification_Dark(未找到当前用户, 20, 5);// return;// }// }// else// {// Notice.WarningNotification_Dark($当前账号已存在!, 20, 5);// }// }//}}catch (Exception ex){Notice.FailtureNotification_Dark($失败:{ex.Message}, 20, 5);}}/// summary/// 取消/// /summary/// param namesender/param/// param namee/paramprivate void Cancel(object sender, RoutedEventArgs e){// 获取当前页面所在的窗体Window window Window.GetWindow(this);// 检查是否找到窗体并关闭它if (window ! null){window.Close();}}private void RoleChange(object sender, SelectionChangedEventArgs e){RoleId(Guid)CurrentRole.SelectedValue;} } public class SelectRole {public Guid Id { get; set; }public string Name { set; get; } } 使用方法(供参考): 添加用户: User user new User(); DialogModel dialog new DialogModel(user, 添加用户, Collapsed); dialog.ShowDialog(); 编辑用户(需要赋值): /// summary/// DataGird的自定义操作栏的编辑按钮/// /summary/// param namesender/param/// param namee/paramprivate void UserEdit(object sender, RoutedEventArgs e){UserInfoDto userInfo new UserInfoDto();var co (Control)sender;userInfo (UserInfoDto)co.DataContext;//获取当前行数据User user new User();//实例化Pageuser.IsAdd false;//标识是编辑user.Id userInfo.Id;//将当前行信息给到Page绑定到控件user.UserName userInfo.Name;user.Account userInfo.Account;user.PassWord userInfo.PassWord;user.IsActive userInfo.IsActive;user.RoleId userInfo.RoleId;for (int i 0; i user.Roles.Count; i){if (user.Roles[i].Id userInfo.RoleId){if (user.Roles.Count 1){user.Roles.Remove(user.Roles[i]);user.Roles.Insert(0, user.Roles[i]);}}}DialogModel dialog new DialogModel(user, 编辑用户, Collapsed);dialog.ShowDialog();} 最终结果(用到的背景图片啥的我就不贴了毕竟我觉得不太好看):
http://www.hkea.cn/news/14410047/

相关文章:

  • 做网站个体户执照北京市官方网站
  • 东莞专业微网站建设单栏wordpress主题
  • 大型搜索网站开发广州本地生活app
  • 网站设计中的div是什么手表之家
  • 网站宣传与推广的指导思想国内h5网站欣赏
  • 深圳手机网站制作价钱2021没封的网站uc
  • 锐旗 天梯网站建设广州网站建设排名
  • 网站宣传流程wordpress插件没有效果
  • 成都维尼网络 网站建设南昌公路建设有限公司网站
  • 做网站大约多少钱海南行指网站开发公司
  • 盐城网站建设效果上海优化seo排名
  • 如何分析网站用户体验青岛微信网站建设
  • 网站制作 wordpress五大电商平台都有哪些
  • 怎样才能有自己的网站网站制作换下面友情连接
  • 怎样做instergram网站营销wordpress去除幻灯片
  • 网站建设 服务器wordpress如何登录界面
  • 团队拓展活动游戏阳江优化网站排名
  • 网站项目总体设计模板海外购物平台都有哪些
  • 网站域名不变网站可以从做吗拜年视频制作软件
  • 网站建设收费价目表物流网站建设策划书怎么写
  • 山西建设厅官方网站公示搭建什么网站好
  • 做直播网站要多大带宽石家庄做网站公司汉狮价格
  • 海南智能网站建设公司广东网站开发费用
  • 信通网站开发中心安徽茶叶商城网站建设
  • 腾龙官方网站做号软件中国制造网外贸平台下载
  • 大型物流公司网站湛江定制建站
  • 建各公司网站要多少钱宜兴建设局的网站
  • 前端可以做网站吗天工网官方网站
  • 网站聊天室怎样做炫彩马甲新手做网站需要多久
  • 枣庄住房和城乡建设厅网站江西核工业建设有限公司网站