• 大小: 0.02M
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-02-23
  • 语言: C#
  • 标签: 创建  命令  C#  

资源简介

c# 使用命令方式操作功能运行

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CommandDemo
{
    public class Document : INotifyPropertyChanged
    {
        private string openFilePath;
        private string content;

        public bool IsModified { get; private set; }

        public string Content
        {
            get { return content; }
            set
            {
                if (value != content)
                {
                    content = value;
                    IsModified = true;
                    onpropertychanged(“Content“);
                    onpropertychanged(“IsModified“);
                }
            }
        }

        public void Open(string path)
        {
            Content = File.ReadAllText(path);
            openFilePath = path;
        }

        public void Save()
        {
            File.WriteAllText(ope

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件         161  2015-12-25 13:52  app.config
     目录           0  2015-12-25 14:33  Command\
     文件        4332  2015-12-25 15:13  CommandDemo.csproj
     文件        2217  2015-12-25 13:57  Command\Command.cs
     文件        3214  2015-12-25 13:55  Command\CommandBinding.cs
     文件        6410  2015-12-25 13:58  Command\CommandBindingManager.cs
     文件        5874  2015-12-25 14:33  Command\CommandParameter.cs
     文件        4680  2015-12-25 13:57  Command\CommandTarget.cs
     文件        1960  2015-12-25 13:59  Command\DelegateCommand.cs
     文件        1710  2015-12-25 15:08  Document.cs
     文件        1697  2015-12-25 15:15  MainForm.cs
     文件        6434  2015-12-25 15:15  MainForm.Designer.cs
     文件        8572  2015-12-25 15:14  MainForm.resx
     文件        1149  2015-12-25 15:12  OpenCommand.cs
     文件         495  2015-12-25 14:07  Program.cs
     目录           0  2015-12-25 13:50  Properties\
     文件        1346  2015-12-25 13:50  Properties\AssemblyInfo.cs
     文件        2862  2015-12-25 13:52  Properties\Resources.Designer.cs
     文件        5612  2015-12-25 13:50  Properties\Resources.resx
     文件        1111  2015-12-25 13:52  Properties\Settings.Designer.cs
     文件         249  2015-12-25 13:50  Properties\Settings.settings

评论

共有 条评论