示例#1
0
        static void CommandTest()
        {
            //Creating the receiver object
            IFileSystemReceiver fs = FileSystemReceiverUtil.getUnderlyingFileSystem();

            //creating command and associating with receiver
            OpenFileCommand openFileCommand = new OpenFileCommand(fs);

            //Creating invoker and associating with Command
            FileInvoker file = new FileInvoker(openFileCommand);

            //perform action on invoker object
            file.execute();

            WriteFileCommand writeFileCommand = new WriteFileCommand(fs);

            file = new FileInvoker(writeFileCommand);
            file.execute();

            CloseFileCommand closeFileCommand = new CloseFileCommand(fs);

            file = new FileInvoker(closeFileCommand);
            file.execute();
        }
示例#2
0
 public WriteFileCommand(IFileSystemReceiver fs)
 {
     this.fileSystem = fs;
 }
 public WriteFileCommand(IFileSystemReceiver receiver)
 {
     _receiver = receiver;
 }
 public ReadFileCommand(IFileSystemReceiver receiver)
 {
     _receiver = receiver;
 }
示例#5
0
 public OpenFileCommand(IFileSystemReceiver fs)
 {
     this.fileSystem = fs;
 }
 public CloseFileCommand(IFileSystemReceiver receiver)
 {
     _receiver = receiver;
 }
示例#7
0
 public OpenFileCommand(IFileSystemReceiver receiver)
 {
     _receiver = receiver;
 }