//Pass in the full path to the style file on disk public async Task<bool> CanUpgradeStyleAsync(string stylePath) { //Add the style to the current project await QueuedTask.Run(() => StyleHelper.AddStyle(Project.Current, stylePath)); StyleProjectItem style = Project.Current.GetItems<StyleProjectItem>().First(x => x.Path == stylePath); //returns true if style can be upgraded return style.CanUpgrade; }
//Pass in the full path to the style file on disk public async Task<bool> UpgradeStyleAsync(string stylePath) { bool success = false; //Add the style to the current project await QueuedTask.Run(() => StyleHelper.AddStyle(Project.Current, stylePath)); StyleProjectItem style = Project.Current.GetItems<StyleProjectItem>().First(x => x.Path == stylePath); //Verify that style can be upgraded if (style.CanUpgrade) { success = await QueuedTask.Run(() => StyleHelper.UpgradeStyle(style)); } //return true if style was upgraded return success; }
Target Platforms: Windows 11, Windows 10, Windows 8.1