Esempio n. 1
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
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Event handler when node selection is changed in treeview.
        /// </summary>
        public void SelectedElementChanged()
        {
            if (this.ElementContext != null && GetDataAction.ExistElementContext(this.ElementContext.Id))
            {
                this.SelectedInHierarchyElement = this.ctrlHierarchy.SelectedInHierarchyElement != null ? new Tuple <Guid, int>(this.ElementContext.Id, this.ctrlHierarchy.SelectedInHierarchyElement.UniqueId) : null;

                // selection only when UI snapshot is done.
                if (this.SelectedInHierarchyElement != null && MainWin.CurrentPage == AppPage.Inspect && (InspectView)MainWin.CurrentView == InspectView.Live)
                {
                    var e = GetDataAction.GetA11yElementWithLiveData(this.SelectedInHierarchyElement.Item1, this.SelectedInHierarchyElement.Item2);
                    HollowHighlightDriver.GetDefaultInstance().SetElement(this.SelectedInHierarchyElement.Item1, this.SelectedInHierarchyElement.Item2);
                    UpdateElementInfoUI(e);
                }
            }
            else
            {
                ClearSelectedItem();
            }

            // NeedToEnableSelector is set True in SetElement
            // it is to make sure that ElementSelector is continued after populating UI
            if (EnableSelectorWhenPOISelectedInHierarchy)
            {
                // enable selector once UI update is finished.
                UpdateStateMachineForLiveMode();
                EnableSelectorWhenPOISelectedInHierarchy = false;
            }
        }
 public IHttpActionResult LiveElement(Guid id, [FromUri(Name = "ElementId")] int elementId)
 {
     try
     {
         // check whether Id exist first.
         if (GetDataAction.ExistElementContext(id))
         {
             return(Ok(GetDataAction.GetA11yElementWithLiveData(id, elementId)));
         }
         else
         {
             return(NotFound());
         }
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.ToString()));
     }
 }
        /// <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);
                }
                catch
                {
                    MessageDialog.Show(Properties.Resources.SetElementException);
                    this.Clear();
                }
            }
        }