国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

WPF實戰(zhàn)學(xué)習(xí)筆記24-首頁編輯與完成

這篇具有很好參考價值的文章主要介紹了WPF實戰(zhàn)學(xué)習(xí)筆記24-首頁編輯與完成。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。

首頁編輯與完成

  • indexview添加Listbox控件的鼠標(biāo)雙擊行為
    • 添加todo、memo的編輯命令
    • indexviewmodel添加對應(yīng)的更新事件處理
  • 添加ToggleButton與后臺的綁定
    • 將ToggleButton的ischeck綁定到status屬性
    • 添加bool int 轉(zhuǎn)換器
    • 添加完成命令
    • 添加完成功能函數(shù)

Listbox添加行為

給行為添加命令空間

文件:Mytodo.Views.IndexView.cs

    xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
添加行為事件

文件:Mytodo.Views.IndexView.cs

<i:Interaction.Triggers>
    <i:EventTrigger EventName="MouseDoubleClick">
        <i:InvokeCommandAction Command="{Binding EditTodoCmd}" CommandParameter="{Binding ElementName=todolbox, Path=SelectedItem}" />
    </i:EventTrigger>
</i:Interaction.Triggers>
<i:Interaction.Triggers>
    <i:EventTrigger EventName="MouseDoubleClick">
        <i:InvokeCommandAction Command="{Binding EditTodoCmd}" CommandParameter="{Binding ElementName=todolbox, Path=SelectedItem}" />
    </i:EventTrigger>
</i:Interaction.Triggers>
后臺添加對應(yīng)的命令,并初始化

文件:Mytodo.Views.IndexViewmodel.cs

/// <summary>
/// 命令:編輯備忘
/// </summary>
public DelegateCommand<MemoDto> EditMemoCmd { get;private set; }

/// <summary>
/// 命令:編輯待辦
/// </summary>
public DelegateCommand<ToDoDto> EditTodoCmd { get; private set; }
//初始化命令
EditMemoCmd = new DelegateCommand<MemoDto>(Addmemo);
EditTodoCmd = new DelegateCommand<ToDoDto>(Addtodo);
添加命令方法

文件:Mytodo.Views.IndexViewmodel.cs

/// <summary>
/// 添加待辦事項
/// </summary>
async void Addtodo(ToDoDto model)
{
    DialogParameters param = new DialogParameters();

    if (model != null)
        param.Add("Value", model);

    var dialogres = await dialog.ShowDialog("AddTodoView", param);

    var newtodo = dialogres.Parameters.GetValue<ToDoDto>("Value");

    if (newtodo == null || string.IsNullOrEmpty(newtodo.Title) || (string.IsNullOrEmpty(newtodo.Content)))
        return;

    if (dialogres.Result == ButtonResult.OK)
    {
        try
        {


            if (newtodo.Id > 0)
            {
                var updres = await toDoService.UpdateAsync(newtodo);
                if (updres.Status)
                {
                    var todo = TodoDtos.FirstOrDefault(x=>x.Id.Equals(newtodo.Id));
                    //更新信息
                    todo.Content = newtodo.Content;
                    todo.Title = newtodo.Title;
                    todo.Status = newtodo.Status;
                }
            }
            else
            {
                //添加內(nèi)容 

                //更新數(shù)據(jù)庫數(shù)據(jù)
                var addres  = await toDoService.AddAsync(newtodo);

                //更新UI數(shù)據(jù)
                if (addres.Status)
                {
                    TodoDtos.Add(addres.Result);
                }
            }
        }

        catch 
        {


        }
        finally
        {
            UpdateLoding(false);
        }
    }

}

/// <summary>
/// 添加備忘錄
/// </summary>
async void Addmemo(MemoDto model)
{
    DialogParameters param = new DialogParameters();

    if (model != null)
        param.Add("Value", model);

    var dialogres = await dialog.ShowDialog("AddMemoView", param);



    if (dialogres.Result == ButtonResult.OK)
    {
        try
        {
            var newmemo = dialogres.Parameters.GetValue<MemoDto>("Value");

            if (newmemo != null && string.IsNullOrWhiteSpace(newmemo.Content) && string.IsNullOrWhiteSpace(newmemo.Title))
                return;

            if (newmemo.Id > 0)
            {
                var updres = await memoService.UpdateAsync(newmemo);
                if (updres.Status)
                {
                    //var memo = MemoDtos.FindFirst(predicate: x => x.Id == newmemo.Id);
                    var memo = MemoDtos.FirstOrDefault( x => x.Id.Equals( newmemo.Id));
                    //更新信息
                    memo.Content = newmemo.Content;
                    memo.Title = newmemo.Title;
                }
            }
            else
            {
                //添加內(nèi)容


                var addres = await memoService.AddAsync(newmemo);

                //更新UI數(shù)據(jù)
                if (addres.Status)
                {
                    MemoDtos.Add(addres.Result);
                }

            }
        }

        catch
        {


        }
        finally
        {
            UpdateLoding(false);
        }
    }
}

