/// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.
        /// This parameter is typically used to configure the page.</param>
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {

            if (Windows.Storage.ApplicationData.Current.LocalSettings.Values.Any(m => m.Key.Equals("username")))
                this.Username = Windows.Storage.ApplicationData.Current.LocalSettings.Values.Single(m => m.Key.Equals("username")).Value as string;
            else
            {
                var dialog = new Settings();
                await dialog.ShowAsync();
                this.Username = dialog.Username;
            }

            timer = new DispatcherTimer();
            timer.Interval = TimeSpan.FromSeconds(2);
            timer.Tick += Timer_Tick;

            timer.Start();

            this.lbMessages.ItemsSource = await LoadMessages();

        }
 private async void AppBarButton_Click(object sender, RoutedEventArgs e)
 {
     var dialog = new Settings();
     await dialog.ShowAsync();
     if(!string.IsNullOrEmpty(dialog.Username))
         this.Username = dialog.Username;
 }