Beispiel #1
0
        /// <summary>
        /// Save snapshot zip
        /// </summary>
        /// <param name="ecId">ElementContext Id</param>
        /// <param name="path">The output file</param>
        /// <param name="bmp">The screenshot</param>
        /// <param name="focusedElementId">The ID of the element with the current focus</param>
        /// <param name="mode">The type of file being saved</param>
        /// <param name="otherProperties">Properties to add to the snapshot metadata</param>
        /// <param name="completenessMode">Mode to control selective removal of data from the output</param>
        public static void SaveSnapshotZip(string path, Guid ecId, int?focusedElementId, A11yFileMode mode, Dictionary <SnapshotMetaPropertyName, object> otherProperties = null, CompletenessMode completenessMode = CompletenessMode.Full)
        {
            var ec = DataManager.GetDefaultInstance().GetElementContext(ecId);

            using (FileStream str = File.Open(path, FileMode.Create))
                using (Package package = ZipPackage.Open(str, FileMode.Create))
                {
                    if (completenessMode == CompletenessMode.Full)
                    {
                        SaveSnapshotFromElement(focusedElementId, mode, otherProperties, completenessMode, ec, package, ec.DataContext.RootElment);
                    }
                    else
                    {
                        using (A11yElement reducedRoot = SelectAction.GetDefaultInstance().POIElementContext.Element.GetScrubbedElementTree())
                        {
                            SaveSnapshotFromElement(focusedElementId, mode, otherProperties, completenessMode, ec, package, reducedRoot);
                        }
                    }
                }
        }
        /// <summary>
        /// Get the DataContext Mode of currently selected ElementContext
        /// </summary>
        /// <returns></returns>
        public static DataContextMode GetDataContextMode()
        {
            var ec = DataManager.GetDefaultInstance().GetElementContext(SelectAction.GetDefaultInstance().SelectedElementContextId.Value);

            return(ec.DataContext != null ? ec.DataContext.Mode : DataContextMode.Live);
        }