public GetOfflineMessages ( Gchat.Protocol.GoogleTalk cb ) : void | ||
cb | Gchat.Protocol.GoogleTalk | |
return | void |
protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); App.Current.LastPage = e.Uri.OriginalString; gtalk = App.Current.GtalkClient; gtalkHelper = App.Current.GtalkHelper; settings = App.Current.Settings; App.Current.GtalkHelper.SetCorrectOrientation(this); currentContact = null; if (NavigationContext.QueryString.ContainsKey("from")) { to = NavigationContext.QueryString["from"]; email = to; if (email.Contains("/")) { email = email.Substring(0, email.IndexOf('/')); } App.Current.CurrentChat = email; to = email; if (App.Current.Roster.Contains(email)) { currentContact = App.Current.Roster[email]; } } gtalkHelper.MessageReceived += DisplayMessage; if (App.Current.Roster.Contains(email)) { Initialize(); } else if (gtalkHelper.RosterLoaded && gtalk.LoggedIn) { if(e.IsNavigationInitiator) { gtalkHelper.GetOfflineMessages(); } } else { gtalkHelper.RosterUpdated += Initialize; } object savedText; if (State.TryGetValue("message", out savedText)) { MessageText.Text = (string) savedText; } gtalkHelper.LoginIfNeeded(); ScrollToBottom(); }
protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); FlurryWP7SDK.Api.LogEvent("Chat - Chat started", true); App.Current.LastPage = e.Uri.OriginalString; gtalk = App.Current.GtalkClient; gtalkHelper = App.Current.GtalkHelper; settings = App.Current.Settings; App.Current.GtalkHelper.SetCorrectOrientation(this); currentContact = null; if (NavigationContext.QueryString.ContainsKey("from")) { to = NavigationContext.QueryString["from"]; email = to; if (email.Contains("/")) { email = email.Substring(0, email.IndexOf('/')); } App.Current.CurrentChat = email; to = email; if (App.Current.Roster.Contains(email)) { currentContact = App.Current.Roster[email]; } } gtalkHelper.MessageReceived += DisplayMessage; if (gtalkHelper.RosterLoaded && gtalk.LoggedIn && App.Current.Roster.Contains(email)) { Initialize(); if (e.NavigationMode == NavigationMode.Back) { ShowProgressBar(AppResources.Chat_ProgressGettingMessages); gtalkHelper.GetOfflineMessages(() => Dispatcher.BeginInvoke(() => HideProgressBar())); } } else { Initialize(); ShowProgressBar(AppResources.Chat_ProgressGettingMessages); gtalkHelper.RosterUpdated += () => HideProgressBar(); gtalkHelper.RosterUpdated += Initialize; } object savedText; if (State.TryGetValue("message", out savedText)) { MessageText.Text = (string) savedText; } gtalkHelper.LoginIfNeeded(); ScrollToBottom(); }