Пример #1
0
        public void NavigateTo(PageNames pageName, NavigationParameters parameters, string regionName = RegionNames.MainRegion)
        {
            if (_regionManager.Regions[regionName].GetView(pageName.ToString()) == null)
            {
                //Helpers.InitializeViewHelper.RegisterViewForNavigationWithinContainer(pageName, _container);
            }

            if (parameters == null)
            {
                parameters = new NavigationParameters();
            }
            _regionManager.RequestNavigate(regionName, pageName.ToString(), CheckForError, parameters);
        }
Пример #2
0
        public void NavigateTo(PageNames pageName, NavigationParameters param, Student SelectedStudent, StudentContext DB)
        {
            if (_RegionManager.Regions["RegionShell"].GetView(pageName.ToString()) == null)
            {
                Helpers.InitializeViewHelper.RunEdit(pageName, _UnityContainer, _RegionManager, SelectedStudent, DB);
            }

            if (param == null)
            {
                param = new NavigationParameters();
            }
            param.Add("TestParam", "testoviy param");

            _RegionManager.Regions["RegionShell"].RequestNavigate(pageName.ToString(), param);
        }
Пример #3
0
        public void NavigateTo(PageNames pageName, NavigationParameters parameters)
        {
            // сначала проверяем не присутствует ли наша страница в регионе,
            // если не присутствует, запускаем добавление
            if (_RegionManager.Regions["RegionShell"].GetView(pageName.ToString()) == null)
            {
                Helpers.InitializeViewHelper.Run(pageName, _UnityContainer, _RegionManager);
            }

            // после добавления формы в регион переходи на данную форму с передачей параметров
            // добавлю один параметр
            if (parameters == null)
            {
                parameters = new NavigationParameters();
            }
            parameters.Add("TestParam", "Это тестовый параметр");

            _RegionManager.Regions["RegionShell"].RequestNavigate(pageName.ToString(), parameters);
        }
Пример #4
0
 /// <summary>
 /// Opens the application window and go to a specific page
 /// </summary>
 /// <param name="pageName"></param>
 public static void GoToPage(PageNames pageName)
 {
     try {
         if (!_hasBeenShownOnce || !_form.Visible)
         {
             ToggleView();
         }
         _form.ShowPage(pageName.ToString());
     } catch (Exception e) {
         ErrorHandler.ShowErrors(e, "Error in GoToPage");
     }
 }
Пример #5
0
        public static T GetInstance <T>(PageNames name) where T : UIViewController
        {
            var restorationId = name + "Vc";

            if (_instances.ContainsKey(restorationId))
            {
                return((T)_instances[restorationId]);
            }

            var storyboard = UIStoryboard.FromName(name.ToString() + "Storyboard", null);
            var instance   = (storyboard.InstantiateViewController(restorationId) as T);

            _instances.Add(restorationId, instance);

            return(instance);
        }
Пример #6
0
        private void mainFrame_MoveForward(PageNames name)
        {
            System.Diagnostics.Debug.WriteLine($"Inside mainFrame_MoveForward - Page Name: {name.ToString()}");

            object page = null;

            switch (name)
            {
            case PageNames.FeaturesPage:
                page = new FeaturesPage();
                break;

            default:
                page = null;
                break;
            }

            if (page != null)
            {
                (page as INavigationPage).SetWindowSize += mainFrame_SetWindowSize;
                (page as INavigationPage).MoveForward   += mainFrame_MoveForward;
                mainFrame.Navigate(page);
            }
        }
Пример #7
0
 /// <summary>
 /// Opens the application window and go to a specific page
 /// </summary>
 /// <param name="pageName"></param>
 public static void GoToPage(PageNames pageName)
 {
     try {
         if (!_hasBeenShownOnce || !_form.Visible) {
             ToggleView();
         }
         _form.ShowPage(pageName.ToString());
     } catch (Exception e) {
         ErrorHandler.ShowErrors(e, "Error in GoToPage");
     }
 }
Пример #8
0
        /// <summary>
        /// Called when [change screen page event].
        /// </summary>
        /// <param name="pageName">Name of the page.</param>
        private void ChangeScreenPage(string regionName, PageNames pageName)
        {
            // Check the region exists
            if (_regionManager.Regions.ContainsRegionWithName(regionName))
            {
                using (new ShowBusyIndicator())
                {
                    // Find an activate the page with the given name
                    IRegion region = _regionManager.Regions[regionName];
                    region.Activate(region.Views.First(x => ((FrameworkElement)x).Name == pageName.ToString()));

                    //TODO: This is broken since it doesn't account for the second screen page changes
                    _currentScreenPage = pageName;

                    // RaiseCanExecuteChanged method on each toolbar command
                    _toolbarItems.ForEach(item => ((DelegateCommand<object>)item.Command).RaiseCanExecuteChanged());

                    // Publish notification event
                    _eventAggregator.GetEvent<ScreenEvents.ActiveScreenChanged>().Publish(new ScreenEvents.ActiveScreenChanged()
                    {
                        RegionName = regionName,
                        PageName = pageName
                    });
                }
            }
        }
Пример #9
0
        /// <summary>
        /// Called when [change screen page event].
        /// </summary>
        /// <param name="pageName">Name of the page.</param>
        private void ChangeScreenPage(string regionName, PageNames pageName)
        {
            // Check the region exists
            if (_regionManager.Regions.ContainsRegionWithName(regionName))
            {
                using (new ShowBusyIndicator())
                {
                    // Find an activate the page with the given name
                    IRegion region = _regionManager.Regions[regionName];
                    region.Activate(region.Views.First(x => ((FrameworkElement)x).Name == pageName.ToString()));

                    //TODO: This is broken since it doesn't account for the second screen page changes
                    _currentScreenPage = pageName;

                    // RaiseCanExecuteChanged method on each toolbar command
                    _toolbarItems.ForEach(item => ((DelegateCommand <object>)item.Command).RaiseCanExecuteChanged());

                    // Publish notification event
                    _eventAggregator.GetEvent <ScreenEvents.ActiveScreenChanged>().Publish(new ScreenEvents.ActiveScreenChanged()
                    {
                        RegionName = regionName,
                        PageName   = pageName
                    });
                }
            }
        }