private IEnumerator PropertyTestA() { var model = new ViewA() { StringValue = "Test", }; var intProperty = typeof(ViewA).GetProperty("IntValue"); var stringProperty = typeof(ViewA).GetProperty("StringValue"); var test = RunActionAsync("PropertyTestA", propertyTestCount, () => { for (int i = 0; i < propertyTestCount; i++) { // update int value int count = (int)intProperty.GetValue(model, null) + 1; intProperty.SetValue(model, count, null); string stringValue = (string)stringProperty.GetValue(model, null); stringProperty.SetValue(model, stringValue, null); } Assert.AreEqual(propertyTestCount, model.IntValue); }); yield return(StartCoroutine(test)); }
private IEnumerator LoopTestA2() { var model = new ModelA(); var view = new ViewA(); var binding = new Binding("StringValue", view, "StringValue"); binding.Bind(model); string[] stringTable = new string[] { "A", "B", "C", }; var test = RunActionLoopAsync("LoopTestA2", loopTestCount, () => { for (int i = 0; i < innerLoopCount; i++) { var stringIndex = i % stringTable.Length; var str = stringTable[stringIndex]; // update value model.StringValue = str; Assert.AreEqual(str, view.StringValue); } }); yield return(StartCoroutine(test)); }
private IEnumerator PropertyTestB() { // wait one frame yield return(null); var model = new ViewA(); var intProperty = typeof(ViewA).GetProperty("IntValue"); var stringProperty = typeof(ViewA).GetProperty("StringValue"); var intPropertyAccessor = TypeCache.Instance.GetPropertyAccessor(intProperty); var stringPropertyAccessor = TypeCache.Instance.GetPropertyAccessor(stringProperty); var test = RunActionAsync("PropertyTestB", propertyTestCount, () => { for (int i = 0; i < propertyTestCount; i++) { int count = (int)intPropertyAccessor.GetValue(model) + 1; intPropertyAccessor.SetValue(model, count); string stringValue = (string)stringPropertyAccessor.GetValue(model); stringPropertyAccessor.SetValue(model, stringValue); } Assert.AreEqual(propertyTestCount, model.IntValue); }); yield return(StartCoroutine(test)); }
private async void Button_Clicked(object sender, EventArgs e) { Page root = _navPage.Navigation.NavigationStack[0]; await _navPage.Navigation.PopToRootAsync(false); Page newRoot = null; var btn = (Button)sender; if (btn.Text == "ViewA") { newRoot = new ViewA(); } else { newRoot = new ViewB(); } await _navPage.Navigation.PushAsync(newRoot); _navPage.Navigation.RemovePage(root); IsPresented = false; }
private IEnumerator NotifyTestA2() { var modelList = new List <ModelA>(); var bindingList = new List <Binding>(); for (int i = 0; i < bindingTestCount; i++) { var model = new ModelA(); modelList.Add(model); var view = new ViewA(); var binding = new Binding("IntValue", view, "IntValue"); binding.Bind(model); bindingList.Add(binding); binding = new Binding("StringValue", view, "StringValue"); binding.Bind(model); bindingList.Add(binding); } var test = RunActionAsync("NotifyTestA2", bindingTestCount, () => { // update value foreach (var item in modelList) { item.IntValue = 1; item.StringValue = "A"; } }); yield return(StartCoroutine(test)); }
private IEnumerator BindAndUnbindTest() { var model = new ModelA(); var view = new ViewA(); var bindingList = new List <Binding>(); var test = RunActionAsync("BindAndUnbindTest", bindingTestCount, () => { // bind for (int i = 0; i < bindingTestCount; i++) { var binding = new Binding("IntValue", view, "IntValue"); binding.Bind(model); bindingList.Add(binding); binding = new Binding("StringValue", view, "StringValue"); binding.Bind(model); bindingList.Add(binding); } // unbind foreach (var item in bindingList) { item.Unbind(); } }); yield return(StartCoroutine(test)); }
private void MainWindow_Loaded(object sender, RoutedEventArgs e) { _viewA = _viewAFactory(); _viewB = _viewBFactory(); _region = _regionManager.Regions["ContentRegion"]; _region.Add(_viewB); _region.Add(_viewA); }
private void Window_Loaded(object sender, RoutedEventArgs e) { _viewA = _container.Resolve <ViewA>(); _viewB = _container.Resolve <ViewB>(); _region = _regionManager.Regions["ContentInner"]; _region.Add(_viewA); _region.Add(_viewB); }
private void ViewsActivationView_Loaded(object sender, RoutedEventArgs e) { region = regionManager.Regions[ViewsActivationModule.ViewsActivationRegion]; viewA = container.Resolve <ViewA>(); viewB = container.Resolve <ViewB>(); region.Add(viewA); region.Add(viewB); Clear(); }
private void ViewACommendExecute(object obj) { if (viewA != null) { viewA.Close(); } viewA = new ViewA(); viewA.DockManager = _dockManager; viewA.Show(Dock.Left); }
private void MainWindow_Loaded(object obj) { _pohtoView = _container.Resolve <PrismUserControl1>(); _viewA = _container.Resolve <ViewA>(); _region = _regionManager.Regions["ContentRegion"]; _region.Add(_pohtoView); _region.Add(_viewA); //_region.Activate(_pohtoView); _regionManager.RequestNavigate(_region.Name, _viewA.Name, NavigationCompleted); }
public NavigatorFixture() { _trace = new StringWriter(); _vmA = new ViewModelA(_trace); _vmB = new ViewModelB(_trace); _vmC = new ViewModelC(_trace); _vA = new ViewA { BindingContext = _vmA, Title = "a" }; _vB = new ViewB { BindingContext = _vmB, Title = "b" }; _vC = new ViewC { BindingContext = _vmC, Title = "c" }; _navigationPage = new NavigationPage(_vA); var pageMock = new Mock <IPage>(); pageMock.Setup(p => p.Navigation).Returns(() => _navigationPage.CurrentPage.Navigation); var viewFactoryMock = new Mock <IViewFactory>(); viewFactoryMock.Setup(vf => vf.Resolve(It.IsAny <Action <ViewModelA> >())).Returns(() => _vA); viewFactoryMock.Setup(vf => vf.Resolve(It.IsAny <Action <ViewModelB> >())).Returns(() => _vB); viewFactoryMock.Setup(vf => vf.Resolve(It.IsAny <Action <ViewModelC> >())).Returns(() => _vC); ViewModelA unusedA; ViewModelB unusedB; ViewModelC unusedC; viewFactoryMock.Setup(vf => vf.Resolve(out unusedA, It.IsAny <Action <ViewModelA> >())); viewFactoryMock.Setup(vf => vf.Resolve(out unusedB, It.IsAny <Action <ViewModelB> >())) .OutCallback((out ViewModelB vm, Action <ViewModelB> setStateAction) => vm = _vmB) .Returns(() => _vB); viewFactoryMock.Setup(vf => vf.Resolve(out unusedC, It.IsAny <Action <ViewModelC> >())) .OutCallback((out ViewModelC vm, Action <ViewModelC> setStateAction) => vm = _vmC) .Returns(() => _vC); viewFactoryMock.Setup(vf => vf.Resolve(_vmA)).Returns(_vA); viewFactoryMock.Setup(vf => vf.Resolve(_vmB)).Returns(_vB); viewFactoryMock.Setup(vf => vf.Resolve(_vmC)).Returns(_vC); _navigator = new Navigator(pageMock.Object, viewFactoryMock.Object); }
public ViewAViewModel( ViewA viewA, IEventAggregator eventAggregator, IMessageDialogService messageDialogService) : base(eventAggregator, messageDialogService) { Int64 startTicks = Log.CONSTRUCTOR("Enter", Common.LOG_CATEGORY); View = viewA; View.ViewModel = this; // TODO(crhodes) // Save constructor parameters here InitializeViewModel(); Log.CONSTRUCTOR("Exit", Common.LOG_CATEGORY, startTicks); }
private async void Button_Clicked(object sender, EventArgs e) { Page root = _navPage.Navigation.NavigationStack[0]; await _navPage.Navigation.PopToRootAsync(false); Page newRoot = null; var btn = (Button)sender; if (btn.Text == "ViewA") newRoot = new ViewA(); else newRoot = new ViewB(); await _navPage.Navigation.PushAsync(newRoot); _navPage.Navigation.RemovePage(root); IsPresented = false; }
private IEnumerator LoopTestA1() { var model = new ModelA(); var view = new ViewA(); var binding = new Binding("IntValue", view, "IntValue"); binding.Bind(model); var test = RunActionLoopAsync("LoopTestA1", loopTestCount, () => { for (int i = 0; i < innerLoopCount; i++) { // update value model.IntValue = i; Assert.AreEqual(i, view.IntValue); } }); yield return(StartCoroutine(test)); }
public void SetData(IList <string> StringListA, IList <string> StringListB, EditScript Script, string strNameA, string strNameB) { ViewA.SetData(StringListA, Script, true); ViewB.SetData(StringListB, Script, false); Overview.DiffView = ViewA; Debug.Assert(ViewA.LineCount == ViewB.LineCount, "Both DiffView's LineCounts must be the same"); bool bShowNames = strNameA.Length > 0 || strNameB.Length > 0; edtLeft.Visible = bShowNames; edtRight.Visible = bShowNames; if (bShowNames) { edtLeft.Text = strNameA; edtRight.Text = strNameB; } UpdateButtons(); m_iCurrentDiffLine = -1; UpdateLineDiff(); ActiveControl = ViewA; }
void SetTitle(ViewA tab, string title) { (tab.DataContext as ViewModels.ViewAViewModel).Title = title; }