Пример #1
0
        public void LoadWatchface(XApplication application)
        {
            if (application == null)
            {
                throw new ArgumentException("application");
            }
            _application         = application;
            XApplication.Current = application;
            application.SendStart();

            var rootView = application.MainPage.CreateEvasObject(Window);

            OnRootViewUpdated(rootView);

            application.PropertyChanging += (s, e) =>
            {
                if (e.PropertyName == nameof(XApplication.MainPage))
                {
                    Platform.GetRenderer(application?.MainPage)?.Dispose();
                }
            };
            application.PropertyChanged += (s, e) =>
            {
                if (e.PropertyName == nameof(XApplication.MainPage))
                {
                    OnRootViewUpdated(application.MainPage.CreateEvasObject(Window));
                }
            };
        }
        public void LoadApplication(XApplication application)
        {
            if (Window == null)
            {
                throw new NullReferenceException("MainWindow is not prepared, This method should be called in OnCreated().");
            }

            if (application == null)
            {
                throw new ArgumentException("application cannot be null.");
            }
            _application         = application;
            XApplication.Current = application;
            application.SendStart();

            var rootView = application.MainPage.CreateEvasObject(Window);

            OnRootViewUpdated(rootView);

            application.PropertyChanging += new XPropertyChangingEventHandler(AppOnPropertyChanging);
            application.PropertyChanged  += new PropertyChangedEventHandler(AppOnPropertyChanged);
        }