/// <summary>
        /// Instantiate a custom server (e.g. for testing).
        /// </summary>
        /// <param name="config">The configuration to initialize.</param>
        /// <param name="logger">Logger instance.</param>
        public void Initialize(IConfiguration config, SampleLogger logger)
        {
            this.Configuration = config;
            this.logger        = logger;

            Bot.Bot.Instance.Initialize(this, logger);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HueBot"/> class.
        /// </summary>
        /// <param name="context">Stateful service context from service fabric.</param>
        /// <param name="logger">Global logger instance.</param>
        public HueBot(StatefulServiceContext context, SampleLogger logger)
            : base(context)
        {
            this.logger = logger;

            // Set directory to where the assemblies are running from.
            // This is necessary for Media binaries to pick up logging configuration.
            var location = Assembly.GetExecutingAssembly().Location;

            Directory.SetCurrentDirectory(Path.GetDirectoryName(location));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Initialize the instance.
        /// </summary>
        /// <param name="service">Service instance.</param>
        /// <param name="logger">Graph logger.</param>
        internal void Initialize(Service service, SampleLogger logger)
        {
            Validator.IsNull(this.Logger, "Multiple initializations are not allowed.");

            this.Logger = logger;

            var builder      = new CommunicationsClientBuilder("AudioVideoPlaybackBot", service.Configuration.AadAppId, this.Logger);
            var authProvider = new AuthenticationProvider(
                service.Configuration.AadAppId,
                service.Configuration.AadAppSecret,
                this.Logger);

            builder.SetAuthenticationProvider(authProvider);
            builder.SetNotificationUrl(service.Configuration.CallControlBaseUrl);
            builder.SetMediaPlatformSettings(service.Configuration.MediaPlatformSettings);
            builder.SetServiceBaseUrl(service.Configuration.PlaceCallEndpointUrl);

            this.Client = builder.Build();
            this.Client.Calls().OnIncoming += this.CallsOnIncoming;
            this.Client.Calls().OnUpdated  += this.CallsOnUpdated;

            this.OnlineMeetings = new OnlineMeetingHelper(authProvider, service.Configuration.PlaceCallEndpointUrl);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IncidentsController"/> class.
 /// </summary>
 /// <param name="bot">The bot.</param>
 /// <param name="logger">Logger instance.</param>
 public IncidentsController(Bot bot, SampleLogger logger)
 {
     this.bot    = bot;
     this.logger = logger;
 }
Exemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DemoController"/> class.
 /// </summary>
 /// <param name="bot">Bot instance.</param>
 /// <param name="logger">Logger instance.</param>
 public DemoController(Bot bot, SampleLogger logger)
 {
     this.bot    = bot;
     this.logger = logger;
 }