Example #1
0
        public void multiple_views_are_visible()
        {
            IRegion region = null;

            Invoke(
                () =>
            {
                region = _regionManager.AttachRegion("region",
                                                     _itemsControl);
                region.AddView("tab1");
                region.AddView("tab2");
                region.AddView("tab3");
            });

            Wait();

            Assert.AreEqual(3, _itemsControl.Items.Count, "expected all items to be active!");
        }
Example #2
0
        public void synchronizes_active_item_when_user_clicks()
        {
            IRegion region = null;

            Invoke(
                () =>
            {
                region = _regionManager.AttachRegion("region",
                                                     _tabControl);
                region.AddView("tab1");
                region.AddView("tab2");
                region.AddView("tab3");
            });
            var whiteTabControl = WhiteWindow.Get <Tab>("TabControl");

            whiteTabControl.SelectTabPage("tab1");
            Wait();

            Assert.Contains("tab1", (ICollection)region.ActiveViews);
        }
Example #3
0
 private void FileSelected(FileSelectedMessage obj)
 {
     // this happens always in gui thread
     if (obj.FilePath.EndsWith("png") || obj.FilePath.EndsWith("jpg"))
     {
         var pp = new PicturePresenter(obj.FilePath, _graphicFilesEditToolbar);
         //var tabItem = new TabItem {Header = obj.FilePath, Content = pp};
         IRegion region = _regionManager.GetRegion("mainTabs");
         region.AddView(pp);
         region.Activate(pp);
     }
 }
Example #4
0
        public void can_add_an_item_and_it_is_active_by_default()
        {
            Invoke(
                () =>
            {
                IRegion region = _regionManager.AttachRegion("region", _itemsControl);
                string view    = "tab1";
                region.AddView(view);
            });

            Wait();

            Assert.IsNotNull(_itemsControl.Items[0]);
        }
Example #5
0
        public void can_add_a_toolbar_element()
        {
            ToolBar view = null;

            Invoke(
                () =>
            {
                IRegion region = _regionManager.AttachRegion("region", _toolBarTray);
                view           = new ToolBar();
                region.AddView(view);
            });

            Assert.AreEqual(1, Window.ToolBarTray.ToolBars.Count);
            Assert.AreSame(view, Window.ToolBarTray.ToolBars[0]);
        }
Example #6
0
        private void AllModulesLoadedInGui()
        {
            var     buttonControl = new ButtonControl(_locator);
            var     regionManager = _locator.Resolve <RegionManager>();
            IRegion region        = regionManager.GetRegion("mainTab");
            var     view          = new TabItem
            {
                Header  = "Dodawanie nowych tabów",
                Content = buttonControl
            };


            region.AddView(view);
            region.Activate(view);
        }
Example #7
0
        public void can_add_a_toolbar_element()
        {
            Button view = null;

            Invoke(
                () =>
            {
                IRegion region = _regionManager.AttachRegion("region", _toolBar);
                view           = new Button()
                {
                    Content = "test"
                };
                region.AddView(view);
            });

            Assert.AreEqual(1, Window.Menu.Items.Count);
            Assert.AreSame(view, Window.Menu.Items[0]);
        }
Example #8
0
        public void OnLoad()
        {
            // this only dependency on the host application
            IRegion region = _regionManager.GetRegion("mainTab");

            // create the view in the mvvm style
            var updaterView = new UpdaterControl
            {
                DataContext = new UpdaterViewModel(_updater, _eventAggregator)
            };

            // create the compatible view
            var tabView = new TabItem()
            {
                Header  = "Updater",
                Content = updaterView
            };

            // inject view into application
            region.AddView(tabView);
        }
Example #9
0
        private void ButtonClick(object sender, RoutedEventArgs e)
        {
            var     regionManager = _locator.Resolve <RegionManager>();
            IRegion region        = regionManager.GetRegion("mainTab");
            var     view          = new TabItem
            {
                Header  = string.Format("{0}", _id),
                Content =
                    new Label
                {
                    Content =
                        string.Format("Content of from button header {0}",
                                      _id)
                }
            };
            var threadProvider = _locator.Resolve <IGuiThreadProvider>();

            threadProvider.RunInGui(delegate
            {
                region.AddView(view);
                region.Activate(view);
            });
            _id++;
        }
Example #10
0
        private void AddButtonsForLanguage()
        {
            IRegion region = _regionManager.GetRegion("leftSideMenu");

            region.AddView(new LanguageSelecting(_aggregator));
        }