/// <summary> /// Loads Ink Data from a specified ISF or JNT file /// </summary> /// <param name="inkDataFileName"> /// The file to load the Ink Data from.</param> protected void LoadRecordedData(string inkDataFileName) { // First, reset the Ink object PlaybackInk.DeleteStrokes(); if (!File.Exists(inkDataFileName)) { MessageBox.Show("Cannot find file: " + inkDataFileName); return; } // Read in the specified file FileStream isfStream = new FileStream(inkDataFileName, FileMode.Open, FileAccess.Read); // Verify the filestream creation was successful if (null != isfStream && isfStream.Length > 0) { byte[] isfBytes = new byte[isfStream.Length]; // read in the ISF doc isfStream.Read(isfBytes, 0, (int)isfStream.Length); // Load the ink into a new Temporary object // Once an Ink object has been "dirtied" it cannot load ink Microsoft.Ink.Ink TemporaryInk = new Microsoft.Ink.Ink(); // Load the ISF into the ink object TemporaryInk.Load(isfBytes); // Add the loaded strokes to our Ink object PlaybackInk.AddStrokesAtRectangle(TemporaryInk.Strokes, TemporaryInk.Strokes.GetBoundingBox()); // Close the file stream isfStream.Close(); } }
/// <summary> /// Loads Ink Data from a specified ISF or JNT file /// </summary> /// <param name="inkDataFileName"> /// The file to load the Ink Data from.</param> protected void LoadRecordedData(string inkDataFileName) { // First, reset the Ink object PlaybackInk.DeleteStrokes(); if( !File.Exists( inkDataFileName ) ) { MessageBox.Show( "Cannot find file: " + inkDataFileName ); return; } // Read in the specified file FileStream isfStream = new FileStream( inkDataFileName, FileMode.Open, FileAccess.Read ); // Verify the filestream creation was successful if (null != isfStream && isfStream.Length > 0) { byte[] isfBytes = new byte[isfStream.Length]; // read in the ISF doc isfStream.Read(isfBytes, 0, (int)isfStream.Length); // Load the ink into a new Temporary object // Once an Ink object has been "dirtied" it cannot load ink Microsoft.Ink.Ink TemporaryInk = new Microsoft.Ink.Ink(); // Load the ISF into the ink object TemporaryInk.Load(isfBytes); // Add the loaded strokes to our Ink object PlaybackInk.AddStrokesAtRectangle(TemporaryInk.Strokes, TemporaryInk.Strokes.GetBoundingBox()); // Close the file stream isfStream.Close(); } }