添加ToggleButton綁定與check事件

添加轉(zhuǎn)換器

添加文件:Mytodo.Common.Converters.BoolInt_TConverter.cs

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace Mytodo.Common.Converters
{
    public  class BoolInt_TConverter : IValueConverter
    {
        /// <summary>
        /// int to bool
        /// </summary>
        /// <param name="value"></param>
        /// <param name="targetType"></param>
        /// <param name="parameter"></param>
        /// <param name="culture"></param>
        /// <returns></returns>
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if(value!=null&&int.TryParse(value.ToString(),out int result))
            {
                if(result==0)
                    return true;
                else
                    return false;
            }
            return false;
        }


        /// <summary>
        /// bool to int 
        /// </summary>
        /// <param name="value"></param>
        /// <param name="targetType"></param>
        /// <param name="parameter"></param>
        /// <param name="culture"></param>
        /// <returns></returns>
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value != null && bool.TryParse(value.ToString(), out bool result))
            {
                if (result)
                    return 0;
                else
                    return 1;
            }
            return false;
        }
    }
}

添加轉(zhuǎn)換器,添加命令

修改文件:Mytodo.Views.IndexView.xaml

  1. 添加命名空間
    xmlns:cv="clr-namespace:Mytodo.Common.Converters"
  1. 添加資源

        <UserControl.Resources>
            <ResourceDictionary>
                <cv:BoolInt_TConverter x:Key="BoolInt_TConverter" />
            </ResourceDictionary>
        </UserControl.Resources>
    
  2. 綁定命令,添加轉(zhuǎn)換器

    <ToggleButton
                  Width="40"
                  Command="{Binding DataContext.ToDoCompltedCommand, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}"
                  CommandParameter="{Binding }"
                  DockPanel.Dock="Right"
                  IsChecked="{Binding Status, Converter={StaticResource BoolInt_TConverter}, Mode=TwoWay}" />
    <StackPanel>
    
  3. 定義命令,并初始化

    /// <summary>
    /// Todo完成命令
    /// </summary>
    public DelegateCommand<ToDoDto> ToDoCompltedCommand { get; set; }
    public IndexViewModel(IContainerProvider provider,
                          IDialogHostService dialog) : base(provider)
    {
        //實例化接口
        this.toDoService= provider.Resolve<ITodoService>();
        this.memoService = provider.Resolve<IMemoService>();
    
        //實例化對象
        MemoDtos = new ObservableCollection<MemoDto>();
        TodoDtos = new ObservableCollection<ToDoDto>();
    
        //初始化命令
        EditMemoCmd = new DelegateCommand<MemoDto>(Addmemo);
        EditTodoCmd = new DelegateCommand<ToDoDto>(Addtodo);
        ToDoCompltedCommand = new DelegateCommand<ToDoDto>(Compete);
        ExecuteCommand = new DelegateCommand<string>(Execute);
    
        this.dialog = dialog;
    
        CreatBars();
    }
    
  4. 初始化命令操作函數(shù)文章來源地址http://www.zghlxwxcb.cn/news/detail-620243.html

    /// <summary>
    /// togglebutoon 的命令
    /// </summary>
    /// <param name="dto"></param>
    /// <exception cref="NotImplementedException"></exception>
    async private void Compete(ToDoDto dto)
    {
        if (dto == null || string.IsNullOrEmpty(dto.Title) || (string.IsNullOrEmpty(dto.Content)))
            return;
    
        var updres = await toDoService.UpdateAsync(dto);
    
        if (updres.Status)
        {
            var todo = TodoDtos.FirstOrDefault(x => x.Id.Equals(dto.Id));
            //更新信息
            todo.Status = dto.Status;
        }
    }
    

