Exemplo n.º 1
0
        /// <summary>
        /// Sets the navigation pages for the titlebar left/right button for a page
        /// </summary>
        /// <param name="page"></param>
        public void SetNavPagesForPage(IRootView page)
        {
            try
            {
                page.Titlebar.LeftButton.Clicked += (s, e) =>
                {
                    if (page.LeftPageType != null)
                    {
                        SetCurrentPage(page.LeftPageType);
                    }
                };

                page.Titlebar.RightButton.Clicked += (s, e) =>
                {
                    if (page.RightPageType != null)
                    {
                        SetCurrentPage(page.RightPageType);
                    }
                };
            }
            catch (Exception ex)
            {
                Debugger.Break();
                AnalyticsManager.Instance.TrackError(ex);
                throw;
            }
        }
Exemplo n.º 2
0
 public DdfGuide(
     IAudioDramaListView audioDramaListView,
     IAudioDramaView audioDramaView,
     IRootView rootView,
     ICache <IEnumerable <AudioDramaDto> > dtoCache,
     ICache <IEnumerable <AudioDramaUserData> > userDataCache,
     IShutdown shutdown,
     IUserNotifier userNotifier,
     IUriInvoker uriInvoker,
     IClipboardService clipboardService,
     IYesNoDialog yesNoDialog,
     IOkDialog okDialog,
     IUpdatingView updatingView)
 {
     _audioDramaListView = audioDramaListView;
     _audioDramaView     = audioDramaView;
     _rootView           = rootView;
     _dtoCache           = dtoCache;
     _userDataCache      = userDataCache;
     _shutdown           = shutdown;
     _userNotifier       = userNotifier;
     _uriInvoker         = uriInvoker;
     _clipboardService   = clipboardService;
     _yesNoDialog        = yesNoDialog;
     _okDialog           = okDialog;
     _updatingView       = updatingView;
 }
Exemplo n.º 3
0
 public RootPresenter(IRootView rootView,
                      IErrorMessageView errorMessageView,
                      ILoginPresenter loginPresenter,
                      IRegistrationPresenter registrationPresenter,
                      IHeaderViewPresenter headerViewPresenter,
                      IMainPresenter mainPresenter,
                      ISession session)
 {
     _rootView              = rootView;
     _errorMessageView      = errorMessageView;
     _loginPresenter        = loginPresenter;
     _registrationPresenter = registrationPresenter;
     _mainPresenter         = mainPresenter;
     _headerViewPresenter   = headerViewPresenter;
     _session = session;
     SubscribeToEvents();
 }
Exemplo n.º 4
0
        public Navigator(
            IRootView rootView,
            IPresenter <IAudioDramaView, AudioDrama> audioDramaPresenter,
            IPresenter <IAudioDramaListView, IEnumerable <AudioDrama> > audioDramaListPresenter,
            IAudioDramaExplorer explorer,
            IRandomAudioDramaPicker picker,
            ISource <IEnumerable <AudioDrama> > source,
            IShutdown shutdown,
            IUpdatingView updatingView)
        {
            _rootView                = rootView;
            _audioDramaPresenter     = audioDramaPresenter;
            _audioDramaListPresenter = audioDramaListPresenter;
            _explorer                = explorer;
            _picker       = picker;
            _source       = source;
            _shutdown     = shutdown;
            _updatingView = updatingView;

            InitNavigationEvents();
        }
