/// <summary> /// Load From File Click Event /// </summary> /// <param name="sender">Sender Object</param> /// <param name="e">Routed Event Argument</param> private void LoadFromFileClick(object sender, RoutedEventArgs e) { try { var view = AppContext.ActiveView as ViewImage; if (view != null) { Imaging imageData = view.GetImagingData(); if (imageData != null) { ImageMetaData imageMetaData = imageData.MetaData; if (imageMetaData != null) { // get the filename (and path) with the common dialog var loadFileDialog = new CommonDialog(); var filter = new FilterEntry(Strings.XmlFileDescription, Strings.XmlFileExtension); loadFileDialog.Filters.Add(filter); loadFileDialog.ShowOpen(); string fileName = loadFileDialog.FileName; if (string.IsNullOrEmpty(fileName) || !File.Exists(fileName)) { return; } // read the meta data imageMetaData.ReadFromXml(fileName); } } } } catch (Exception ex) { Util.ReportException(ex); } }