Exemple #1
0
        public GoogleTalkHelper()
        {
            settings   = App.Current.Settings;
            gtalk      = App.Current.GtalkClient;
            pushHelper = App.Current.PushHelper;

            pushHelper.UriUpdated += UriUpdated;
            pushHelper.RawNotificationReceived += RawNotificationReceived;
            Connected = false;
        }
        public GoogleTalkHelper()
        {
            settings = App.Current.Settings;
            gtalk = App.Current.GtalkClient;
            pushHelper = App.Current.PushHelper;

            pushHelper.UriUpdated += UriUpdated;
            pushHelper.RawNotificationReceived += RawNotificationReceived;
            Connected = false;
        }
Exemple #3
0
        // Code to execute when the application is launching (eg, from Start)
        // This code will not execute when the application is reactivated
        private void Application_Launching(object sender, LaunchingEventArgs e)
        {
            Settings = IsolatedStorageSettings.ApplicationSettings;
            PushHelper = new PushHelper();
            GtalkClient = new GoogleTalk();

            if (!Settings.Contains("chatlog")) {
                Settings["chatlog"] = new Dictionary<string, List<Message>>();
            }
            if (!Settings.Contains("unread")) {
                Settings["unread"] = new Dictionary<string, int>();
            }
            if (!Settings.Contains("recent")) {
                Settings["recent"] = new ObservableCollection<Contact>();
            }

            Roster = new Roster();
            GtalkHelper = new GoogleTalkHelper();
            Roster.Load();

            RecentContacts = Settings["recent"] as ObservableCollection<Contact>;

            PushHelper.RegisterPushNotifications();

            InitAnalytics();

            if (Settings.Contains("lastError")) {
                var result = MessageBox.Show(
                    AppResources.CrashReport_Message,
                    AppResources.CrashReport_Title,
                    MessageBoxButton.OKCancel
                );

                if(result == MessageBoxResult.OK) {
                    GtalkClient.CrashReport(Settings["lastError"] as string, success => Settings.Remove("lastError"), error => {});
                } else {
                    Settings.Remove("lastError");
                }
            }
        }
Exemple #4
0
        // Code to execute when the application is activated (brought to foreground)
        // This code will not execute when the application is first launched
        private void Application_Activated(object sender, ActivatedEventArgs e)
        {
            if (Settings == null) Settings = IsolatedStorageSettings.ApplicationSettings;
            if (PushHelper == null) PushHelper = new PushHelper();
            if (GtalkClient == null) GtalkClient = new GoogleTalk();

            if (RecentContacts == null) {
                if (!Settings.Contains("recent")) {
                    Settings["recent"] = RecentContacts = new ObservableCollection<Contact>();
                }
                RecentContacts = Settings["recent"] as ObservableCollection<Contact>;
            }

            if (!Settings.Contains("chatlog")) {
                Settings["chatlog"] = new Dictionary<string, List<Message>>();
            }

            if (!Settings.Contains("unread")) {
                Settings["unread"] = new Dictionary<string, int>();
            }

            Roster = new Roster();
            if (GtalkHelper == null) GtalkHelper = new GoogleTalkHelper();
            Roster.Load();

            InitAnalytics();

            PushHelper.RegisterPushNotifications();
        }