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

长沙网站运营网站建设 APP开发销售怎么做

长沙网站运营,网站建设 APP开发销售怎么做,网站建设推广语,王烨甘肃文章目录 备忘录添加功能memoviewmodel.csmemo.view修改控制器 备忘录添加功能 由于todoview 和 memoview的相似度很高#xff0c;可复制todoview 的代码。 memoviewmodel.cs using Mytodo.Common.Models; using Mytodo.Service; using Prism.Commands; using Prism.Ioc; u… 文章目录 备忘录添加功能memoviewmodel.csmemo.view修改控制器 备忘录添加功能 由于todoview 和 memoview的相似度很高可复制todoview 的代码。 memoviewmodel.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 MemoViewModel : NavigationViewModel{#region 命令定义/// summary/// 展开侧边栏/// /summarypublic DelegateCommand OpenRightContentCmd { set; get; }/// summary/// 打开选择的项/// /summarypublic DelegateCommandMemoDto SelectedCommand { get; set; }/// summary/// 添加、编辑 项/// /summarypublic DelegateCommandstring ExecuteCommand { get; set; }/// summary/// 删除项/// /summarypublic DelegateCommandMemoDto DeleteCommand { get; set; }#endregion#region 属性定义/// summary/// 项目状态/// /summarypublic int SelectIndex{get { return selectIndex; }set { selectIndex value; RaisePropertyChanged(); }}/// summary/// 当前选中项/// /summarypublic MemoDto? CurrDto{get { return currDto; }set { currDto value; RaisePropertyChanged(); }}/// summary/// 指示侧边栏是否展开/// /summarypublic bool IsRightOpen{get { return isRightOpen; }set { isRightOpen value; RaisePropertyChanged(); }}/// summary/// todo集合/// /summarypublic ObservableCollectionMemoDto? MemoDtos{get { return memoDtos; }set { memoDtos value; RaisePropertyChanged(); }}/// summary/// 右侧侧边栏标题/// /summarypublic string RightContentTitle{get { return rightContentTitle; }set { rightContentTitle value; RaisePropertyChanged(); }}/// summary/// 要搜索的字符串/// /summarypublic string SearchString{get { return search; }set { search value; RaisePropertyChanged(); }}#endregion#region 重要字段定义private readonly IMemoService service;#endregion#region 字段定义private int selectIndex;private MemoDto currDto;private bool isRightOpen;private ObservableCollectionMemoDto? memoDtos;private string rightContentTitle;private string search;#endregion#region 命令方法/// summary/// 删除指定项/// /summary/// param namedto/paramasync private void DeleteItem(MemoDto dto){var delres await service.DeleteAsync(dto.Id);if (delres.Status){var model MemoDtos.FirstOrDefault(t t.Id.Equals(dto.Id));MemoDtos.Remove(dto);}}private void ExceuteCmd(string obj){switch (obj){case 添加:Add(); break;case 查询:Query(); break;case 保存:Save(); break;}}/// summary/// 保存消息/// /summaryprivate 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) //如果添加成功{MemoDtos.Add(add_res.Result);}else{MessageBox.Show(添加失败);}}}catch{}finally{IsRightOpen false;//卸载数据加载窗体UpdateLoding(false);}}/// summary/// 打开待办事项弹窗/// /summaryvoid Add(){CurrDto new MemoDto();IsRightOpen true;}private void Query(){GetDataAsync();}/// summary/// 根据条件更新数据/// /summaryasync void UpdateDataAsync(){var memoResult await service.GetAllAsync(new MyToDo.Share.Parameters.QueryParameter { PageIndex 0, PageSize 100, Search SearchString });if (memoResult.Status){MemoDtos.Clear();foreach (var item in memoResult.Result.Items)MemoDtos.Add(item);}}/// summary/// 获取所有数据/// /summaryasync void GetDataAsync(){//调用数据加载页面UpdateLoding(true);//更新数据UpdateDataAsync();//卸载数据加载页面UpdateLoding(false);}/// summary/// 弹出详细信息/// /summary/// param nameobj/paramprivate async void Selected(MemoDto obj){var todores await service.GetFirstOfDefaultAsync(obj.Id);if (todores.Status){CurrDto todores.Result;IsRightOpen true;RightContentTitle 我的待办;}}#endregionpublic MemoViewModel(IMemoService service, IContainerProvider provider) : base(provider){//初始化对象MemoDtos new ObservableCollectionMemoDto();RightContentTitle 添加备忘率;//初始化命令SelectedCommand new DelegateCommandMemoDto(Selected);OpenRightContentCmd new DelegateCommand(Add);ExecuteCommand new DelegateCommandstring(ExceuteCmd);DeleteCommand new DelegateCommandMemoDto(DeleteItem);this.service service;}public override void OnNavigatedTo(NavigationContext navigationContext){base.OnNavigatedTo(navigationContext);GetDataAsync();}} } memo.view UserControlx:ClassMytodo.Views.MemoViewxmlnshttp://schemas.microsoft.com/winfx/2006/xaml/presentationxmlns:xhttp://schemas.microsoft.com/winfx/2006/xamlxmlns:cvclr-namespace:Mytodo.Common.Convertersxmlns:dhttp://schemas.microsoft.com/expression/blend/2008xmlns:ihttp://schemas.microsoft.com/xaml/behaviorsxmlns:localclr-namespace:Mytodo.Viewsxmlns:mchttp://schemas.openxmlformats.org/markup-compatibility/2006xmlns:mdhttp://materialdesigninxaml.net/winfx/xaml/themesd:DesignHeight450d:DesignWidth800mc:IgnorabledUserControl.ResourcesResourceDictionarycv:IntToVisibilityConveter x:KeyIntToVisility //ResourceDictionary/UserControl.Resourcesmd:DialogHostmd:DrawerHost IsRightDrawerOpen{Binding IsRightOpen}md:DrawerHost.RightDrawerContentDockPanelMinWidth200MaxWidth240Margin2LastChildFillFalseTextBlockMargin10DockPanel.DockTopFontFamily微软雅黑FontSize20FontWeightBoldText{Binding RightContentTitle} /StackPanelMargin10DockPanel.DockTopOrientationHorizontalTextBlockMargin5VerticalAlignmentCenterFontFamily微软雅黑FontSize14Text状态 //StackPanelTextBoxMargin10md:HintAssist.Hint备忘录事项标题DockPanel.DockTopFontFamily微软雅黑FontSize12Text{Binding CurrDto.Title} /TextBoxMinHeight50Margin10md:HintAssist.Hint备忘录事项内容DockPanel.DockTopFontFamily微软雅黑FontSize12Text{Binding CurrDto.Content}TextWrappingWrap /ButtonMargin10,5HorizontalAlignmentCenterCommand{Binding ExecuteCommand}CommandParameter保存Content保存DockPanel.DockTop //DockPanel/md:DrawerHost.RightDrawerContentGridGrid.RowDefinitionsRowDefinition Heightauto /RowDefinition //Grid.RowDefinitionsStackPanel Margin15,10 OrientationHorizontalTextBoxWidth200md:HintAssist.Hint查找备忘录中md:TextFieldAssist.HasClearButtonTrueFontFamily微软雅黑FontSize14Text{Binding SearchString, ModeTwoWay, UpdateSourceTriggerPropertyChanged}TextBox.InputBindingsKeyBindingKeyEnterCommand{Binding ExecuteCommand}CommandParameter查询 //TextBox.InputBindings/TextBox/StackPanelButtonMargin10,0HorizontalAlignmentRightCommand{Binding OpenRightContentCmd}Content 添加到备忘FontFamily微软雅黑FontSize14 /StackPanelGrid.Row1VerticalAlignmentCenterVisibility{Binding MemoDtos.Count, Converter{StaticResource IntToVisility}}md:PackIconWidth120Height120HorizontalAlignmentCenterKindClipboardText /TextBlockMargin0,10HorizontalAlignmentCenterFontSize18Text尝试添加一些待办事项以便在此处查看它们。 //StackPanelItemsControlGrid.Row1Margin10ItemsSource{Binding MemoDtos}ItemsControl.ItemsPanelItemsPanelTemplateWrapPanel //ItemsPanelTemplate/ItemsControl.ItemsPanelItemsControl.ItemTemplateDataTemplateBorder MinWidth200 Margin10Grid MinHeight150i:Interaction.Triggersi:EventTrigger EventNameMouseLeftButtonUpi:InvokeCommandAction Command{Binding DataContext.SelectedCommand, RelativeSource{RelativeSource ModeFindAncestor, AncestorTypeItemsControl}} CommandParameter{Binding} //i:EventTrigger/i:Interaction.TriggersGrid.RowDefinitionsRowDefinition Heightauto /RowDefinition //Grid.RowDefinitionsDockPanel Panel.ZIndex2 LastChildFillFalseTextBlockMargin10,10FontFamily黑体FontSize14Text{Binding Title} /md:PopupBoxMargin5Panel.ZIndex1DockPanel.DockRightButtonPanel.ZIndex2Command{Binding DataContext.DeleteCommand, RelativeSource{RelativeSource ModeFindAncestor, AncestorTypeItemsControl}}CommandParameter{Binding}Content删除 //md:PopupBox/DockPanelTextBlockGrid.Row1Margin10,5FontFamily黑体FontSize12Opacity0.7Text{Binding Content} /Canvas Grid.RowSpan2 ClipToBoundsTrueBorderCanvas.Top10Canvas.Right-50Width120Height120Background#FFFFFFCornerRadius100Opacity0.1 /BorderCanvas.Top80Canvas.Right-30Width120Height120Background#FFFFFFCornerRadius100Opacity0.1 //CanvasBorderGrid.RowSpan2Background#ffffccCornerRadius5Opacity0.3 //Grid/Border/DataTemplate/ItemsControl.ItemTemplate/ItemsControl/Grid/md:DrawerHost/md:DialogHost /UserControl 修改控制器 public async TaskApiReponse Delete(int todoid) await service.DeleteApublic async TaskApiReponse Delete(int todoid)
http://www.yutouwan.com/news/91482/