Exemplo n.º 5
0
        private void AddPage(Type type, Action <IRootView> beforeCallBack = null, Action <IRootView> afterCallBack = null, params object[] args)
        {
            try
            {
                IRootView page = null;

                page = Activator.CreateInstance(type) as IRootView;
                if (page == null)
                {
                    return;
                }
                page.PageCreationDone();

                _pages.Add(page.GetType(), page);

                UpdateCurrentPage(type, beforeCallBack, afterCallBack);
            }
            catch (Exception ex)
            {
                Debugger.Break();
                AnalyticsManager.Instance.TrackError(ex);
                throw;
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Intantiate a page instantly
        /// </summary>
        /// <param name="type">Type of the page to be intantiated</param>
        /// <param name="beforeCallBack">The callback called before the instantiation</param>
        /// <param name="afterCallBack">The callback called after the instantiation</param>
        private async void AddPage(Type type, Action <IRootView> beforeCallBack = null, Action <IRootView> afterCallBack = null)
        {
            try
            {
                IRootView page = null;

                await Task.Run(() =>
                {
                    try
                    {
                        //page = (IRootView)Activator.CreateInstance(type);
                        page = Activator.CreateInstance(type) as IRootView;
                        if (page == null)
                        {
                            return;
                        }
                        page.PageCreationDone();
                    }
                    catch (Exception e)
                    {
                        Debugger.Break();
                        AnalyticsManager.Instance.TrackError(e);
                        throw e;
                    }
                });

                _pages.Add(page.GetType(), page);
                UpdateCurrentPage(type, beforeCallBack, afterCallBack);
            }
            catch (Exception ex)
            {
                Debugger.Break();
                AnalyticsManager.Instance.TrackError(ex);
                throw;
            }
        }
Exemplo n.º 7
0
 public Application(IRootView rootView)
 {
     _rootView = rootView;
 }
Exemplo n.º 8
0
 public ShellViewModel(IRootView rootView)
 {
     this.RootView = rootView;
 }
Exemplo n.º 9
0
 public RootDesignerPresenter(IRootView view)
 {
     _view = view;
 }
Exemplo n.º 10
0
        /// <summary>
        /// Stars the cacheing of the pages
        /// </summary>
        public void StartCachingPages()
        {
            try
            {
                //await Task.Run(() =>
                //{

                //});
                try
                {
                    bool finished = false;
                    Type pageType;

                    while (!finished)
                    {
                        if (_cachePages.Count > 0)
                        {
                            pageType = _cachePages.Dequeue();
                            if (_finishedPages.ContainsKey(pageType))
                            {
                                continue;
                            }
                            try
                            {
                                var page = Activator.CreateInstance(pageType) as IRootView;
                                if (page == null)
                                {
                                    return;
                                }
                                page.PageCreationDone();
                                _finishedPages[pageType] = page;
                            }
                            catch (Exception e)
                            {
                                throw e;
                            }
                        }
                        else
                        {
                            finished = true;
                        }
                    }
                }
                catch (Exception ex)
                {
                    Debugger.Break();
                    throw;
                }

                try
                {
                    foreach (var kvp in _finishedPages)
                    {
                        IRootView finishedPage = kvp.Value;
                        var       contentPage  = finishedPage as ContentPage;
                        try
                        {
                            if (contentPage != null)
                            {
                                if (!_pageMain.Children.Contains(contentPage))
                                {
                                    _pageMain.Children.Add(contentPage);
                                }
                            }


                            if (!_pages.ContainsKey(finishedPage.GetType()))
                            {
                                (finishedPage as VisualElement).IsVisible = false;
                                _pages.Add(finishedPage.GetType(), finishedPage);
                                //PageCreatedEvent?.Invoke(finishedPage.GetType(), finishedPage);
                            }
                        }
                        catch (Exception exc)
                        {
                            AnalyticsManager.Instance.TrackError(exc);
                            System.Diagnostics.Debug.WriteLine("Exception " + exc.Message);
                        }
                    }

                    if (_futurePage != null)
                    {
                        UpdateCurrentPage(_futurePage);
                        _futurePage = null;
                    }
                }
                catch (Exception ex)
                {
                    Debugger.Break();
                    AnalyticsManager.Instance.TrackError(ex);
                    throw;
                }
            }
            catch (Exception ex)
            {
                Debugger.Break();
                AnalyticsManager.Instance.TrackError(ex);
                throw;
            }
        }
Exemplo n.º 11
0
 public ShellViewModel(IRootView rootView)
 {
     this.RootView = rootView;
 }