Beispiel #1
0
        private async Task ExecuteHandlerMethod(MethodInfo handlerMethodInfo, IMessageController controller, OwinContext context)
        {
            var properties = PropertieBuilder.Build(handlerMethodInfo, context, out bool error);

            if (error == true)
            {
                return;
            }

            var           obj          = handlerMethodInfo.Invoke(controller, properties.Values.ToArray());
            IActionResult actionResult = null;

            if (obj is Task <IActionResult> actionTask)
            {
                actionResult = await actionTask;
            }
            else if (obj is IActionResult)
            {
                actionResult = obj as IActionResult;
            }

            var actionContext = new ActionContext(context, new ActionDescriptor()
            {
            }, properties, controller);
            await actionResult.ExecuteResultAsync(actionContext);
        }
Beispiel #2
0
 private static void Initialize()
 {
     _messageFactory    = TweetinviContainer.Resolve <IMessageFactory>();
     _messageController = TweetinviContainer.Resolve <IMessageController>();
     _messageGetLatestsReceivedRequestParametersFactory = TweetinviContainer.Resolve <IFactory <IMessageGetLatestsReceivedRequestParameters> >();
     _messageGetLatestsSentRequestParametersFactory     = TweetinviContainer.Resolve <IFactory <IMessageGetLatestsSentRequestParameters> >();
 }
Beispiel #3
0
 private static void Initialize()
 {
     _messageFactory = TweetinviContainer.Resolve<IMessageFactory>();
     _messageController = TweetinviContainer.Resolve<IMessageController>();
     _messageGetLatestsReceivedRequestParametersFactory = TweetinviContainer.Resolve<IFactory<IMessageGetLatestsReceivedRequestParameters>>();
     _messageGetLatestsSentRequestParametersFactory = TweetinviContainer.Resolve<IFactory<IMessageGetLatestsSentRequestParameters>>();
 }
Beispiel #4
0
        public LoggedUser(
            IUserDTO userDTO,
            ICredentialsAccessor credentialsAccessor,
            ITimelineController timelineController,
            ITweetController tweetController,
            ITweetFactory tweetFactory,
            IUserController userController,
            IMessageController messageController,
            IFriendshipFactory friendshipFactory,
            IFriendshipController friendshipController,
            IAccountController accountController,
            ISavedSearchController savedSearchController)

            : base(userDTO, timelineController, userController, friendshipFactory)
        {
            _credentialsAccessor   = credentialsAccessor;
            _tweetController       = tweetController;
            _tweetFactory          = tweetFactory;
            _messageController     = messageController;
            _friendshipController  = friendshipController;
            _accountController     = accountController;
            _savedSearchController = savedSearchController;

            Credentials = _credentialsAccessor.CurrentThreadCredentials;
        }
Beispiel #5
0
        public AuthenticatedUser(
            IUserDTO userDTO,
            ICredentialsAccessor credentialsAccessor,
            ITimelineController timelineController,
            ITweetController tweetController,
            IUserController userController,
            IMessageController messageController,
            IFriendshipController friendshipController,
            IAccountController accountController,
            ITwitterListController twitterListController,
            ISavedSearchController savedSearchController,
            ITaskFactory taskFactory)

            : base(userDTO, userController, timelineController, friendshipController, twitterListController, taskFactory)
        {
            _credentialsAccessor   = credentialsAccessor;
            _tweetController       = tweetController;
            _messageController     = messageController;
            _friendshipController  = friendshipController;
            _accountController     = accountController;
            _twitterListController = twitterListController;
            _savedSearchController = savedSearchController;

            Credentials = _credentialsAccessor.CurrentThreadCredentials;
        }
Beispiel #6
0
 public Message(
     IUserFactory userFactory,
     IMessageController messageController,
     IMessageDTO messageDTO)
 {
     _userFactory       = userFactory;
     _messageController = messageController;
     _messageDTO        = messageDTO;
 }
Beispiel #7
0
 public MessageRequester(
     ITwitterClient client,
     IMessageController messageController,
     IMessagesClientParametersValidator messagesClientParametersValidator,
     ITwitterClientEvents twitterClientEvents)
     : base(client, twitterClientEvents)
 {
     _messageController = messageController;
     _messagesClientParametersValidator = messagesClientParametersValidator;
 }
