Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HistoryItem"/> class.
        /// </summary>
        /// <param name="file">The backing file.</param>
        /// <param name="historyCanvas">The history canvas.</param>
        /// <param name="currentImage">The current image.</param>
        public HistoryItem(string file, CanvasHistoryState historyCanvas, BitmapSource currentImage)
        {
            backingFile = file;
            state       = HistoryItemState.Memory;
            chunk       = new HistoryChunk(historyCanvas, currentImage);

            ToDisk();
        }
Beispiel #2
0
 /// <summary>
 /// Retrieves the HistoryChunk from disk.
 /// </summary>
 public void ToMemory()
 {
     if (state == HistoryItemState.Disk)
     {
         using (FileStream fs = new FileStream(backingFile, FileMode.Open, FileAccess.Read, FileShare.None))
         {
             BinaryFormatter bf = new BinaryFormatter();
             chunk = (HistoryChunk)bf.Deserialize(fs);
             state = HistoryItemState.Memory;
         }
     }
 }