private void InitBindings() { MVVMContext.RegisterMessageBoxService(); mvvmContext1.ViewModelType = typeof(LoginViewModel); var fluentAPI = mvvmContext1.OfType <LoginViewModel>(); mvvmContext1.RegisterService(SplashScreenService.Create(splashScreenManager1)); fluentAPI.SetBinding(txtUserName, t => t.EditValue, x => x.CurrentUser); var loginFrm = this; fluentAPI.WithEvent <KeyEventArgs>(txtUserName, "KeyDown").EventToCommand(x => x.KeyDown(null), x => loginFrm, e => (e.KeyCode == Keys.Enter)); fluentAPI.WithEvent <EventArgs>(btnLogin, "Click").EventToCommand(x => x.Login(null), x => loginFrm); }
private void InitBindings() { MVVMContext.RegisterMessageBoxService(); mvvmContext1.ViewModelType = typeof(NewAgentViewModel); var fluentAPI = mvvmContext1.OfType <NewAgentViewModel>(); mvvmContext1.RegisterService(SplashScreenService.Create(splashScreenManager1)); fluentAPI.SetBinding(txtAgentName, x => x.EditValue, x => x.Agent.vchar_AGname); fluentAPI.SetBinding(txtContactor, x => x.EditValue, x => x.Agent.vchar_AGLinkMan); fluentAPI.SetBinding(txtContactNum, x => x.EditValue, x => x.Agent.vchar_AGcontect); fluentAPI.SetBinding(txtAgentCode, x => x.EditValue, x => x.Agent.vchar_AGcode); fluentAPI.SetBinding(txtAgentType, x => x.EditValue, x => x.Agent.int_AGtype); fluentAPI.SetBinding(cbxOpenSyncServer, x => x.EditValue, x => x.Agent.bit_synOpen); fluentAPI.SetBinding(cbxSearchService, x => x.EditValue, x => x.Agent.bit_synQuery); fluentAPI.SetBinding(cbxOpenPushServer, x => x.EditValue, x => x.Agent.bit_synPush); fluentAPI.SetBinding(txtVerifyCode, x => x.EditValue, x => x.Agent.vchar_synVerify); fluentAPI.SetBinding(txtSearchVerifyCode, x => x.EditValue, x => x.Agent.vchar_QueryVerify); fluentAPI.SetBinding(txtPushServerVerifyCode, x => x.EditValue, x => x.Agent.vchar_PushVerify); fluentAPI.SetBinding(txtPushUser, x => x.EditValue, x => x.Agent.vchar_PushUser); fluentAPI.SetBinding(txtKeyWords, x => x.EditValue, x => x.Agent.vchar_synStopKeyWord); fluentAPI.SetBinding(txtSyncTimSpan, x => x.EditValue, x => x.Agent.int_synSpacing); var viewModel = mvvmContext1.GetViewModel <NewAgentViewModel>(); if (Parent is NewAgentFrm) { viewModel.NewAgentFrm = Parent as NewAgentFrm; } fluentAPI.SetBinding(gpcSync, x => x.Enabled, x => x.IsGPCSync); fluentAPI.SetBinding(gpcQuery, x => x.Enabled, x => x.IsGPCQuery); fluentAPI.SetBinding(gpcPush, x => x.Enabled, x => x.IsGPCPush); fluentAPI.BindCommand(btnSave, x => x.SaveAgentInfo()); fluentAPI.WithEvent <EventArgs>(txtAgentType, "SelectedIndexChanged").EventToCommand(x => x.AgentTypeChanged()); }
public MessageBoxServiceUserControl() { InitializeComponent(); #region SetUp MVVMContext mvvmContext = new MVVMContext(); mvvmContext.ContainerControl = this; SimpleButton commandButton = new SimpleButton(); commandButton.Text = "Execute Command"; commandButton.Dock = DockStyle.Top; commandButton.Parent = this; #endregion SetUp #region #messageBoxService // Force use the MessageBoxService MVVMContext.RegisterMessageBoxService(); // mvvmContext.ViewModelType = typeof(SayHelloViewModel); // UI binding for button mvvmContext.BindCommand <SayHelloViewModel>(commandButton, x => x.SayHello()); #endregion #messageBoxService }
private void InitBindings() { mvvmContext1.ViewModelType = typeof(CheckPointServerMgrViewModel); var fluentAPI = mvvmContext1.OfType <CheckPointServerMgrViewModel>(); MVVMContext.RegisterMessageBoxService(); mvvmContext1.RegisterService(SplashScreenService.Create(splashScreenManager1)); var agents = fluentAPI.ViewModel.CBXAgents.ToList(); cbxAgentName.Properties.Items.AddRange(agents); fluentAPI.SetBinding(cbxAgentName, cbx => cbx.EditValue, x => x.SelectedAgent); fluentAPI.SetBinding(serverLogdate, date => date.EditValue, x => x.ServerLogDate); fluentAPI.SetBinding(gridControl1, gc => gc.DataSource, x => x.Logs); fluentAPI.BindCommand(btnRefresh, x => x.GetServerLogs()); fluentAPI.SetBinding(lblServerStatus, lbl => lbl.Text, x => x.ServerStatus); fluentAPI.SetBinding(lblServerStatus, lbl => lbl.BackColor, x => x.ServerStatusBackColor); fluentAPI.SetBinding(btnStartServer, btn => btn.Text, x => x.BtnStartServerText); fluentAPI.BindCommand(btnStartServer, x => x.UpdateServerStatus()); }