Esempio n. 1
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            // start helpers
            var tokenTask = TokenService.Instance;

            tokenTask.Initialization.ContinueWith(
                async ct =>
            {
                this.Log().LogCritical($"Unable to initialize token service - {ct.Exception.Message}");
                await ErrorDialogHelper.ShowFatalErrorAsync <FatalErrorPage>("FatalErrorTitle", "FatalInitializeError");
            },
                TaskContinuationOptions.OnlyOnFaulted);

            var window   = Window.Current;
            var rootPage = window.Content as MainPage;

            if (rootPage == null)
            {
                rootPage       = new MainPage();
                window.Content = rootPage;
            }

            if (e.PrelaunchActivated == false)
            {
                window.Activate();
            }
        }
Esempio n. 2
0
    public void UsesShowDelegateToDisplayMessage()
    {
        bool         delegateWasCalled = false;
        ShowDelegate mockShowDelegate  = delegate(string text, string caption)
        {
            Assert.AreEqual("the expected message", text);
            Assert.AreEqual("the expected title", caption);
            delegateWasCalled = true;
        };

        ErrorDialogHelper helper = new ErrorDialogHelper(showDelegate);

        helper.ShowErrorMessage("the expected message", "the expected title");
        Assert.IsTrue(delegateWasCalled);
    }