Exemple #1
0
        public XtraDialogServiceUserControl()
        {
            InitializeComponent();
            #region SetUp
            MVVMContext mvvmContext = new MVVMContext();
            mvvmContext.ContainerControl = this;

            SimpleButton commandButton = new SimpleButton();
            commandButton.Text = "Execute Command";
            commandButton.Dock = DockStyle.Top;

            MemoEdit memo = new MemoEdit();
            memo.Dock = DockStyle.Top;
            memo.Properties.ReadOnly = true;
            memo.MinimumSize         = new System.Drawing.Size(0, 100);

            commandButton.Parent = this;
            memo.Parent          = this;

            #endregion SetUp

            #region #xtraDialogService
            // Force use the XtraDialogService
            MVVMContext.RegisterXtraDialogService();
            //
            mvvmContext.ViewModelType = typeof(NotesViewModel);
            // UI binding for Notes
            mvvmContext.SetBinding(memo, m => m.EditValue, "Notes");
            // UI binding for button
            mvvmContext.BindCommand <NotesViewModel>(commandButton, x => x.EditNotes());
            #endregion #xtraDialogService
        }
        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());
        }
Exemple #3
0
 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));
 }
Exemple #4
0
 public ObjectExplorer()
 {
     InitializeComponent();
     if (!mvvmContextObjectExplorer.IsDesignMode)
     {
         InitializeBindings();
     }
     MVVMContext.RegisterXtraDialogService();
     HookupEvents();
     RegisterServices();
     CreatePopUpActions();
 }