Beispiel #8
0
 public Message(
     IUserFactory userFactory,
     IMessageController messageController,
     IMessageDTO messageDTO,
     ITaskFactory taskFactory)
 {
     _userFactory       = userFactory;
     _messageController = messageController;
     _messageDTO        = messageDTO;
     _taskFactory       = taskFactory;
 }
Beispiel #9
0
 public Message(
     IUserFactory userFactory,
     IMessageController messageController,
     IMessageDTO messageDTO,
     ITaskFactory taskFactory)
 {
     _userFactory = userFactory;
     _messageController = messageController;
     _messageDTO = messageDTO;
     _taskFactory = taskFactory;
 }
Beispiel #10
0
        private bool ExecuteBeforeHandlerMethod(MethodInfo method, IMessageController controller, OwinContext context)
        {
            var beforeProperties = PropertieBuilder.Build(method, context, out bool berror);

            if (berror == true)
            {
                return(false);
            }
            var beforeResult = (bool)method.Invoke(controller, beforeProperties.Values.ToArray());

            return(beforeResult);
        }
Beispiel #11
0
 public Message(
     IUserFactory userFactory,
     IMessageController messageController,
     IEventDTO eventDTO,
     IApp app,
     ITaskFactory taskFactory)
 {
     _userFactory       = userFactory;
     _messageController = messageController;
     EventDTO           = eventDTO;
     _app         = app;
     _taskFactory = taskFactory;
 }
Beispiel #12
0
        /// <summary>
        /// Консольный ввод команд.
        /// Console comands input.
        /// </summary>
        private static void CommandsParser()
        {
            bool continueWorking = true;

            while (continueWorking)
            {
                var key = Console.ReadKey().Key;
                Console.WriteLine();
                switch (key)
                {
                case ConsoleKey.E:
                    Console.WriteLine($"Enter host name:");
                    var hostName = Console.ReadLine();
                    Console.WriteLine($"Enter port:");
                    int.TryParse(Console.ReadLine(), out int port);
                    Console.WriteLine($"Enter virtual host (default '/'):");
                    var virtualHost = Console.ReadLine();
                    Console.WriteLine($"Enter user name:");
                    var userName = Console.ReadLine();
                    Console.WriteLine($"Enter password");
                    var password = Console.ReadLine();
                    DrawMenu();
                    messageController = new MessageController(hostName, port, virtualHost, userName, password);
                    break;

                case ConsoleKey.S:
                    Console.WriteLine($"Enter channel name:");
                    var channelToSend = Console.ReadLine();
                    Console.WriteLine($"Enter message:");
                    var message = Console.ReadLine();
                    messageController.SendMessage(new Message(message, channelToSend));
                    break;

                case ConsoleKey.L:
                    Console.WriteLine($"Enter channel name to listen:");
                    var channelToListen = Console.ReadLine();
                    messageController.ReceiveMessages(channelToListen);
                    break;

                case ConsoleKey.Q:
                    continueWorking = false;
                    break;

                case ConsoleKey.C:
                    DrawMenu();
                    break;
                }
            }
        }
Beispiel #13
0
 public HubIntegration(IHttpMessageSender httpMessageSender, IMessageController messageController)
 {
     _httpMessageSender = httpMessageSender;
     _messageController = messageController;
     LoadCRM();
 }
Beispiel #14
0
 public ZohoEvent(IHttpMessageSender httpMessageSender, IMessageController messageController) : base(httpMessageSender, messageController)
 {
 }
Beispiel #15
0
 private static void Initialize()
 {
     _messageFactory = TweetinviContainer.Resolve<IMessageFactory>();
     _messageController = TweetinviContainer.Resolve<IMessageController>();
 }
Beispiel #16
0
 public ZohoPotential(IHttpMessageSender httpMessageSender, IMessageController messageController) : base(httpMessageSender, messageController)
 {
 }
