/// <summary> /// Update OptionModel with current effective value. /// Admin: default - "default xml"; current - "HKLM + default xml" /// User: default - "HKLM + default xml"; current - "HKCU + HKLM + default xml" /// </summary> /// <param name = "uiOptRoot"></param> /// <param name = "bAdmin"></param> private void UpdateOptionModelWithCurrent(bool bAdmin) { if (!bAdmin) { IVisitor uservisitor = new UserReadVisitor(); // update current value _optionsRoot.Accept(uservisitor); } else { IVisitor admvisitor = new AdminReadVisitor(); // update current value _optionsRoot.Accept(admvisitor); } }
void IVisitor.Visit(UIOptionRootType optionsRoot) { try { OptionApi.AdminEnter(); using (UserReadVisitor uservisitor = new UserReadVisitor()) { optionsRoot.Accept(uservisitor); } } finally { OptionApi.AdminExit(); } }