Ejemplo n.º 1
0
 public UnifiedMessagingController(
     IUnifiedMessagingService messagingService,
     MessageRepository messageRepository,
     IMessageFormatter formattingMessenger,
     IFiber fiber)
 {
     _MessagingService = messagingService;
     _MessageRepository = messageRepository;
     _FormattingMessenger = formattingMessenger;
     _Fiber = fiber;
     _MessagingService.MessagesReceived += _MessagingService_MessagesReceived;
 }
Ejemplo n.º 2
0
        void App_Startup(object sender, StartupEventArgs e)
        {
            var messagingPlugInRepository = new MessagingPlugInRepository();
            var messagingPluginFinder = new MessagingPluginFinder(messagingPlugInRepository);
            var unifiedMessenger = new UnifiedMessenger(messagingPlugInRepository);

            var messagingFiber = new AsyncFiber(Dispatcher);
            var cachedCredentialRepository = new MessagingCredentialCache(messagingPlugInRepository);
            var userSecurityPrompt = new UserSecurityPrompt(messagingFiber);

            messagingPlugInRepository.OnCredentialsRequestedNotify(cachedCredentialRepository);
            cachedCredentialRepository.OnCredentialsRequestedNotify(userSecurityPrompt);
            cachedCredentialRepository.OnCredentialsProvidedNotify(unifiedMessenger);

            userSecurityPrompt.OnCredentialsProvidedNotify(cachedCredentialRepository);

            var codePasteToUrlService = new CodePasteToUrlService();
            var automaticMessageFormatting = new AutoFormatCodePastesAsUrls(codePasteToUrlService);

            var messageRepository = new MessageRepository();
            var unifiedMessagingController = new UnifiedMessagingController(unifiedMessenger, messageRepository, automaticMessageFormatting, messagingFiber);
            automaticMessageFormatting.OnMessageToSendNotify(unifiedMessagingController);

            var messagingViewModel = new MessagingViewModel(unifiedMessagingController);
            var messagingWindow = new MessagingWindow(messagingViewModel);

            messageRepository.OnAddedMessagesNotify(unifiedMessagingController);
            unifiedMessagingController.OnReceivedMessagesNotify(messagingViewModel);

            messagingPluginFinder.GetAllPlugins();

            unifiedMessagingController.StartReceiving();
            unifiedMessagingController.RequestMessageUpdate();

            messagingWindow.Show();
        }