Exemple #1
0
 public static Task AcknowledgeSubscriberAsync(this
                                               LocalOwnerPresence lop, string subscriberId)
 {
     return(Task.Factory.FromAsync(
                lop.BeginAcknowledgeSubscriber,
                lop.EndAcknowledgeSubscriber,
                subscriberId, null));
 }
Exemple #2
0
 public static Task UpdateContainerMembershipAsync(this
                                                   LocalOwnerPresence lop,
                                                   ICollection <ContainerUpdateOperation> operations)
 {
     return(Task.Factory.FromAsync(
                lop.BeginUpdateContainerMembership,
                lop.EndUpdateContainerMembership,
                operations, null));
 }
Exemple #3
0
 public static Task PublishPresenceAsync(this
                                         LocalOwnerPresence lop,
                                         ICollection <PresenceCategoryWithMetaData> categories)
 {
     return(Task.Factory.FromAsync(
                lop.BeginPublishPresence,
                lop.EndPublishPresence,
                categories, null));
 }
Exemple #4
0
 public static Task DeletePresenceAsync(this
                                        LocalOwnerPresence lop,
                                        ICollection <PresenceCategory> categoryItems)
 {
     return(Task.Factory.FromAsync(
                lop.BeginDeletePresence,
                lop.EndDeletePresence,
                categoryItems, null));
 }
Exemple #5
0
        /// <summary>
        /// Retrieves the application configuration and begins running the
        /// sample.
        /// </summary>
        private void Run()
        {
            try
            {
                // Prepare and instantiate the platform.
                _helper = new UCMASampleHelper();
                UserEndpointSettings userEndpointSettings = _helper.ReadUserSettings(
                    "PublishPresence Sample User" /*friendly name of the sample's user endpoint*/);

                // Set auto subscription to LocalOwnerPresence.
                userEndpointSettings.AutomaticPresencePublicationEnabled = true;
                _userEndpoint = _helper.CreateUserEndpoint(userEndpointSettings);

                // LocalOwnerPresence is the main class to manage the
                // sample user's presence data.
                _localOwnerPresence = _userEndpoint.LocalOwnerPresence;

                // Wire up handlers to receive presence notifications to self.
                _localOwnerPresence.PresenceNotificationReceived
                    += LocalOwnerPresence_PresenceNotificationReceived;

                // Establish the endpoint.
                _helper.EstablishUserEndpoint(_userEndpoint);

                // Publish presence categories with the new values that
                // are outlined in the sample.
                PublishPresenceCategories(true /* publish presence categories */);
                Console.WriteLine("Note, AggregateState, and ContactCard published.");

                // Wait for user to continue.
                UCMASampleHelper.PauseBeforeContinuing(
                    "Press ENTER to continue and delete the published presence.");

                // Delete presence categories, returning them to the original
                // values before the sample was run.
                PublishPresenceCategories(false /* delete presence categories */);

                // Wait for user to continue.
                UCMASampleHelper.PauseBeforeContinuing("Press ENTER to shutdown and exit.");

                // Un-wire the presence notification event handler.
                _localOwnerPresence.PresenceNotificationReceived
                    -= LocalOwnerPresence_PresenceNotificationReceived;
            }
            finally
            {
                // Shut down platform before exiting the sample.
                _helper.ShutdownPlatform();
            }
        }
Exemple #6
0
        private void OnConnect(object sender, EventArgs e)
        {
            try
            {
                if (object.ReferenceEquals(null, _helper))
                {
                    // Prepare and instantiate the platform with friendly name of the sample's user endpoint
                    _helper = new UCMASampleHelper();
                    UserEndpointSettings userEndpointSettings = _helper.ReadUserSettings(((AssemblyTitleAttribute)Attribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), typeof(AssemblyTitleAttribute), false)).Title);

                    // Set auto subscription to LocalOwnerPresence.
                    userEndpointSettings.AutomaticPresencePublicationEnabled = true;

                    // Set the capabilities
                    userEndpointSettings.Presence.PreferredServiceCapabilities.ApplicationSharingSupport = CapabilitySupport.Supported;
                    userEndpointSettings.Presence.PreferredServiceCapabilities.AudioSupport            = CapabilitySupport.Supported;
                    userEndpointSettings.Presence.PreferredServiceCapabilities.InstantMessagingSupport = CapabilitySupport.Supported;
                    userEndpointSettings.Presence.PreferredServiceCapabilities.VideoSupport            = CapabilitySupport.Supported;

                    // Set the status and create endpoint
                    userEndpointSettings.Presence.UserPresenceState = PresenceState.UserAway;
                    _userEndpoint = _helper.CreateUserEndpoint(userEndpointSettings);

                    // LocalOwnerPresence is the main class to manage the
                    // sample user's presence data.
                    _localOwnerPresence = _userEndpoint.LocalOwnerPresence;

                    // Wire up handlers to receive presence notifications to self.
                    _localOwnerPresence.PresenceNotificationReceived
                        += LocalOwnerPresence_PresenceNotificationReceived;

                    // Establish the endpoint.
                    _helper.EstablishUserEndpoint(_userEndpoint);

                    // Set 'Connected' text for the first menu item
                    _trayMenu.MenuItems[0].Text    = "Connected";
                    _trayMenu.MenuItems[0].Checked = true;
                }
            }
            catch (Exception) { throw; }
        }