void UpdateRenderTitle() { RenderTitle = ImGuiExt.IDWithExtra(_title, Unique.ToString()); }
public void Menu() { if (data.Files.Count <= 0) { Theme.IconMenuItem(Icons.Open, "Open Recent", false); } else { if (Theme.BeginIconMenu(Icons.Open, "Open Recent")) { int i = 0; string toOpen = null; string toDelete = null; foreach (var item in ((IEnumerable <string>)data.Files).Reverse()) { var fn = Path.GetFileName(item); var dir = Path.GetDirectoryName(item); var builder = new StringBuilder(32); //Build shortened directory name while (builder.Length < 32) { var n2 = Path.GetDirectoryName(dir); if (n2 == null) { break; } if (n2 == "/" || n2.EndsWith(":")) { string s = dir; if (!Path.EndsInDirectorySeparator(dir)) { s += Path.DirectorySeparatorChar; } builder.Insert(0, s); break; } builder.Insert(0, $"{dir.Substring(n2.Length + 1)}{Path.DirectorySeparatorChar}"); dir = n2; } dir = builder.ToString(); //Do things if (ImGui.MenuItem(ImGuiExt.IDWithExtra($"{fn} ({dir})", i++))) { if (!File.Exists(item)) { openError = true; errorText = $"File {item} was not found"; toDelete = item; } else { toOpen = item; } } } if (toOpen != null) { open(toOpen); } if (toDelete != null) { data.Files.Remove(toDelete); Save(); } ImGui.EndMenu(); } } }