/// <summary> /// Switch to test results in UIA tree, run tests on selected element, then open file bug window /// </summary> internal void HandleFileBugLiveMode() { HandlePauseButtonToggle(true); if (ctrlLiveMode.SelectedInHierarchyElement != null) { if (ctrlLiveMode.SelectedInHierarchyElement.Item2 == 0) { SetDataAction.ReleaseDataContext(SelectAction.GetDefaultInstance().GetSelectedElementContextId().Value); } else { var sa = SelectAction.GetDefaultInstance(); sa.SetCandidateElement(ctrlLiveMode.SelectedInHierarchyElement.Item1, ctrlLiveMode.SelectedInHierarchyElement.Item2); sa.Select(); } } StartElementHowToFixView(() => { Dispatcher.Invoke(() => ctrlSnapMode.ctrlHierarchy.FileBug()); }); UpdateMainWindowUI(); }
/// <summary> /// When snapshot is invoked, Request appropriate mode change. /// </summary> /// <param name="method">by which way : Beaker or Hotkey</param> internal void HandleSnapshotRequest(TestRequestSources method) { if (this.CurrentPage == AppPage.Inspect && this.CurrentView == InspectView.Live) { if (ctrlLiveMode.SelectedInHierarchyElement != null) { if (ctrlLiveMode.SelectedInHierarchyElement.Item2 == 0) { SetDataAction.ReleaseDataContext(SelectAction.GetDefaultInstance().GetSelectedElementContextId().Value); } else { var sa = SelectAction.GetDefaultInstance(); sa.SetCandidateElement(ctrlLiveMode.SelectedInHierarchyElement.Item1, ctrlLiveMode.SelectedInHierarchyElement.Item2); sa.Select(); } } // Based on Ux model feedback from PM team, we decided to go to AutomatedTestResults as default page view for snapshot. StartTestMode(TestView.AutomatedTestResults); Logger.PublishTelemetryEvent(TelemetryEventFactory.ForTestRequested( method.ToString(), SelectAction.GetDefaultInstance().Scope.ToString())); } HollowHighlightDriver.GetDefaultInstance().Clear(); UpdateMainWindowUI(); }
public PageState <TPage> ReduceSetData(PageState <TPage> state, SetDataAction action) { if (!state.IsReady) { Debug.LogWarning("PageDuck.SetData failed. Set some page before you set page data"); return(state); } state.Current.Data = action.Data; state.SetStateChanged(); return(state); }
/// <summary> /// Refresh hierarchy by clearing data context /// </summary> /// <param name="newData"></param> public void RefreshHierarchy(bool newData) { if (newData) { // keep the selected element since it is for refresh. SetDataAction.ReleaseDataContext(ElementContext.Id); } #pragma warning disable CS4014 // NOTE: We aren't awaiting this async call, so if you // touch it, consider if you need to add the await this.SetElement(this.ElementContext.Id); #pragma warning restore CS4014 }
/// <summary> /// Refresh /// </summary> public void Refresh() { // data will be asked to be captured again. so set the CurrentView right. MainWin.SetCurrentViewAndUpdateUI(TestView.CapturingData); ImageOverlayDriver.ClearDefaultInstance(); var ecId = SelectAction.GetDefaultInstance().GetSelectedElementContextId().Value; SetDataAction.ReleaseDataContext(ecId); #pragma warning disable CS4014 // NOTE: We aren't awaiting this async call, so if you // touch it, consider if you need to add the await this.SetElement(ecId); #pragma warning restore CS4014 }
/// <summary> /// 判断所有数据,检查哪些item应该显示,哪些应该不显示 /// </summary> private void CheckItemsPos() { //Debug.Log("CheckItemsPos:"); if (viewport == null) { Debug.LogError("Error viewport is null,GameObject Name:" + gameObject.name); return; } GameObject tmp = null; var viewSize = viewport.rect.size; //这里我们要求content左上角相对view节点左上角的位移,现在默认view是content的父节点 //1。anchoredPosition是pivot相对于&&&四个锚点的中心&&&的位移 //我们要用三个向量加一起计算出偏移量 var ctPivot2TopLeftOffset = new Vector2(-content.pivot.x, -content.pivot.y) * content.rect.size; var ctParentTopLeft2Anchored = new Vector2(content.anchorMin.x + content.anchorMax.x, content.anchorMin.y + content.anchorMax.y - 2) * viewSize * 0.5f; var ctAnchoredPos = ctParentTopLeft2Anchored + ctPivot2TopLeftOffset + content.anchoredPosition; //Debug.LogError("PIVOT:" + (content.pivot * viewSize).ToString() + ",pos:" + content.anchoredPosition ); Rect viewRect = new Rect(-ctAnchoredPos.x - ViewSizeMinExt.x, -viewSize.y - ctAnchoredPos.y - ViewSizeMinExt.y, viewSize.x + ViewSizeMinExt.x + ViewSizeMaxExt.x, viewSize.y + ViewSizeMinExt.y + ViewSizeMaxExt.y); //Debug.LogError(viewRect); //Debug.LogError(viewport.rect); foreach (var dp in DataAndPosProviders) { if (dp.Overlaps(viewRect)) { if (dp.VisableGO == null) { tmp = GetEmptyChildItem(dp.Data); tmp.transform.SetParent(content); dp.SetGO(tmp); if (SetDataAction != null) { SetDataAction.Invoke(tmp, dp.Data); #if UNITY_EDITOR tmp.name = "EditorRuntime_" + content.name + "_" + dp.Index.ToString(); #endif } else { #if UNITY_EDITOR tmp.name = "NoSetDataAction_" + dp.Index.ToString(); #endif } //Debug.LogError(dp.Index+" In"); } else { //暂时这么写,目前有个insert功能,可能导致已显示的GO位置不太正确,靠这个无脑刷新一下 dp.SetGO(dp.VisableGO); } } else { if (dp.VisableGO != null) { tmp = dp.VisableGO; dp.VisableGO = null; RecycleChildItem(tmp, dp.Data); //Debug.LogError(dp.Index + " Out"); } } } }