修改相關(guān)bug

修改Mytodo.ViewModels.cs
using Mytodo.Common.Models;
using Prism.Mvvm;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Reflection.Metadata;
using System.Text;
using System.Threading.Tasks;
using MyToDo.Share.Models;
using Prism.Commands;
using Prism.Services.Dialogs;
using Mytodo.Dialog;
using Mytodo.ViewModels;
using Mytodo.Service;
using Prism.Ioc;
using System.Diagnostics;
using Microsoft.VisualBasic;
using ImTools;
using DryIoc;
using MyToDo.Share;
using System.Windows;

namespace Mytodo.ViewModels
{
    public class IndexViewModel:NavigationViewModel
    {
        #region 定義命令


        /// <summary>
        /// Todo完成命令
        /// </summary>
        public DelegateCommand<ToDoDto> ToDoCompltedCommand { get; set; }
        public DelegateCommand<string> ExecuteCommand { get; set; }

        /// <summary>
        /// 命令:編輯備忘
        /// </summary>
        public DelegateCommand<MemoDto> EditMemoCmd { get;private set; }

        /// <summary>
        /// 命令:編輯待辦
        /// </summary>
        public DelegateCommand<ToDoDto> EditTodoCmd { get; private set; }


        #endregion

        #region 定義屬性
        public string Title { get; set; }

        public ObservableCollection<MemoDto> MemoDtos
        {
            get { return memoDtos; }
            set { memoDtos = value; RaisePropertyChanged(); }
        }

        public ObservableCollection<ToDoDto> TodoDtos
        {
            get { return todoDtos; }
            set { todoDtos = value; RaisePropertyChanged(); }
        }

        /// <summary>
        /// 首頁任務(wù)條
        /// </summary>
        public ObservableCollection<TaskBar> TaskBars
        {
            get { return taskBars; }
            set { taskBars = value; RaisePropertyChanged(); }
        }
        #endregion

        #region 定義重要命令

        #endregion

        #region 定義重要字段
        private readonly IDialogHostService dialog;
        private readonly ITodoService toDoService;
        private readonly IMemoService memoService;
        #endregion

        #region 定義普通字段
        private ObservableCollection<TaskBar> taskBars;
        private ObservableCollection<ToDoDto> todoDtos;
        private ObservableCollection<MemoDto> memoDtos;
        #endregion

        #region 命令相關(guān)方法

        /// <summary>
        /// togglebutoon 的命令
        /// </summary>
        /// <param name="dto"></param>
        /// <exception cref="NotImplementedException"></exception>
        async private void Compete(ToDoDto dto)
        {
            if (dto == null || string.IsNullOrEmpty(dto.Title) || (string.IsNullOrEmpty(dto.Content)))
                return;

            var updres = await toDoService.UpdateAsync(dto);

            if (updres.Status)
            {
                var todo = TodoDtos.FirstOrDefault(x => x.Id.Equals(dto.Id));
                //更新信息
                todo.Status = dto.Status;
            }
        }

        /// <summary>
        /// 選擇執(zhí)行命令
        /// </summary>
        /// <param name="obj"></param>
        void Execute(string obj)
        {
            switch (obj)
            {
                case "新增待辦": Addtodo(null); break;
                case "新增備忘": Addmemo(null); break;
            }
        }

        /// <summary>
        /// 添加待辦事項
        /// </summary>
        async void Addtodo(ToDoDto model)
        {
            DialogParameters param = new DialogParameters();

            if (model != null)
                param.Add("Value", model);

            var dialogres = await dialog.ShowDialog("AddTodoView", param);

            var newtodo = dialogres.Parameters.GetValue<ToDoDto>("Value");

            if (newtodo == null || string.IsNullOrEmpty(newtodo.Title) || (string.IsNullOrEmpty(newtodo.Content)))
                    return;

            if (dialogres.Result == ButtonResult.OK)
            {
                try
                {


                    if (newtodo.Id > 0)
                    {
                        var updres = await toDoService.UpdateAsync(newtodo);
                        if (updres.Status)
                        {
                            var todo = TodoDtos.FirstOrDefault(x=>x.Id.Equals(newtodo.Id));
                            //更新信息
                            todo.Content = newtodo.Content;
                            todo.Title = newtodo.Title;
                            todo.Status = newtodo.Status;
                        }
                    }
                    else
                    {
                        //添加內(nèi)容 

                        //更新數(shù)據(jù)庫數(shù)據(jù)
                        var addres  = await toDoService.AddAsync(newtodo);

                        //更新UI數(shù)據(jù)
                        if (addres.Status)
                        {
                            TodoDtos.Add(addres.Result);
                        }
                    }
                }
           
            catch 
            {


            }
            finally
            {
                UpdateLoding(false);
            }
            }

        }

