예제 #1
0
 internal InviteViewModel(InviteModel model)
 {
     this.model = model;    
     model.UpdateStatusMessage +=model_UpdateStatusMessage;           
     IsTextblockVisible = Visibility.Hidden;
     InviteCommand = new DelegateCommand(OnInvite);
 }
예제 #2
0
 public void Startup(ViewStartupParams p)
 {
     publishModel = new PublishModel(p.AuthProvider, p.CustomNodeManager);
     publishViewModel = new PublishViewModel(publishModel);
    
     inviteModel = new InviteModel(p.AuthProvider);
     inviteModel.MessageLogged += this.OnMessageLogged;
     inviteViewModel = new InviteViewModel(inviteModel);            
 }
예제 #3
0
        public void SendRequestTest()
        {
            // Create mock of rest client.
            var restClient = new Mock<RestClient>();
            restClient.Setup(x => x.Execute(It.IsAny<IRestRequest>()))
                .Returns(new RestResponse()
                {
                    StatusCode = HttpStatusCode.OK
                });

            // Create Invite model.
            inviteModel = new InviteModel(authenticationProvider.Object, restClient.Object);

            var response = inviteModel.Send();
            Assert.True(response);
        }
        /// <summary>
        /// Generates the invite menu item.
        /// </summary>
        /// <returns></returns>
        private MenuItem GenerateInviteMenuItem()
        {
            var item = new MenuItem();
            item.Header = Resources.InviteViewMenuTitle;

            var isEnabled = startupParams.AuthProvider != null;
            item.IsEnabled = isEnabled;

            item.Click += (sender, args) =>
            {
                var model = new InviteModel(startupParams.AuthProvider);
                model.MessageLogged += this.OnMessageLogged;

                var viewModel = new InviteViewModel(model);

                var view = new InviteView(viewModel)
                {
                    Owner = loadedParams.DynamoWindow,
                    WindowStartupLocation = WindowStartupLocation.CenterOwner
                };

                view.ShowDialog();

                model.MessageLogged -= this.OnMessageLogged;
            };

            return item;
        }