예제 #1
0
        public void SaveToRedoStack(T fileInfoCollection, [CallerMemberName] string caller = "", [CallerLineNumber] int line = 0)
        {
            using (MemoryStream memStream = new MemoryStream())
            {
                bf.Serialize(memStream, fileInfoCollection ?? throw new ArgumentNullException());
                redoStack.Push(memStream.ToArray());
            }

            UpdateRedo?.Invoke(this, EventArgs.Empty);
        }
예제 #2
0
        public void SaveToRedoStack(T fileInfoCollection, [CallerMemberName] string caller = "", [CallerLineNumber] int line = 0)
        {
            using (MemoryStream memStream = new MemoryStream()) {
#pragma warning disable SYSLIB0011 // 类型或成员已过时
                bf.Serialize(memStream, fileInfoCollection ?? throw new ArgumentNullException());
#pragma warning restore SYSLIB0011 // 类型或成员已过时
                redoStack.Push(memStream.ToArray());
            }

            UpdateRedo?.Invoke(this, EventArgs.Empty);
        }
예제 #3
0
 public T LoadFromRedoStack()
 {
     if (IsRedoStackEmpty)
     {
         return(null);
     }
     using (MemoryStream memStream = new MemoryStream(redoStack.Pop()))
     {
         var ret = bf.Deserialize(memStream) as T ?? throw new InvalidCastException();
         UpdateRedo?.Invoke(this, EventArgs.Empty);
         return(ret);
     }
 }
예제 #4
0
        public T LoadFromRedoStack()
        {
            if (IsRedoStackEmpty)
            {
                return(null);
            }
            using (MemoryStream memStream = new MemoryStream(redoStack.Pop())) {
#pragma warning disable SYSLIB0011 // 类型或成员已过时
                var ret = bf.Deserialize(memStream) as T ?? throw new InvalidCastException();
#pragma warning restore SYSLIB0011 // 类型或成员已过时
                UpdateRedo?.Invoke(this, EventArgs.Empty);
                return(ret);
            }
        }