public StylePreviewViewModel(string styleFilePath) { this.styleFilePath = styleFilePath; this.name = Path.GetFileNameWithoutExtension(styleFilePath); if (File.Exists(styleFilePath)) { try { XElement rootXml = XElement.Load(styleFilePath); styleWrapper = new StyleWrapper(rootXml); if (styleWrapper.Style != null) { preview = styleWrapper.Style.GetPreview(32, 32); } else { SetDefaultPreview(); } } catch (Exception e) { GisEditor.LoggerManager.Log(LoggerLevel.Debug, e.Message, new ExceptionInfo(e)); SetDefaultPreview(); } } else { SetDefaultPreview(); } }
public StylePreviewViewModel(CompositeStyle style) { if (style != null) { styleWrapper = new StyleWrapper(0, 1000000000, style); preview = style.GetPreview(32, 32); name = style.Name; } }