        /// <summary>
        /// 添加備忘錄
        /// </summary>
        async void Addmemo(MemoDto model)
        {
            DialogParameters param = new DialogParameters();

            if (model != null)
                param.Add("Value", model);

            var dialogres = await dialog.ShowDialog("AddMemoView", param);

            

            if (dialogres.Result == ButtonResult.OK)
            {
                try
                {
                    var newmemo = dialogres.Parameters.GetValue<MemoDto>("Value");

                    if (newmemo != null && string.IsNullOrWhiteSpace(newmemo.Content) && string.IsNullOrWhiteSpace(newmemo.Title))
                        return;

                        if (newmemo.Id > 0)
                    {
                        var updres = await memoService.UpdateAsync(newmemo);
                        if (updres.Status)
                        {
                            //var memo = MemoDtos.FindFirst(predicate: x => x.Id == newmemo.Id);
                            var memo = MemoDtos.FirstOrDefault( x => x.Id.Equals( newmemo.Id));
                            //更新信息
                            memo.Content = newmemo.Content;
                            memo.Title = newmemo.Title;
                        }
                    }
                    else
                    {
                        //添加內(nèi)容
                        
                        
                            var addres = await memoService.AddAsync(newmemo);

                            //更新UI數(shù)據(jù)
                            if (addres.Status)
                            {
                                MemoDtos.Add(addres.Result);
                            }
                        
                    }
                }

                catch
                {


                }
                finally
                {
                    UpdateLoding(false);
                }
            }
        }

        #endregion

        #region 其它方法

        #endregion

        #region 啟動項相關(guān)
        void CreatBars()
        {
            Title = "您好,2022";
            TaskBars = new ObservableCollection<TaskBar>();
            TaskBars.Add(new TaskBar { Icon = "CalendarBlankOutline", Title = "匯總", Color = "#FF00FF00", Content = "27", Target = "" });
            TaskBars.Add(new TaskBar { Icon = "CalendarMultipleCheck", Title = "已完成", Color = "#6B238E", Content = "24", Target = "" });
            TaskBars.Add(new TaskBar { Icon = "ChartLine", Title = "完成比例", Color = "#32CD99", Content = "100%", Target = "" });
            TaskBars.Add(new TaskBar { Icon = "CheckboxMarked", Title = "備忘錄", Color = "#5959AB", Content = "13", Target = "" });
        }
        #endregion


        public IndexViewModel(IContainerProvider provider,
            IDialogHostService dialog) : base(provider)
        {
            //實例化接口
            this.toDoService= provider.Resolve<ITodoService>();
            this.memoService = provider.Resolve<IMemoService>();

            //實例化對象
            MemoDtos = new ObservableCollection<MemoDto>();
            TodoDtos = new ObservableCollection<ToDoDto>();

            //初始化命令
            EditMemoCmd = new DelegateCommand<MemoDto>(Addmemo);
            EditTodoCmd = new DelegateCommand<ToDoDto>(Addtodo);
            ToDoCompltedCommand = new DelegateCommand<ToDoDto>(Compete);
            ExecuteCommand = new DelegateCommand<string>(Execute);

            this.dialog = dialog;

            CreatBars();
        }
    }
}

