[]
如果插件中引用了页面名,一旦页面重命名后,插件中的相关属性的值就期望被同步;
这种情况下就需要实现这个接口,而且,当查找页面的引用时,插件中的相关属性也会被查找出来。
public interface IReferencePage
public class MyNavigatePageCommand : Command, IReferencePage
{
public string NavigatePageName { get; set; }
public IEnumerable<LocatedObject<string>> GetPageNames(LocationIndicator location)
{
var newLocation = location.AppendProperty("MyNavigatePageCommand");
yield return new LocatedObject<string>(this.NavigatePageName, newLocation);
}
public void RenamePageName(string oldName, string newName)
{
if(string.Equals(this.NavigatePageName, oldName))
{
this.NavigatePageName = newName;
}
}
}
返回插件中所有引用页面的信息。
IEnumerable<LocatedObject<string>> GetPageNames(LocationIndicator location)
| 类型 | 名称 | 描述 |
|---|---|---|
| LocationIndicator | location | 坐标定位器。 |
| 类型 | 描述 |
|---|---|
| System.Collections.Generic.IEnumerable<T><LocatedObject<string>> | 返回插件中所有引用页面的信息。 |
一旦页面被重命名时会调用该函数,所以需实现该接口重命名插件中使用到的相关页面名。
void RenamePageName(string oldName, string newName)
| 类型 | 名称 | 描述 |
|---|---|---|
| string | oldName | 重命名之前的页面名。 |
| string | newName | 重命名之后的页面名。 |