/// <summary>
        /// Ons the create.
        /// </summary>
        /// <returns>The create.</returns>
        /// <param name="bundle">Bundle.</param>
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.LoginView);

            progressDialog = new ProgressDialog(this);
            progressDialog.SetMessage("Loading...");
            progressDialog.SetCancelable(false);

            _loginField    = FindViewById <EditText>(Resource.Id.usernameField);
            _passwordField = FindViewById <EditText>(Resource.Id.passwordField);

            var registerButton = FindViewById <Button>(Resource.Id.registerButton);

            registerButton.Touch += (sender, e) =>
                                    Register(this, new Tuple <string, string>(_loginField.Text, _passwordField.Text));

            var loginButton = FindViewById <Button>(Resource.Id.loginButton);

            loginButton.Touch += (sender, e) =>
                                 Login(this, new Tuple <string, string>(_loginField.Text, _passwordField.Text));

            var app = ChatApplication.GetApplication(this);

            var state = new ApplicationState();

            _presenter = new LoginPresenter(state, new NavigationService(app));
            _presenter.SetView(this);

            app.CurrentActivity = this;
        }
        /// <summary>
        /// Ons the create.
        /// </summary>
        /// <returns>The create.</returns>
        /// <param name="bundle">Bundle.</param>
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.ChatView);

            var metrics = Resources.DisplayMetrics;

            _width = (int)((metrics.WidthPixels) / Resources.DisplayMetrics.Density);

            _scrollViewInnerLayout = FindViewById <LinearLayout>(Resource.Id.scrollViewInnerLayout);
            _editText = FindViewById <EditText>(Resource.Id.chatField);

            var sendButton = FindViewById <Button>(Resource.Id.sendButton);

            sendButton.Touch += HandleSendButton;

            var app = ChatApplication.GetApplication(this);

            app.CurrentActivity = this;

            _presenter = app.Presenter as ChatPresenter;
            _presenter.SetView(this);
            app.CurrentActivity = this;
        }
 private void InitAMVC()
 {
     _chatModel      = new ChatModel();
     _chatView       = new ChatView();
     _chatController = new ChatController();
     chatApplication = new ChatApplication();
     chatApplication.InitializeMVC(_chatModel, _chatView, _chatController);
 }
        public void ApplicationSendsMessageToUIThatItReceivesFromServer(string message)
        {
            var uiChannel = new FakeCommunicationChannel();
            var serverChannel = new FakeCommunicationChannel();
            var sut = new ChatApplication(uiChannel, serverChannel);
            sut.Start();

            serverChannel.SimulateMessageReceived(message);

            Assert.Equal(message, uiChannel.LastMessageSent);
        }
Exemple #5
0
        /// <summary>
        /// Ons the resume.
        /// </summary>
        /// <returns>The resume.</returns>
        protected override void OnResume()
        {
            base.OnResume();

            var app = ChatApplication.GetApplication(this);

            app.CurrentActivity = this;

            if (_presenter != null)
            {
                _presenter.SetView(this);
            }
        }
Exemple #6
0
        public void Setup()
        {
            TextuaCommandMapperMock = new Mock <ITextualCommandMapper>();
            ChatFacadeMock          = new Mock <IChatFacade>();
            MessageBrokerMock       = new Mock <IMessageBroker>();
            CommunicatorMock        = new Mock <ICommunicator <string> >();
            DomainEventsMock        = new Mock <IDomainEvents>();

            ChatApplication = new ChatApplication(ChatFacadeMock.Object,
                                                  TextuaCommandMapperMock.Object,
                                                  MessageBrokerMock.Object,
                                                  CommunicatorMock.Object,
                                                  DomainEventsMock.Object);
        }
Exemple #7
0
        public void Setup()
        {
            Configuration           = Mock.Of <IConfiguration>();
            CancellationTokenSource = new CancellationTokenSource();
            Clients      = new Dictionary <string, ChatClient>();
            LastMessages = new Dictionary <string, List <string> >();
            InjectionConfig.ConfigureServices(Configuration);
            ChatApplication = InjectionConfig.Get <ChatApplication>();

            Task.Run(async() =>
            {
                await ChatApplication.StartAsync(CancellationTokenSource.Token);
            });
        }
Exemple #8
0
        /// <summary>
        /// Ons the create.
        /// </summary>
        /// <returns>The create.</returns>
        /// <param name="bundle">Bundle.</param>
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            ListView.SetBackgroundColor(Color.White);

            var app = ChatApplication.GetApplication(this);

            app.CurrentActivity = this;

            _presenter = app.Presenter as ClientsListPresenter;
            _presenter.SetView(this);

            _adapter    = new ClientsListAdapter(this);
            ListAdapter = _adapter;
        }
        public IActionResult CreateChatApplication(ChatApplicationViewModel model)
        {
            ChatApplication chatApplication = new ChatApplication()
            {
                AppId       = Guid.NewGuid().ToString(),
                DateCreated = DateTime.UtcNow,
                IsActive    = true,
                AppName     = model.AppName
            };

            _chatApplicationsLogic.AddEntity(chatApplication);
            int saveCount = _repository.Save();

            if (saveCount > 0)
            {
                return(Ok(chatApplication));
            }


            return(BadRequest("Invalid Auth Credentials"));
        }
Exemple #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Chat.Droid.Services.NavigationService"/> class.
 /// </summary>
 /// <param name="application">Application.</param>
 public NavigationService(ChatApplication application)
 {
     _application = application;
 }
 private static void InitiateChatApplication(string connectionString, string topicPath)
 {
     Console.WriteLine("EnterName:");
     var username        = Console.ReadLine();
     var chatApplication = new ChatApplication(connectionString, topicPath, username);
 }