修改Mytodo.AddMemoViewModel.cs
using MaterialDesignThemes.Wpf;
using Mytodo.Dialog;
using MyToDo.Share.Models;
using Prism.Commands;
using Prism.Mvvm;
using Prism.Services.Dialogs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Mytodo.ViewModels.Dialogs
{
    internal class AddMemoViewModel : BindableBase, IDialogHostAware
    {
        public AddMemoViewModel()
        {
            SaveCommand = new DelegateCommand(Save);
            CancelCommand = new DelegateCommand(Cancel);
        }

        private MemoDto model;

        public MemoDto Model
        {
            get { return model; }
            set { model = value; RaisePropertyChanged(); }
        }

        private void Cancel()
        {
            if (DialogHost.IsDialogOpen(DialogHostName))
                DialogHost.Close(DialogHostName, new DialogResult(ButtonResult.No));
        }

        private void Save()
        {

            if (DialogHost.IsDialogOpen(DialogHostName))
            {
                //確定時,把編輯的實體返回并且返回OK
                DialogParameters param = new DialogParameters();
                param.Add("Value", Model);
                DialogHost.Close(DialogHostName, new DialogResult(ButtonResult.OK, param));
            }
        }

        public string DialogHostName { get; set; }
        public DelegateCommand SaveCommand { get; set; }
        public DelegateCommand CancelCommand { get; set; }

        public void OnDialogOpend(IDialogParameters parameters)
        {
            if (parameters.ContainsKey("Value"))
            {
                Model = parameters.GetValue<MemoDto>("Value");
                if(Model == null) {
                    Model = new MemoDto();
                }c
            }
            else
                Model = new MemoDto();
        }
    }
}

修改Mytodo.AddTodoViewModel.cs
using MaterialDesignThemes.Wpf;
using Mytodo.Dialog;
using MyToDo.Share.Models;
using Prism.Commands;
using Prism.Mvvm;
using Prism.Services.Dialogs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Mytodo.ViewModels.Dialogs
{
    internal class AddTodoViewModel : BindableBase, IDialogHostAware
    {
        public AddTodoViewModel()
        {
            SaveCommand = new DelegateCommand(Save);
            CancelCommand = new DelegateCommand(Cancel);

        }

        private ToDoDto model;

        /// <summary>
        /// 新增或編輯的實體
        /// </summary>
        public ToDoDto Model
        {
            get { return model; }
            set { model = value; RaisePropertyChanged(); }
        }

        /// <summary>
        /// 取消
        /// </summary>
        private void Cancel()
        {
            if (DialogHost.IsDialogOpen(DialogHostName))
                DialogHost.Close(DialogHostName, new DialogResult(ButtonResult.No)); //取消返回NO告訴操作結(jié)束
        }

        /// <summary>
        /// 確定
        /// </summary>
        private void Save()
        {
            if (DialogHost.IsDialogOpen(DialogHostName))
            {
                //確定時,把編輯的實體返回并且返回OK
                DialogParameters param = new DialogParameters();
                param.Add("Value", Model);
                DialogHost.Close(DialogHostName, new DialogResult(ButtonResult.OK, param));
            }
        }

        public string DialogHostName { get; set; }
        public DelegateCommand SaveCommand { get; set; }
        public DelegateCommand CancelCommand { get; set; }

        public void OnDialogOpend(IDialogParameters parameters)
        {
            if (parameters.ContainsKey("Value"))
            {
                Model = parameters.GetValue<ToDoDto>("Value");
                if (Model == null)
                {
                    Model = new ToDoDto();
                    Model.Status = 1;
                }
            }
            else
            {
                Model = new ToDoDto();
                Model.Status = 1;
            }

        }
    }
}

到了這里,關(guān)于WPF實戰(zhàn)學(xué)習(xí)筆記24-首頁編輯與完成的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實不符,請點擊違法舉報進(jìn)行投訴反饋,一經(jīng)查實,立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費用