Beispiel #17
0
 public ZohoBase(IHttpMessageSender httpMessageSender, IMessageController messageController)
 {
     _httpMessageSender = httpMessageSender;
     _messageController = messageController;
 }
 public MessagesController(IMessageController messageController)
 {
     _messageController = messageController;
 }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="type"></param>
        /// <param name="loopThread"></param>
        /// <param name="localUID"></param>
        /// <param name="sharedData"></param>
        /// <param name="sharedDataLock">all operations that modify sharedData (add and remove) should lock using this object</param>
        /// <param name="controller"></param>
        /// <param name="keysToListen"></param>
        /// <param name="debug"></param>
        public DataConnection(ConnectionType type, Thread loopThread, int localUID,
            Dictionary<string, DataEntry> sharedData, ReaderWriterLockSlim sharedDataLock, IMessageController controller,
            Subscription keysToListen, LogInstructions debug)
        {
            this._connectionType = type;
            this.runThread = loopThread;
            this.local_uid = localUID;
            this.data = sharedData;
            this.dataLock = sharedDataLock;

            // send and receive queues
            this.sendBuffer = new Queue<MemoryStream>();
            this.sendEntries = new Dictionary<string, SendMemory>();
            this.sendQueue = new Queue<string>();
            this.receiveEntries = new Dictionary<string,DataHeader>();

            this.keysToListen = keysToListen;

            // delegate to send messages
            this.controller = controller;

            this.debugBuffer = debug;
        }
 public LoginFailedHandler(IMessageController messageController)
 {
     MessageController = messageController;
 }
Beispiel #21
0
 public ZohoIntegration(IHttpMessageSender httpMessageSender, IMessageController messageController)
 {
     _httpMessageSender = httpMessageSender;
     _messageController = messageController;
 }
Beispiel #22
0
 public UserHandler(IMessageController messageController, IMessageHandler messageHandler)
 {
     this.messageController = messageController;
     this.messageHandler    = messageHandler;
 }
 public RegisterResponseHandler(IMessageController messageController)
 {
     MessageController = messageController;
 }
Beispiel #24
0
 public static void Main()
 {
     messageController = new MessageController();
     DrawMenu();
     CommandsParser();
 }
 public PersonelThermoMessageProcessor(ILogger <PersonelThermoMessageProcessor> logger,
                                       IMessageController messageController)
 {
     _logger            = logger;
     _messageController = messageController;
 }
Beispiel #26
0
        public async Task <StockResponse> GetStock(string stockCode, string url, string stockToken, HttpMethod httpMethod, bool sendMessage, IMessageController msgController, string userEmail)
        {
            StockResponse result = new StockResponse();

            result.StockCode = stockCode;
            try
            {
                string stockUrl   = url.Replace(stockToken, stockCode);
                var    request    = new HttpRequestMessage(httpMethod, stockUrl);
                var    httpClient = new HttpClient();
                var    response   = await httpClient.SendAsync(request);

                if (response.IsSuccessStatusCode)
                {
                    var data = await response.Content.ReadAsStreamAsync();

                    ReadStock(data, ref result);
                }
                else
                {
                    result.StockValue = string.Empty;
                    result.Error      = new Exception(string.Format("Error while trying to call {0} returned status code {1}", stockUrl, response.StatusCode));
                }
            }
            catch (Exception ex)
            {
                result.StockValue = string.Empty;
                result.Error      = ex;
            }

            if (sendMessage)
            {
                ChatMessage msg = new ChatMessage();
                msg.UserEmail        = "ChatBot";
                msg.IsChatBotMessage = true;
                if (result.StockValue != string.Empty)
                {
                    msg.MessageText = string.Format("{0} quote is ${1} per share", stockCode, result.StockValue);

                    await msgController.SendMessage(msg);
                }
                else
                {
                    msg.MessageText = string.Format("Sorry {0}, I could not retrieve the quote share for {1}", userEmail, stockCode);
                    if (result.Error != null)
                    {
                        msg.MessageText += string.Format(", reason: {0}", result.Error.Message);
                    }
                    await msgController.SendErrorMessage(msg);
                }
            }
            return(result);
        }
Beispiel #27
0
 private static void Initialize()
 {
     _messageFactory    = TweetinviContainer.Resolve <IMessageFactory>();
     _messageController = TweetinviContainer.Resolve <IMessageController>();
 }
Beispiel #28
0
 public UserHandler(IMessageController messageController)
 {
     this.messageController = messageController;
     this.messageHandler    = new MessageHandler(this);
 }
Beispiel #29
0
        public AdminHandler(IMessageController messageController, IMessageHandler messageHandler)
        {
            this.messageController = messageController;

            this.messageHandler = messageHandler;
        }