/// <summary>
 /// Clear UI
 /// </summary>
 public void Clear()
 {
     this.ElementContext = null;
     this.ctrlTabs.Clear();
     this.ctrlTabs.CtrlEventConfig.Clear();
     this.ctrlEvents.Clear();
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Merge a results file into the local issue store. This clears all internal data contexts
        /// </summary>
        /// <param name="path">Path to the file to merge</param>
        /// <returns>The number of changes (additions or merges) to the store</returns>
        public static int MergeOutputFileToIssueStore(string path)
        {
            int changeCount = 0;

            try
            {
                Tuple <Guid, SnapshotMetaInfo> loadInfo = SelectAction.GetDefaultInstance().SelectLoadedData(path);

                ElementContext elementContext = DataManager.GetDefaultInstance().GetElementContext(loadInfo.Item1);
                IIssueStore    storeToMerge   = new OutputFileIssueStore(path, elementContext.DataContext.Elements.Values);

                changeCount = SessionIssueStore.GetInstance().MergeIssuesFromStore(storeToMerge);
            }
#pragma warning disable CA1031 // Do not catch general exception types
            catch (Exception e)
            {
                e.ReportException();
            }
#pragma warning restore CA1031 // Do not catch general exception types
            finally
            {
                SelectAction.GetDefaultInstance().ClearSelectedContext();
            }
            return(changeCount);
        }
Ejemplo n.º 3
0
        public async Task <double> UpdateProfileAmountAsync(int employeeId, int profileId, double amount)
        {
            try
            {
                var context = new ElementContext();
                var profile = context.Profiles.Find(profileId);
                if (profile != null)
                {
                    if (profile.Count > amount && amount > 0)
                    {
                        profile.Amount = amount;
                        profile.ElementInfos.Add(new ElementInfo()
                        {
                            Amount = amount, EmployeeId = employeeId, Time = DateTime.Now
                        });

                        context.Entry(profile).State = EntityState.Modified;
                        var result = await context.SaveChangesAsync();

                        if (result > 0)
                        {
                            return(await Task.FromResult(profile.Amount));
                        }
                    }
                }

                return(await Task.FromResult <double>(-1));
            }
            catch (Exception ex)
            {
                PrintException(ex);
                throw new FaultException(ex.Message, new FaultCode("UpdateProfileAmountAsync"), "UpdateProfileAmountAsync");
            }
        }
        /// <summary>
        /// Set Element to populate UI
        /// </summary>
        /// <param name="e"></param>
        /// <param name="isLiveData">if it is false, it means that data is stale. refresh button should be disabled.</param>
        public void SetElement(ElementContext ec, bool expandall = false)
        {
            if (ec != null)
            {
                this.ElementContext = ec;
                if (ec.Element.PlatformObject != null)
                {
                    PopulateHierarchyTree(ec, expandall);
                }
                else
                {
                    UpdateTreeView(ec.DataContext.GetRootNodeHierarchyViewModel(Configuration.ShowAncestry, Configuration.ShowUncertain, this.IsLiveMode), expandall);
                    this.SelectedElement = ec.Element;
                }

                UpdateButtonVisibility();

                // We remove and re-add the "show uncertain" item from the visual tree
                // in order to ensure n-of-m information is read correctly
                // by screen readers via the SizeOfSet and PositionInSet properties.
                if (cmHierarchySettings.Items.Contains(mniShowUncertain))
                {
                    cmHierarchySettings.Items.Remove(mniShowUncertain);
                }
                if (this.IsLiveMode == false)
                {
                    cmHierarchySettings.Items.Add(mniShowUncertain);
                }
            }
        }
        /// <summary>
        /// Populate Hierarchy tree in live mode
        /// </summary>
        /// <param name="ec"></param>
        /// <param name="expandall"></param>
        private void PopulateHierarchyTree(ElementContext ec, bool expandall)
        {
            var begin = DateTime.Now;
            HierarchyNodeViewModel rnvm = null;

            var tm    = Configuration.TreeViewMode;
            var showa = Configuration.ShowAncestry;

            /// in the case that UIElement is not alive any more, it will fail.
            /// we need to handle it properly
            rnvm = ec.DataContext.GetRootNodeHierarchyViewModel(Configuration.ShowAncestry, Configuration.ShowUncertain, this.IsLiveMode);

            // send exception to mode control.
            if (rnvm == null)
            {
                throw new ApplicationException(Properties.Resources.HierarchyControl_PopulateHierarchyTree_No_data_to_populate_hierarchy);
            }

            UpdateTreeView(rnvm, expandall);

            this.SelectedElement = ec.Element;
            var span = DateTime.Now - begin;

            this.tbTimeSpan.Visibility = Visibility.Collapsed;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Sets element context and updates UI
        /// </summary>
        /// <param name="ec"></param>
        public void SetElement(ElementContext ec)
        {
            if (ec == null)
            {
                throw new ArgumentNullException(nameof(ec));
            }

            try
            {
                // set handler here. it will make sure that highliter button is shown and working.
                ImageOverlayDriver.GetDefaultInstance().SetHighlighterButtonClickHandler(TBElem_Click);

                if (this.ElementContext == null || ec.Element != this.ElementContext.Element || this.DataContext != ec.DataContext)
                {
                    this.lblCongrats.Visibility  = Visibility.Collapsed;
                    this.lblNoFail.Visibility    = Visibility.Collapsed;
                    this.gdFailures.Visibility   = Visibility.Collapsed;
                    this.DataContext             = ec.DataContext;
                    this.chbxSelectAll.IsEnabled = ScreenshotAvailable;
                    this.lvResults.ItemsSource   = null;
                    this.ElementContext          = ec;
                    this.tbGlimpse.Text          = "Target: " + ec.Element.Glimpse;
                    UpdateUI();
                }
            }
#pragma warning disable CA1031 // Do not catch general exception types
            catch (Exception e)
            {
                e.ReportException();
            }
#pragma warning restore CA1031 // Do not catch general exception types
        }
        public void CaptureScreenShot_ElementWithoutBoundingRectangle_NoScreenShot()
        {
            using (var dm = new DataManager())
            {
                // no bounding rectangle.
                A11yElement element = new A11yElement
                {
                    UniqueId = 42,
                };

                var dc = new ElementDataContext(element, 1);

                var elementContext = new ElementContext(element)
                {
                    DataContext = dc,
                };

                dm.AddElementContext(elementContext);

                ScreenShotAction.GetDataManager = () => dm;

                ScreenShotAction.CaptureScreenShot(elementContext.Id);

                Assert.IsNull(dc.Screenshot);
                Assert.AreEqual(default(int), dc.ScreenshotElementId);
            }
        }
Ejemplo n.º 8
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="config"></param>
 /// <param name="ec"></param>
 /// <param name="listener"></param>
 private ListenAction(ListenScope listenScope, ElementContext ec, HandleUIAutomationEventMessage listener)
 {
     this.Id               = Guid.NewGuid();
     this.ElementContext   = ec;
     this.EventListener    = new EventListenerFactory(ec.Element, listenScope);
     this.ExternalListener = listener;
 }
Ejemplo n.º 9
0
        public override string VisitElement(ElementContext context)
        {
            if (context.TEXT() != null)
            {
                return(Text(context.TEXT()));
            }
            if (context.random() != null)
            {
                return(VisitRandom(context.random()));
            }
            if (context.RANDOMDESCRIPTION() != null)
            {
                return(Generator.Description);
            }
            if (context.RANDOMSET() != null)
            {
                return(Generator.Setting);
            }
            if (context.RANDOMNAME() != null)
            {
                return(Generator.FullName);
            }
            if (context.RANDOMPLACE() != null)
            {
                return(Generator.Location);
            }

            return("The definition of inscrutability.");
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Sets element context and updates UI
        /// </summary>
        /// <param name="ec"></param>
        public void SetElement(ElementContext ec)
        {
            this.ElementContext = ec;
            var bm = ec.Element.CaptureBitmap();

            RunAutoCCA(bm);
        }
        /// <summary>
        /// Updates the background image, adds a border in order to enable
        /// pixel selection around the edges, and modifies the size of this window
        /// </summary>
        /// <param name="context">ElementContext containing screenshot</param>
        public void UpdateBackground(ElementContext context)
        {
            var screenshot = context?.DataContext?.Screenshot;

            this.EC = context;
            if (screenshot != null)
            {
                this.backgroundImageScale = Axe.Windows.Desktop.Utility.ExtensionMethods.GetDPI(
                    (int)System.Windows.Application.Current.MainWindow.Top,
                    (int)System.Windows.Application.Current.MainWindow.Left);

                // Increase size and add white border (this is so we can magnify the corners without having to worry about resizing the magnifier preview
                System.Drawing.Bitmap newBitmap = new System.Drawing.Bitmap((int)(screenshot.Width + MagnifyRadius * 2), (int)(screenshot.Height + MagnifyRadius * 2));
                using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(newBitmap))
                {
                    g.Clear(System.Drawing.Color.White);
                    g.DrawImageUnscaled(screenshot, MagnifyRadius, MagnifyRadius);
                }

                // Size to scale to
                var ourImageWidth  = (screenshot.Width + MagnifyRadius * 2) / this.backgroundImageScale;
                var ourImageHeight = (screenshot.Height + MagnifyRadius * 2) / this.backgroundImageScale;
                this.background     = newBitmap;
                this.image.Source   = background.ConvertToSource();
                this.image.Width    = ourImageWidth;
                this.image.Height   = ourImageHeight;
                this.grid.MaxWidth  = ourImageWidth;
                this.grid.MaxHeight = ourImageHeight;
                this.Width          = Math.Min(Math.Max(ourImageWidth, MIN_INITIAL_WINDOW_WIDTH), INITIAL_WINDOW_WIDTH);
                this.Height         = Math.Min(Math.Max(ourImageHeight, MIN_INITIAL_WINDOW_HEIGHT), INITIAL_WINDOW_HEIGHT);

                ChangeMagnifierPositionBy(0, 0); // shows initial magnified state
            }
        }
        /// <summary>
        /// Sets element context and updates UI
        /// </summary>
        /// <param name="ec"></param>
        public void SetElement(ElementContext ec)
        {
            this.ElementContext = ec ?? throw new ArgumentNullException(nameof(ec));
            var bm = ec.Element.CaptureBitmap();

            RunAutoCCA(bm);
        }
Ejemplo n.º 13
0
 public void RenderNotify(ElementContext context)
 {
     if (this.Preset != RadiosityPreset.None)
     {
         context.Scene.Include.RadDef = true;
     }
 }
Ejemplo n.º 14
0
 /// <summary>
 /// Set element Context
 /// </summary>
 /// <param name="ec"></param>
 internal void AddElementContext(ElementContext ec)
 {
     if (ec != null && this.ElementContexts.ContainsKey(ec.Id) == false)
     {
         this.ElementContexts.Add(ec.Id, ec);
     }
 }
Ejemplo n.º 15
0
        IControl CreateLeftPane(
            LiveProject project,
            ElementContext elementContext,
            IContext context,
            IShell fileSystem,
            IClassExtractor classExtractor)
        {
            return(Modal.Host(modalHost =>
            {
                var makeClassViewModel = new ExtractClassButtonViewModel(
                    project,
                    context,
                    dialogModel => ExtractClassView.OpenDialog(modalHost, dialogModel),
                    fileSystem,
                    classExtractor);

                var hierarchy = TreeView.Create(
                    new TreeViewModel(
                        context,
                        makeClassViewModel.HighlightSelectedElement,
                        elementContext.CreateMenu));

                return Layout.Dock()
                .Bottom(Toolbox.Toolbox.Create(project, elementContext))
                .Top(ExtractClassView.CreateButton(makeClassViewModel))
                .Fill(hierarchy);
            }));
        }
Ejemplo n.º 16
0
        public void CaptureScreenShot_ElementWithBoundingRectangle_ScreenShotCreated()
        {
            using (var dm = new DataManager())
            {
                A11yElement element = new A11yElement
                {
                    UniqueId = 42,
                };

                SetBoundingRectangle(element, new Rectangle(0, 0, 10, 10));

                var dc = new ElementDataContext(element, 1);

                var elementContext = new ElementContext(element)
                {
                    DataContext = dc,
                };

                dm.AddElementContext(elementContext);

                ScreenShotAction.GetDataManager = () => dm;
                ScreenShotAction.CopyFromScreen = (g, x, y, s) => { };

                ScreenShotAction.CaptureScreenShot(elementContext.Id);

                Assert.IsNotNull(dc.Screenshot);
                Assert.AreEqual(element.UniqueId, dc.ScreenshotElementId);
            }
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Update Element Info UI(Properties/Patterns/Tests)
        /// </summary>
        /// <param name="ec"></param>
#pragma warning disable CS1998
        public async Task SetElement(Guid ecId)
        {
            var ec = GetDataAction.GetElementContext(ecId);

            if (ec != null)
            {
                this.ctrlTabs.CurrentMode = InspectTabMode.Events;
                try
                {
                    // the element context is special one for Event. so it doen't have any data yet.
                    // need to populate data with selected element.
                    var e = GetDataAction.GetA11yElementWithLiveData(ecId, 0);
                    this.ElementContext = ec;
                    this.ctrlEvents.SetElement(ec);
                    UpdateUI(e);
                    this.ctrlTabs.CtrlEventConfig.SetElement(e);
                }
#pragma warning disable CA1031 // Do not catch general exception types
                catch (Exception e)
                {
                    e.ReportException();
                    MessageDialog.Show(Properties.Resources.SetElementException);
                    this.Clear();
                }
#pragma warning restore CA1031 // Do not catch general exception types
            }
        }
Ejemplo n.º 18
0
        public void CaptureScreenShotOnWCOS_ElementWithBoundingRectangle_NoScreenShot()
        {
            using (var dm = new DataManager())
            {
                A11yElement element = new A11yElement
                {
                    UniqueId = 42,
                };

                SetBoundingRectangle(element, new Rectangle(0, 0, 10, 10));

                var dc = new ElementDataContext(element, 1);

                var elementContext = new ElementContext(element)
                {
                    DataContext = dc,
                };

                dm.AddElementContext(elementContext);

                ScreenShotAction.GetDataManager = () => dm;
                ScreenShotAction.CreateBitmap   = (w, h) => throw new TypeInitializationException("Bitmap", null);

                ScreenShotAction.CaptureScreenShot(elementContext.Id);

                Assert.IsNull(dc.Screenshot);
                Assert.AreEqual(default(int), dc.ScreenshotElementId);
            }
        }
Ejemplo n.º 19
0
        /// <summary>
        ///  clean up UI and properties.
        /// </summary>
        public void Clear()
        {
            this.ElementContext = null;

            ClearEventRecordGrid();

            this.btnRecord.Visibility = Visibility.Visible;
        }
Ejemplo n.º 20
0
        /// <summary>
        /// Clear UI controls
        /// </summary>
        public void Clear()
        {
            ctrlHierarchy.Visibility  = Visibility.Collapsed;
            spInstructions.Visibility = Visibility.Visible;

            this.ElementContext = null;
            this.ctrlHierarchy.Clear();
            this.ctrlTabs.Clear();
        }
Ejemplo n.º 21
0
        public static IControl Create(IProject project, ElementContext elementContext)
        {
            var m = Spacer.Medium.DesiredSize.Width;
            var s = Spacer.Small.DesiredSize.Width;

            var hasClasses   = project.Classes.Select(x => x.Any());
            var searchString = Property.Create("");

            return(Layout.Dock()
                   .Top(Layout.Dock()
                        .Top(Separator.Medium)
                        .Bottom(Separator.Weak)
                        .Bottom(Separator.Medium)
                        .Left(Spacer.Medium)
                        .Left(Icons.ClassesSmall())
                        .Left(Spacer.Small)
                        .Left(Theme.Header("Your classes"))
                        .Fill()
                        .WithHeight(26))
                   .Top(ThemedTextBox
                        .Create(searchString)
                        .WithPlaceholderText(searchString.Select(str => str != ""), "Search your classes")
                        .WithMediumPadding()
                        .ShowWhen(hasClasses))
                   .Top(
                       Layout.StackFromLeft(
                           Icons.DragIconSmall(),
                           Spacer.Small,
                           Label.Create(
                               "Drag classes into the hierarchy \nto insert instances of them",
                               font: Theme.DefaultFont,
                               textAlignment: TextAlignment.Left,
                               color: Theme.DescriptorText),
                           Spacer.Medium)
                       .ShowWhen(hasClasses)
                       .CenterHorizontally())
                   .Top(
                       Layout.StackFromLeft(
                           Icons.ExtractClass(hasClasses),
                           Spacer.Small,
                           Label.Create(
                               "Create a class from elements in the \nhierarchy and it will appear here",
                               font: Theme.DefaultFont,
                               textAlignment: TextAlignment.Left,
                               color: Theme.DescriptorText),
                           Spacer.Medium)
                       .WithMediumPadding()
                       .HideWhen(hasClasses)
                       .CenterHorizontally())
                   .Fill(
                       project.Classes
                       .CachePerElement(e => CreateClassItem(e, project.Context, elementContext, searchString))
                       .StackFromTop()
                       .WithPadding(left: m, top: s, right: m, bottom: s)
                       .MakeScrollable(darkTheme: Theme.IsDark))
                   .MakeResizable(RectangleEdge.Top, "MyClassesHeight"));
        }
Ejemplo n.º 22
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="config"></param>
 /// <param name="ec"></param>
 /// <param name="listener"></param>
 private ListenAction(RecorderSetting config, ElementContext ec, HandleUIAutomationEventMessage listener)
 {
     this.Id               = Guid.NewGuid();
     this.Config           = config;
     this.ElementContext   = ec;
     this.EventListener    = new EventListenerFactory(ec.Element, config.ListenScope);
     this.EventRecords     = new List <IA11yEventMessage>();
     this.ExternalListener = listener;
 }
        protected override IApplicationModule OnBuild(IApplication application)
        {
            var context = new ElementContext {
                application
            };
            IElementModuleDescription description = GetDescription();

            return(new ElementModule(context, description));
        }
Ejemplo n.º 24
0
        public static string RenderElement(SceneElement element)
        {
            SceneWriter     output       = new SceneWriter();
            OutputAttribute outputAttr   = OutputAttribute.Combine(element.GetAllAttributes <OutputAttribute>());
            ElementContext  sceneContext = new ElementContext(new ElementContext(null, new Scene()), element, outputAttr);

            sceneContext.LoadChildren(true);
            sceneContext.Write(output);
            return(output.ToString());
        }
Ejemplo n.º 25
0
        public DateTimeContext(String[] months)
        {
            _day   = new ElementContext(this, Type.Day);
            _month = new ElementContext(this, Type.Month);
            _year  = new ElementContext(this, Type.Year);

            _hour   = new ElementContext(this, Type.Hour);
            _minute = new ElementContext(this, Type.Minute);

            _months = months;
        }
Ejemplo n.º 26
0
 public Task <List <ProfileDTO> > GetElementProfilesAsync(int plantOrderId, int divisionId)
 {
     try
     {
         var context  = new ElementContext();
         var list     = context.Profiles.Where(x => x.PlantOrderId == plantOrderId && x.DivisionId == divisionId).ToList();
         var profiles = AutoMapperConfiguration.Mapper.Map <List <Profile>, List <ProfileDTO> >(list);
         return(Task.FromResult(profiles));
     }
     catch (Exception ex)
     {
         PrintException(ex);
         throw new FaultException(ex.Message, new FaultCode("GetProfiles"), "GetProfiles");
     }
 }
Ejemplo n.º 27
0
 public Task <List <ProfileDTO> > GetProfilesAsync(int plantOrderId)
 {
     try
     {
         var context  = new ElementContext();
         var profiles = context.Profiles.Where(x => x.PlantOrderId == plantOrderId)?.Include(e => e.ElementInfos).ToList();
         var result   = AutoMapperConfiguration.Mapper.Map <List <Profile>, List <ProfileDTO> >(profiles);
         return(Task.FromResult(result));
     }
     catch (Exception ex)
     {
         PrintException(ex);
         throw new FaultException(ex.Message, new FaultCode("GetProfilesAsync"), "GetProfilesAsync");
     }
 }
        public void ResetMocks()
        {
            mockDataManager       = new DataManager();
            mockElement           = new A11yElement();
            mockElement.UniqueId  = 0;
            mockElementContext    = new ElementContext(mockElement);
            irrelevantMaxElements = 10;
            mockDataContext       = new ElementDataContext(mockElement, irrelevantMaxElements);
            mockTreeViewMode      = (TreeViewMode)(-1);

            mockElementContext.DataContext = mockDataContext;
            mockDataContext.TreeMode       = mockTreeViewMode;
            mockDataContext.Mode           = DataContextMode.Live;
            mockDataManager.AddElementContext(mockElementContext);
        }
Ejemplo n.º 29
0
        public ElementContext element()
        {
            ElementContext _localctx = new ElementContext(Context, State);

            EnterRule(_localctx, 18, RULE_element);
            try
            {
                State = 68;
                switch (TokenStream.La(1))
                {
                case INTEGER:
                    EnterOuterAlt(_localctx, 1);
                    {
                        State = 65; move_number_indication();
                    }
                    break;

                case SYMBOL:
                    EnterOuterAlt(_localctx, 2);
                    {
                        State = 66; san_move();
                    }
                    break;

                case NUMERIC_ANNOTATION_GLYPH:
                    EnterOuterAlt(_localctx, 3);
                    {
                        State = 67; Match(NUMERIC_ANNOTATION_GLYPH);
                    }
                    break;

                default:
                    throw new NoViableAltException(this);
                }
            }
            catch (RecognitionException re)
            {
                _localctx.exception = re;
                ErrorHandler.ReportError(this, re);
                ErrorHandler.Recover(this, re);
            }
            finally
            {
                ExitRule();
            }
            return(_localctx);
        }
        /// <summary>
        /// Sets element context and updates UI
        /// </summary>
        /// <param name="ec"></param>
        public void SetElement()
        {
            var ecId = SelectAction.GetDefaultInstance().SelectedElementContextId;

            if (ecId.HasValue)
            {
                ElementContext ec = GetDataAction.GetElementContext(ecId.Value);
                this.ElementContext = ec;
                var brush         = Application.Current.Resources["HLTextBrush"] as SolidColorBrush;
                var overlayDriver = ClearOverlayDriver.GetDefaultInstance();
                overlayDriver.SetElement(ElementContext.Element, brush, null, 0);
                if (this.IsVisible && HighlightVisibility)
                {
                    overlayDriver.Show();
                }
            }
        }
Ejemplo n.º 31
0
        private void Read(XmlReader reader, CancellationToken token, ElementContext context)
        {
            var parentContexts = new Stack<ElementContext>();
            var elements = new Stack<string>(); // Path

            // TODO: If path was loaded previously, skip it.

            while (reader.Read())
            {
                if (token.IsCancellationRequested)
                    return;

                switch (reader.NodeType)
                {
                    case XmlNodeType.Element:
                        var elementName = reader.Name;

                        context.IncrementChildNameCount(elementName);

                        elementName = $"{elementName}[{context.ChildrenNamesCounts[elementName]}]";

                        if (!reader.IsEmptyElement)
                        {
                            elements.Push(elementName);

                            ConsoleHelpers.Debug("{0} starting...",
                                elements.Count <= 20 ? ToXPath(elements) : elementName); // XPath

                            var element = _storage.CreateElement(name: elementName);

                            parentContexts.Push(context);
                            _storage.AttachElementToParent(elementToAttach: element, parent: context.Parent);

                            context = new ElementContext(element);
                        }
                        else
                        {
                            ConsoleHelpers.Debug("{0} finished.", elementName);
                        }

                        break;

                    case XmlNodeType.EndElement:

                        ConsoleHelpers.Debug("{0} finished.",
                            elements.Count <= 20 ? ToXPath(elements) : elements.Peek()); // XPath

                        var topElement = elements.Pop();

                        // Restoring scope
                        context = parentContexts.Pop();

                        if (topElement.StartsWith("page"))
                        {
                            //if (context.ChildrenNamesCounts["page"] % 100 == 0)
                            Console.WriteLine(topElement);
                        }

                        break;

                    case XmlNodeType.Text:
                        ConsoleHelpers.Debug("Starting text element...");

                        var content = reader.Value;
                            
                        ConsoleHelpers.Debug("Content: {0}{1}", content.Truncate(50), content.Length >= 50 ? "..." : "");

                        var textElement = _storage.CreateTextElement(content: content);

                        _storage.AttachElementToParent(textElement, context.Parent);

                        ConsoleHelpers.Debug("Text element finished.");

                        break;
                }
            }
        }
Ejemplo n.º 32
0
 public override void WriteStartDocument(bool standalone)
 {
     DocumentRoot.Standalone = standalone;
     DocumentRoot.IndexNode(m_pageFile.Count);
     m_pageFile.AddNode(-1, DocumentRoot, new XdmDocument());
     m_pageFile[0] = 0;
     context = new ElementContext(null);
     context.pos = 0;
 }
Ejemplo n.º 33
0
 public override void WriteStartElement(string prefix, string localName, string ns)
 {
     CompleteElement(false);
     int pos = -1;
     cflag = true;
     if (context != null)
         pos = context.pos;
     context = new ElementContext(context);
     if (prefix == null)
         prefix = String.Empty;
     if (localName == null)
         throw new ArgumentException();
     if (ns == null)
         ns = String.Empty;
     context.node = (DmElement)_parent.CreateChild(new DmQName(prefix, localName, ns, NameTable));
     context.pos = m_pageFile.Count;
     context.element = new XdmElement();
     context.isEmptyElement = IsEmptyElement;
     if (NamespaceManager != null && NamespaceInheritanceMode == NamespaceInheritanceMode.Inherit)
         context.inheritedScope = NamespaceManager.GetNamespacesInScope(XmlNamespaceScope.Local);            
 }
Ejemplo n.º 34
0
 public override void WriteEndElement()
 {
     bool isLeaf = cflag;
     CompleteElement(true);
     if (context.scopeFlag)
         NamespaceManager.PopScope();
     if (SchemaInfo != null && SchemaInfo.SchemaElement != null)
         context.node.SchemaInfo = SchemaInfo;
     LastElementEnd = context.pos;
     if (!isLeaf)
     {
         m_pageFile[context.pos] = m_pageFile.Count + 1;                
         m_pageFile.AddNode(-1, null, null);
         m_pageFile[m_pageFile.Count - 1] = LastElementEnd;
     }
     _parent = (DmContainer)context.node.ParentNode;
     context = context.parent;
 }        
Ejemplo n.º 35
0
 public ElementContext(ElementContext parent)
 {
     this.parent = parent;
 }