public static StoryAttributes GetAttributes(this IStory story) { var key = "s_" + story.GetUuid(); var props = Application.Current.Properties; if (props.TryGetValue(key, out var storedAttributes)) { return((StoryAttributes)Convert.ToInt32(storedAttributes)); } return(StoryAttributes.None); }
public static void SetAttribute(this IStory story, StoryAttributes attributes) { var key = "s_" + story.GetUuid(); var props = Application.Current.Properties; if (props.TryGetValue(key, out var storedAttributes)) { var castedAttributes = (StoryAttributes)Convert.ToInt32(storedAttributes); castedAttributes |= attributes; attributes = castedAttributes; } props[key] = Convert.ToInt32(attributes); }