コード例 #1
0
 public UcwaAppMe(UcwaApp app)
 {
     this.ucwaApp = app;
     this.ucwaApp.OnEventNotificationsReceived += this.DispatchToUIThreadReceivedEventNotifications;
     this.ucwaApp.OnErrorReported    += this.DispatchToUIThreadErrorReport;
     this.ucwaApp.OnProgressReported += this.DispatchToUIThreadProgressReport;
     this.Transport = app.Transport;
     this.Resource  = app.ApplicationResource.GetEmbeddedResource("me");
 }
コード例 #2
0
        /// <summary>
        /// Populates the page with content passed during navigation. Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="sender">
        /// The source of the event; typically <see cref="NavigationHelper"/>
        /// </param>
        /// <param name="e">Event data that provides both the navigation parameter passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
        /// a dictionary of state preserved by this page during an earlier
        /// session. The state will be null the first time a page is visited.</param>
        private async /*modified*/ void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            this.UcwaApp = e.NavigationParameter as UcwaApp;
            if (this.UcwaApp == null || this.UcwaApp.IsSignedIn == false)
            {
                ReportError(new Exception("The app is not signed in yet."));
                return;
            }

            this.UcwaApp.Me.OnEventNotificationsReceived += this.ProcessEventNotifications;
            this.UcwaApp.Me.OnErrorReported    += this.ReportError;
            this.UcwaApp.Me.OnProgressReported += ReportProgress;

            if (Windows.Storage.ApplicationData.Current.LocalSettings.Values.ContainsKey("status"))
            {
                textBlockDebug.Text = Windows.Storage.ApplicationData.Current.LocalSettings.Values["status"].ToString();
            }
            if (Windows.Storage.ApplicationData.Current.LocalSettings.Values.ContainsKey("events"))
            {
                textBoxEvents.Text = Windows.Storage.ApplicationData.Current.LocalSettings.Values["events"].ToString();
            }

            // Show some local user info.
            textBlockMyName.Text = this.UcwaApp.Me.DisplayName +
                                   ", " + this.UcwaApp.Me.Title + ", " + this.UcwaApp.Me.Department + ", " + this.UcwaApp.Me.Uri;

            textBoxNote.Text = await this.UcwaApp.Me.GetNoteMessage();

            textBoxPresence.Text = await this.UcwaApp.Me.GetPresenceAvailability();

            var phones = await this.UcwaApp.Me.GetPhoneLines();

            foreach (var phone in phones)
            {
                textBoxPhones.Text += (string.IsNullOrEmpty(textBoxPhones.Text) ? "" : ", ") + phone.Type + ":" + phone.Number;
            }
        }