I am trying to figure out:
a. How to reset the properties in the dockpane when it closes [edited: or close an Add-In]. The following code below with "SaveDirectory" is initialized when I open the dockpane for the first time, then even after closing it and opening several different projects, the value of "SaveDirectory" does not change. How do I do that?
b. I thought of resetting the value inside "UninitializeAsync()" method, but I guess "UninitializeAsync()" method is not used for that.
Thanks.
Kenny
namespace Test
{
internal class TestDockPaneViewModel : DockPane
{
private string _saveDirectory;
/// <summary>
/// Default Directory to save all user input data.
/// </summary>
public string SaveDirectory
{
get { return _saveDirectory; }
set { _saveDirectory = value; NotifyPropertyChanged(() => SaveDirectory); }
}
/// <summary>
/// Constructor
/// </summary>
protected TestDockPaneViewModel()
{
SaveDirectory = System.IO.Directory.GetCurrentDirectory();
}
/// <summary>
/// Called when the pane is uninitialized.
/// </summary>
protected async override Task UninitializeAsync()
{
// Reset Default Save Directory when dockpane closes //
SaveDirectory = null;
await base.UninitializeAsync();
}
}