private void InitBindings() { MVVMContext.RegisterXtraMessageBoxService(); MVVMContext.RegisterXtraDialogService(); mvvmContext1.ViewModelType = typeof(BusinessPartnerViewModel); var fluentAPI = mvvmContext1.OfType <BusinessPartnerViewModel>(); //mvvmContext1.RegisterService(new NewAgentFrm()); mvvmContext1.RegisterService(SplashScreenService.Create(splashScreenManager1)); fluentAPI.SetBinding(gridControl1, gv => gv.DataSource, x => x.Agents); fluentAPI.WithEvent <ColumnView, FocusedRowObjectChangedEventArgs>(gridView1, "FocusedRowObjectChanged") .SetBinding(x => x.SelectedAgent, args => args.Row as Agent, (gView, entity) => { gView.FocusedRowHandle = gView.FindRow(entity); if (entity != null) { gpcPush.Enabled = entity.bit_synPush; gpcQuery.Enabled = entity.bit_synQuery; gpcSync.Enabled = entity.bit_synOpen; } }); fluentAPI.SetBinding(txtAgentName, x => x.EditValue, x => x.SelectedAgent.vchar_AGname); fluentAPI.SetBinding(txtContactor, x => x.EditValue, x => x.SelectedAgent.vchar_AGLinkMan); fluentAPI.SetBinding(txtContactNum, x => x.EditValue, x => x.SelectedAgent.vchar_AGcontect); fluentAPI.SetBinding(txtAgentCode, x => x.EditValue, x => x.SelectedAgent.vchar_AGcode); fluentAPI.SetBinding(txtAgentType, x => x.EditValue, x => x.SelectedAgent.int_AGtype); fluentAPI.SetBinding(cbxOpenSyncServer, x => x.EditValue, x => x.SelectedAgent.bit_synOpen); fluentAPI.SetBinding(cbxSearchService, x => x.EditValue, x => x.SelectedAgent.bit_synQuery); fluentAPI.SetBinding(cbxOpenPushServer, x => x.EditValue, x => x.SelectedAgent.bit_synPush); fluentAPI.SetBinding(txtVerifyCode, x => x.EditValue, x => x.SelectedAgent.vchar_synVerify); fluentAPI.SetBinding(txtSearchVerifyCode, x => x.EditValue, x => x.SelectedAgent.vchar_QueryVerify); fluentAPI.SetBinding(txtPushServerVerifyCode, x => x.EditValue, x => x.SelectedAgent.vchar_PushVerify); fluentAPI.SetBinding(txtPushUser, x => x.EditValue, x => x.SelectedAgent.vchar_PushUser); fluentAPI.SetBinding(txtKeyWords, x => x.EditValue, x => x.SelectedAgent.vchar_synStopKeyWord); fluentAPI.SetBinding(txtSyncTimSpan, x => x.EditValue, x => x.SelectedAgent.int_synSpacing); fluentAPI.BindCommand(btnAdd, x => x.AddAgentInfo()); fluentAPI.BindCommand(btnDelete, x => x.DeleteSelectedAgent()); fluentAPI.BindCommand(btnSave, x => x.SaveAgentInfo()); 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.WithEvent <EventArgs>(txtAgentType, "SelectedIndexChanged").EventToCommand(x => x.AgentTypeChanged()); }
private void RegisterServices() { MVVMContext.RegisterXtraDialogService(); mvvmContextMain.RegisterService(new SettingsWindowService()); mvvmContextMain.RegisterService(new TextEditorFontChangeService()); mvvmContextMain.RegisterService(new ConnectionWindowService()); mvvmContextMain.RegisterService(new QueryBuilderService()); mvvmContextMain.RegisterService(new BackupViewService()); mvvmContextMain.RegisterService(App.Skins); mvvmContextMain.RegisterService(SplashScreenService.Create(splashScreenManagerMainWait)); }
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()); }
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()); }
private void InitializeBindings() { var fluent = mvvmContextConnectionWindowView.OfType <ConnectionWindowViewModel>(); mvvmContextConnectionWindowView.RegisterService(SplashScreenService.Create(splashScreenManager)); fluent.BindCommand(simpleButtonCreateNewString, x => x.GoToConnectionBuilder()); fluent.BindCommand(simpleButtonCancelCreateConnection, x => x.GoToConnectionManager()); fluent.BindCommand(simpleButtonCancel, x => x.Cancel()); fluent.BindCommand(simpleButtonSaveAndTest, x => x.TestAndSave()); fluent.BindCommand(simpleButtonConnect, x => x.Connect()); fluent.BindCommand(simpleButtonQueryInstances, x => x.GetInstances()); fluent.SetBinding(textEditNickName, x => x.EditValue, y => y.NickName); fluent.SetBinding(textEditPassword, x => x.EditValue, y => y.Password); fluent.SetBinding(textEditUserName, x => x.EditValue, y => y.UserId); fluent.SetBinding(lookUpEditSavedConnections.Properties, x => x.DataSource, vm => vm.SavedConnections); fluent.SetBinding(lookUpEditSavedConnections, x => x.EditValue, y => y.SelectedConnection); fluent.SetBinding(checkEditWindowsAuthentication, x => x.EditValue, y => y.UseWindowsAuthentication); fluent.SetBinding(spinEditConnectionTimeout, x => x.EditValue, y => y.ConnectTimeout); fluent.SetItemsSourceBinding(comboBoxEditInstances.Properties, cb => cb.Items, x => x.Instances, (i, e) => Equals(i.Value, e), entity => new ImageComboBoxItem(entity), null, null); fluent.SetBinding(comboBoxEditInstances, x => x.EditValue, vm => vm.DataSource); fluent.SetBinding(simpleButtonConnect, x => x.Enabled, vm => vm.CanConnect); fluent.SetBinding(checkEditShowOnStartup, x => x.Checked, x => x.ShowOnStartup); fluent.SetTrigger(x => x.WindowState, state => { switch (state) { case ConnectionWindowViewModel.State.Open: break; case ConnectionWindowViewModel.State.ConnectionManager: ShowConnectionManager(); break; case ConnectionWindowViewModel.State.ConnectionBuilder: ShowConnectionBuilder(); break; case ConnectionWindowViewModel.State.Exit: Close(); break; default: break; } }); fluent.SetTrigger(x => x.UseWindowsAuthentication, state => { switch (state) { case false: textEditPassword.Enabled = true; textEditUserName.Enabled = true; break; case true: textEditPassword.Enabled = false; textEditUserName.Enabled = false; break; default: break; } }); }