相關(guān)文章

  • WPF實戰(zhàn)學(xué)習(xí)筆記17-TodoView 添加新增、編輯、查詢功能

    修改TodoViewModel.cs 修改XAML 添加引用 添加綁定 添加項目的雙擊事件 修改ToDoService 修改MyToDo.Api/Service/ToDoService.cs

    2024年02月15日
    瀏覽(22)
  • WPF實戰(zhàn)學(xué)習(xí)筆記04-菜單導(dǎo)航

    添加文件與文件夾 添加文件夾 ? ./Extensions 添加文件 類型:用戶控件 ./Views/IndexView.xaml ./Views/MemoView.xaml ./Views/TodoView.xaml ./Views/SettingsView.xaml ./ViewModels/IndexViewModel.cs ./ViewModels/IndexViewModel.cs ./ViewModels/IndexViewModel.cs ./ViewModels/IndexViewModel.cs ./Extensions/PrismManager.cs 建立View與Vie

    2024年02月16日
    瀏覽(17)
  • WPF實戰(zhàn)學(xué)習(xí)筆記27-全局通知

    新建消息事件 添加文件:Mytodo.Common.Events.MessageModel.cs 注冊、發(fā)送提示消息 UI增加Snackbar 修改文件:Mytodo.Views.MainView.xaml 注冊消息 修改文件:Mytodo.Views.MainViewcs 構(gòu)造函數(shù)添加 要注意的是,我們要發(fā)送的是文本,所以,this.skbar.MessageQueue.Enqueue函數(shù)內(nèi)發(fā)送的是文本。 在需要的地

    2024年02月15日
    瀏覽(17)
  • WPF實戰(zhàn)學(xué)習(xí)筆記28-登錄界面

    添加登錄界面UI 添加文件loginview.xaml。注意本界面使用的是md內(nèi)的圖標(biāo)。沒有登錄界面的圖片 添加對應(yīng)的viewmodel 添加文件Mytodo.ViewModels.LoginViewModel.cs 注冊視圖 添加啟動 修改文件:App.xmal.cs

    2024年02月14日
    瀏覽(14)
  • WPF實戰(zhàn)學(xué)習(xí)筆記16-數(shù)據(jù)加載

    新建Update事件,增加Prism事件列表 新建文件Mytodo/Common/Events/UpdateLoadingEvent.cs 新建含加載窗體基類 新建文件Mytodo/ViewModels/NavigationViewModel.cs 建立數(shù)據(jù)加載窗體擴展方法 新建文件Mytodo/Extensions/DialogExtension.cs 主窗口命名 修改文件Mytodo/Extensions/DialogExtension.cs 主窗口訂閱消息 修改文

    2024年02月15日
    瀏覽(22)
  • WPF實戰(zhàn)學(xué)習(xí)筆記31-登錄界面全局通知

    UI添加消息聚合器 注冊提示消息 文件:Mytodo.Views.LoginView.cs構(gòu)造函數(shù)添加內(nèi)容 在需要的地方添加提示消息 修改文件:Mytodo.ViewModels.LoginViewModel.cs

    2024年02月14日
    瀏覽(24)
  • WPF實戰(zhàn)學(xué)習(xí)筆記08-創(chuàng)建數(shù)據(jù)庫

    創(chuàng)建文件夾 ./Context 創(chuàng)建文件 ./Context/BaseEnity.cs ./Context/Memo.cs ./Context/MyTodoContext.cs ./Context/Todo.cs ./Context/User.cs 創(chuàng)建數(shù)據(jù)對象 ./Context/BaseEnity.cs ./Context/Memo.cs ./Context/MyTodoContext.cs 創(chuàng)建數(shù)據(jù)庫DbSet ./Context/Todo.cs ./Context/User.cs 添加nuget包 Microsoft.EntityFrameworkCore.Design Shared design-time co

    2024年02月16日
    瀏覽(46)
  • WPF實戰(zhàn)學(xué)習(xí)筆記10-創(chuàng)建todo接口

    新建控制器 新建文件 + webapi工程 ./Controllers/TodoController.cs 添加類 ### 新建服務(wù) #### 新建文件 + webapi工程 ./Service/ApiReponse.cs ./Service/IBaseService.cs ./Service/IToDoService.cs ./Service/ToDoService.cs 添加通用返回結(jié)果類 ApiReponse.cs 添加基礎(chǔ)接口 IBaseService.cs 添加todo接口 IToDoService.cs 添加TODO接口

    2024年02月16日
    瀏覽(17)
  • WPF實戰(zhàn)學(xué)習(xí)筆記06-設(shè)置待辦事項界面

    創(chuàng)建待辦待辦事項集合并初始化 TodoViewModel: 創(chuàng)建綁定右側(cè)命令、變量 設(shè)置界面

    2024年02月15日
    瀏覽(91)
  • WPF實戰(zhàn)學(xué)習(xí)筆記13-創(chuàng)建注冊登錄接口

    添加文件 創(chuàng)建文件 + MyToDo.Api ? ./Controllers/LoginController.cs ? ./Service/ILoginService.cs ? ./Service/LoginService.cs MyToDo.Share ./Dtos/UserDto.cs LoginController.cs ILoginService.cs LoginService.cs UserDto.cs 依賴注入 Program.cs 添加 AutoMapperProfilec.s 添加

    2024年02月15日
    瀏覽(48)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包