void TextChanged() { var text = xmlEditor.GetText(); if (string.IsNullOrEmpty(text) || string.IsNullOrWhiteSpace(text)) { objectMaps = null; validXml = false; widget = null; exceptionText = "Nothing typed yet"; return; } try { objectMaps = new List <XmlObjectMap>(); widget = (UiWidget)mainWindow.UiData.XmlLoader.FromString(text, objectMaps); if (mainWindow.UiData.Stylesheet != null) { widget.ApplyStylesheet(mainWindow.UiData.Stylesheet); } context.SetWidget(widget); validXml = true; } catch (Exception ex) { validXml = false; exceptionText = $"Invalid XML\n\n{ex.Message}\n{ex.StackTrace}"; } }
public void CreateContext(MainWindow window) { var uidata = new UiData(); uidata.FileSystem = window.GameData.VFS; uidata.DataPath = window.GameData.Ini.Freelancer.DataPath; if (window.GameData.Ini.Navmap != null) { uidata.NavmapIcons = new IniNavmapIcons(window.GameData.Ini.Navmap); } else { uidata.NavmapIcons = new NavmapIcons(); } uidata.Fonts = window.GetService <FontManager>(); uidata.ResourceManager = window.Resources; ctx = new UiContext(uidata); ctx.RenderContext = window.RenderContext; navmap = new Navmap(); navmap.Width = 480; navmap.Height = 480; navmap.LetterMargin = true; navmap.MapBorder = true; ctx.SetWidget(navmap); this.win = window; }
public void CreateContext(MainWindow window) { var uidata = new UiData(); uidata.FileSystem = window.GameData.VFS; uidata.Fonts = window.GetService <FontManager>(); uidata.ResourceManager = window.Resources; ctx = new UiContext(uidata); ctx.RenderState = window.RenderState; ctx.Renderer2D = window.Renderer2D; navmap = new Navmap(); navmap.Width = 480; navmap.Height = 480; navmap.LetterMargin = true; navmap.MapBorder = true; ctx.SetWidget(navmap); this.win = window; }