This documentation is archived and is not being maintained.

Code Listing: Programming Platform Object in C#

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

The following C# code example shows a C# class using the IUccPlatform interface and implementing the event handlers as defined in the _IUccPlatformEvents class.

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Office.Interop.UccApi;

namespace UccApiComponents
{
    public class UccApiPlatform : UccApiObject
    {
        UccPlatform uccPlatform = null;
        UccContext context;
        string appName;
        bool isShutdown;

        public UccApiPlatform(string appName, UccContext ctx) : base()
        {
            if (appName == null || appName == "")
                this.appName = "MyUccApiApp";
            else
                this.appName = appName;
            this.context = ctx;
            
            this.uccPlatform = new UccPlatform();
            this.AdviseForEvents<_IUccPlatformEvents>(this.uccPlatform, this);
            
            this.uccPlatform.Initialize(this.appName, this.context);
            this.isShutdown = false;
        }


        public void Shutdown(UccOperationContext operationContext)
        {
            if (!this.isShutdown)
            {
                this.uccPlatform.Shutdown(operationContext);
            }
        }

        public UccApiEndpoint CreateEndpoint(string sipUri, string epId, UccContext ctx)
        {
            UccApiEndpoint apiEndpoint = new UccApiEndpoint(this, sipUri, epId, ctx);
            return apiEndpoint;
        }

        public UccPlatform UccPlatform
        {
            get { return this.uccPlatform; }
        }

        public string AppName
        {
            get { return this.appName; }
        }

        public UccContext UccContext
        {
            get { return this.context; }
        }

    }

}

Show: