Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public HomeUserControl()
XmlRootAttribute xmlRootAttribute = new("MenuDataItems");
XmlSerializer serializer = new(typeof(ObservableCollection<MenuDataItem>), xmlRootAttribute);

using XmlReader reader = XmlReader.Create(FilePath.GetAbsolutePath("Menu.xml"));
using XmlReader reader = XmlReader.Create(CommonFunctions.GetMenuFilePath());

m_menuDataItems = (ObservableCollection<MenuDataItem>)serializer.Deserialize(reader);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public HomeUserControl()
XmlRootAttribute xmlRootAttribute = new("MenuDataItems");
XmlSerializer serializer = new(typeof(ObservableCollection<MenuDataItem>), xmlRootAttribute);

using XmlReader reader = XmlReader.Create(FilePath.GetAbsolutePath("Menu.xml"));
using XmlReader reader = XmlReader.Create(CommonFunctions.GetMenuFilePath());

m_menuDataItems = (ObservableCollection<MenuDataItem>)serializer.Deserialize(reader);
}
Expand Down
16 changes: 16 additions & 0 deletions Source/Libraries/GSF.TimeSeries/UI/CommonFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,22 @@ public static bool CanGoBack

// Static Methods

/// <summary>
/// Gets the absolute path to the manager menu definition file, preferring a deployment-specific
/// <c>Menu.Custom.xml</c> when present and otherwise falling back to the default <c>Menu.xml</c>.
/// </summary>
/// <returns>Absolute path to <c>Menu.Custom.xml</c> when it exists; otherwise to <c>Menu.xml</c>.</returns>
/// <remarks>
/// This allows custom or licensed deployments to override the manager menu by simply adding a
/// <c>Menu.Custom.xml</c> alongside the application, without overwriting the base-installed
/// <c>Menu.xml</c> (which would create a Windows Installer component-ownership conflict).
/// </remarks>
public static string GetMenuFilePath()
{
string customMenuPath = FilePath.GetAbsolutePath("Menu.Custom.xml");
return System.IO.File.Exists(customMenuPath) ? customMenuPath : FilePath.GetAbsolutePath("Menu.xml");
}

#region [ AdoDataConnection Extension Methods ]

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public HomeUserControl()
XmlRootAttribute xmlRootAttribute = new XmlRootAttribute("MenuDataItems");
XmlSerializer serializer = new XmlSerializer(typeof(ObservableCollection<MenuDataItem>), xmlRootAttribute);

using (XmlReader reader = XmlReader.Create(FilePath.GetAbsolutePath("Menu.xml")))
using (XmlReader reader = XmlReader.Create(CommonFunctions.GetMenuFilePath()))
{
m_menuDataItems = (ObservableCollection<MenuDataItem>)serializer.Deserialize(reader);
}
Expand Down
Loading