WPF实战项目十六(客户端):备忘录接口

news/2024/5/20 0:28:42 标签: wpf, webapi, .netcore, c#

1、新增IMemoService接口,继承IBaseService接口

    public interface IMemoService : IBaseService<MemoDto>
    {
    }

2、新增MemoService类,继承BaseService和IMemoService接口

    public class MemoService : BaseService<MemoDto>, IMemoService
    {
        public MemoService(HttpRestClient client) : base(client, "Memo")
        {
        }
    }

3、在App.xmal.cs中注册备忘录的服务

        containerRegistry.Register<IMemoService, MemoService>();

4、在MemoViewModel.cs中添加备忘录的服务

        private readonly IMemoService memoService;
        public MemoViewModel(IMemoService memoService)
        {
            MemoDtos = new ObservableCollection<MemoDto>();
            AddCommand = new DelegateCommand(Add);
            this.memoService = memoService;
            CreateMemoList();
        }

5、重新编写获取备忘录信息代码,CreateMemoList

private async void CreateMemoList()
        {
            var memoResult = await memoService.GetAllPageListAsync(new WPFProjectShared.Parameters.QueryParameter { PageIndex = 0, PageSize = 100 });
            if (memoResult.Status)
            {
                memoDtos.Clear();
                foreach (var item in memoResult.Result.Items)
                {
                    memoDtos.Add(item);
                }
            }
        }

6、F5运行项目


http://www.niftyadmin.cn/n/5208561.html

相关文章

13.3 uboot显示logo

文章目录 命令控制logo显示自动显示logo调用流程默认logo参考命令控制logo显示 run_command("fatload mmc 0:1 80800000 logo.bmp", 0 ); run_command("bmp display 80800000 0 0", 0 );自动显示logo调用流程 init_sequence_r common/board_r.cstdio_ad…

〖大前端 - 基础入门三大核心之JS篇㊷〗- DOM事件对象及它的属性

说明&#xff1a;该文属于 大前端全栈架构白宝书专栏&#xff0c;目前阶段免费&#xff0c;如需要项目实战或者是体系化资源&#xff0c;文末名片加V&#xff01;作者&#xff1a;不渴望力量的哈士奇(哈哥)&#xff0c;十余年工作经验, 从事过全栈研发、产品经理等工作&#xf…

UDP客户端使用connect与UDP服务器使用send函数和recv函数收发数据

服务器代码编译运行 服务器udpconnectToServer.c的代码如下&#xff1a; #include<stdio.h> #include<stdlib.h> #include<string.h> #include<unistd.h> #include<arpa/inet.h> #include<sys/socket.h> #include<errno.h> #inclu…

K8s client go 创建CRD的informer

背景 需要监听K8s中CRD资源的变动, 做出相应的处理, 需要针对 CRD资源建立informer 实现 dynamicClient 是 创建的K8s的client, 这里使用的是 Unstructured 接収的CRD的结果, 加工的时候使用了convertUnstructuredProject 加工了一下, convertUnstructuredProject 实现下面提…

替换jar文件中的jar文件中的class

文件格式 testjar.jar在ruoyi.jar中。 AssetServiceImpl.class在testjar.jar 查找testjar.jar路径 jar -tvf ruoyi.jar | grep testjar.jar 解析testjar.jar jar -xvf ruoyi.jar BOOT-INF/lib/testjar.jar 查找class文件路径 jar -tvf testjar.jar | grep AssetServiceImp…

2023亚太杯数学建模C题:我国新能源电动汽车的发展趋势,思路模型代码

问题C 我国新能源电动汽车的发展趋势 赛题思路&#xff1a;获取思路见文末名片&#xff0c;第一时间更新 新能源汽车是指以先进技术原理、新技术、新结构的非常规汽车燃料为动力来源( 非常规汽车燃料指汽油、柴油以外的燃料&#xff09;&#xff0c;将先进技术进行汽车动力控制…

Qt无边框窗口设置阴影

//设置窗体透明this->setAttribute(Qt::WA_TranslucentBackground, true);//设置无边框this->setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowMinMaxButtonsHint);QVBoxLayout* pMainLay new QVBoxLayout(this);CLoginRealWidget* pRealWidget new …

【SpringMVC】 对请求的不同响应

前言 本文学习如何运用不同的注解来返回不同的响应. 1.返回静态页面Controller 返回index.html页面 Controller 和 RestController的区别 controller 只有加上这个注解,Spring才会帮我们管理这个代码.后续我们访问时才能访问到. RestController 等同于 Controller ResponseBo…