Bloom.Edit.EditingModel.SavePageFrameState C# (CSharp) Method

SavePageFrameState() public method

Save anything we want to persist from page to page but which is not part of the book from the page's current state. Currently this is just the zoom level.
public SavePageFrameState ( ) : void
return void
        void SavePageFrameState()
        {
            var body = _view.GetPageBody();
            Debug.Assert(body!=null, "(Debug Only) no body when doing SavePageFrameState()" );

            // not worth crashing over a timing problem that means we don't save zoom state
            if (body == null)
                return; // BL-3075, not sure how this can happen but it has. Possibly the view is in some state like about:null which has no body.
            var styleAttr = body.Attributes["style"];

            if (styleAttr == null)
                return;
            var style = styleAttr.NodeValue;
            var match = Regex.Match(style, "scale\\(([^,]*),");
            if (!match.Success)
                return;
            var pageZoom = match.Groups[1].Value;
            if (pageZoom != Settings.Default.PageZoom)
            {
                Settings.Default.PageZoom = pageZoom;
                Settings.Default.Save();
            }
        }