I am trying to update the Name/Display Name of a Petrel Window after the Save event.
I implemented my own NameInfo class that inherits from the NameInfo abstract class.
public class MyNameInfo : NameInfo
{
private string name = string.Empty;
private string displayName = string.Empty;
private string typeName = string.Empty;
public override bool CanChangeName
{
get { return true; } //I return true so I can change the name at runtime.
}
//Rest of the class implementation
}
My DisplayName, Name and TypeName has to be the same, so when the name is changed my code is:
public override string Name
{
get { return this.name; }
set
{
name = value;
displayName = value;
typeName = value;
OnNameChanged(this);
}
}
I change the name of my window on the "Saved" event of the DataSourceManager:
DataManager.DataSourceManager.Saved += OnSave;
The code I use to update the name is:
if(NameInfo.CanChangeName)
NameInfo.Name = NewName;
But when I change the name, it appears updated only in the tree of the Windows window.
The Name of my window shows the old name.
I dont know what else I have to do to achieve what I want.
My Window is a custom window
public class MyCustomWindow : ToggleWindow, INameInfoSource, IDeletable
{
Is there a way to update the Window Name itself?
Do I have to subscribe my "MyCustomWindow" to some event and I am not doing it?
I will really appreciate any help you can offer me!