相关文章:

  • 怎么建设自己产品网站加强网站制度建设
  • 狠狠做狠狠干免费网站开发者选项怎么打开
  • 企业网站维护工作计划什么是网络营销网络营销的特点有哪些
  • 合肥市建设工程信息价网站做电商网站有什语言好
  • 网站动态设计效果定制网站和模板网站有何区别
  • 作文网下载山东seo优化
  • 网站运营外包公司2022百度搜索风云榜
  • 狮山网站建设长沙低价网站建设
  • 网站设计开发中的具体步骤龙岩找工作网站
  • 一条龙建设网站网站开发业绩
  • 网站首页设计布局方式个人空间网站
  • 上海做网站就用乐云seo网站建设和赚钱方法
  • 商城网站前台模板网上购物系统软件开发
  • 岳阳网站建设公司怎么查网站备案信息
  • 网站建设电网站建设用阿里云的虚拟主机
  • 昆明微网站制作新手学纪事本html代码做网站
  • 炫酷的移动端网站东莞公司网站怎么做
  • 网站维护的基本内容包括哪些广东网站建设排名
  • 厦门网站建设设计网站备案幕布
  • 金泉网站建设开发哪些网站可以医生做兼职
  • 公司网站的留言板怎么做网站开发编码选择一般是
  • 做网站店铺装修的软件如何建设一个博客网站
  • 网站开发找公司好还是个人阳谷聊城做网站
  • 可以建网站的公司cms影视建站系统
  • 免费的奖励网站有哪些铜山徐州网站开发
  • 便利的微网站建设vi视觉识别系统设计
  • 如何用一个域名做多个网站wordpress整合问答系统
  • 网站建设工作标准南京网站设计哪家公司好
  • 设计网站页面要多少钱网站为什么被百度k了
  • 表格做的网站影响收录天津哪家做企业网站