protected async override void OnNavigatedTo(NavigationEventArgs e)
 {
     base.OnNavigatedTo(e);
     CommonData.activeConversationPage = this;
     DataStorage.ApplicationRunning = true;
     actionEnabled = true;
     session = CommonData.session;
     if (session == null) this.Frame.GoBack();
     signatureSecret = null;
     shiftDown = false;
     await CommonData.LoadStoredMessagesAsync();
     messageListItems = new ObservableCollection<MessageListItem>();
     conversationListItems = new ObservableCollection<ConversationListItem>();
     conversationsList.DataContext = conversationListItems;
     display.DataContext = messageListItems;
     unreadIndicator.Foreground = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0));
     blinkerTimer = new DispatcherTimer();
     blinkerTimer.Interval = TimeSpan.FromMilliseconds(500);
     blinkerTimer.Tick += blinkUnreadIndicator;
     blinkerTimer.Stop();
     await refreshConversationList();
     foreach (var credential in DataStorage.GetNotifierCredentials())
     {
         if (credential[0] == session.Username)
         {
             toggleNotificationsSwitch.IsOn = true;
             break;
         }
     }
     if (conversationListItems.Count == 0) startNewConversation();
     else selectPeer(conversationListItems[0].Name);
     if (e.NavigationMode == NavigationMode.Forward || e.NavigationMode == NavigationMode.New)
     {
         await refreshMessages();
     }
     closeSideMenu();
 }
 public static async Task<Session> StartSessionAsync(string username, string password, string token, string publicKey, string privateKey, bool updateKey = true)
 {
     var newSession = new Session(username, password, token, publicKey, privateKey);
     await newSession.loginAsync(updateKey);
     return newSession;
 }
Exemplo n.º 3
0
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     session = e.Parameter as Session;
     if (session == null) this.Frame.GoBack();
 }