Beispiel #1
0
        public void Sets_messenger_types()
        {
            var messageTypes = new MessageTypes();

            var sut = new MessengerOptions(messageTypes);

            Assert.Equal(messageTypes, sut.MessageTypes);
        }
 public ServerInformationMulticast(IWebHostEnvironment env, MessengerOptions messengerOptions, MusicServerOptions serverOptions, Messenger messenger, CancellationToken cancellationToken, ILoggerFactory loggerFactory)
 {
     Debug.Assert(messengerOptions != null);
     Debug.Assert(serverOptions != null);
     Debug.Assert(messenger != null);
     this.environment        = env;
     this.messengerOptions   = messengerOptions;
     this.musicServerOptions = serverOptions;
     this.lf                = loggerFactory;
     this.messenger         = messenger;
     this.log               = lf.CreateLogger <ServerInformationMulticast>();// log;
     this.cancellationToken = cancellationToken;
     InitialiseServerInformation();
 }
Beispiel #3
0
        public PlayManager(IHubContext <PlayHub, IHubMessage> playHub, IServiceProvider serviceProvider,
                           IWebHostEnvironment env,
                           IOptions <MusicServerOptions> serverOptions, Messenger messenger, IOptions <MessengerOptions> messengerOptions,
                           ILogger <PlayManager> log, ILoggerFactory loggerFactory) : base(log)
        {
            this.messengerOptions   = messengerOptions.Value;
            this.playHub            = playHub;
            this.serviceProvider    = serviceProvider;
            this.musicServerOptions = serverOptions.Value;
            this.environment        = env;

            this.messenger = messenger;
            this.messenger.EnableMulticastSend();
            this.lf       = loggerFactory;
            this.taskList = new List <Task>();
            this.devices  = new Dictionary <string, DeviceRuntime>();
        }
Beispiel #4
0
        public static void Main(string[] args)
        {
            var messageProvider  = new InMemoryMessageProvider();
            var messengerOptions = new MessengerOptions(messageTypes);

            messenger = new StackMessenger(messageProvider, messengerOptions);

            var input = string.Empty;

            do
            {
                PrintHeader();

                input = System.Console.ReadLine();

                var now = System.DateTime.UtcNow;

                if (input == "e")
                {
                    messenger.Add(new Message("An error has occured", now.ToString(), messageTypes.Error));
                }
                else if (input == "i")
                {
                    messenger.Add(new Message("This is an information message.", now.ToString(), messageTypes.Information));
                }
                else if (input == "s")
                {
                    messenger.Add(new Message("Congraulations!", now.ToString(), messageTypes.Success));
                }
                else if (input == "w")
                {
                    messenger.Add(new Message("Be careful.", now.ToString(), messageTypes.Warning));
                }
                else if (input == "p")
                {
                    PrintMessages();
                }

                System.Console.WriteLine("");
            } while (input != "q");
        }