public SimpleCommandUserControl() { InitializeComponent(); #region SetUp MVVMContext mvvmContext = new MVVMContext(); mvvmContext.ContainerControl = this; ProgressBarControl progressBar = new ProgressBarControl(); progressBar.Dock = DockStyle.Top; SimpleButton commandButton = new SimpleButton(); commandButton.Text = "Start Command Execution"; commandButton.Dock = DockStyle.Top; SimpleButton cancelButton = new SimpleButton(); cancelButton.Text = "Cancel Command Execution"; cancelButton.Dock = DockStyle.Top; cancelButton.Parent = this; commandButton.Parent = this; progressBar.Parent = this; #endregion SetUp #region #simpleCommand cancelButton.Visible = false; progressBar.Visible = false; // mvvmContext.ViewModelType = typeof(ViewModelWithAsyncCommand); // UI binding for button mvvmContext.BindCommand <ViewModelWithAsyncCommand>(commandButton, x => x.DoSomethingAsynchronously()); #endregion #simpleCommand }
public RibbonDialogServiceUserControl() { 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 #ribbonDialogService // Force use the RibbonDialogService MVVMContext.RegisterRibbonDialogService(); // 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 #ribbonDialogService }
public SimpleCommandWithCancellationUserControl() { InitializeComponent(); #region SetUp MVVMContext mvvmContext = new MVVMContext(); mvvmContext.ContainerControl = this; ProgressBarControl progressBar = new ProgressBarControl(); progressBar.Dock = DockStyle.Top; SimpleButton commandButton = new SimpleButton(); commandButton.Text = "Start Command Execution"; commandButton.Dock = DockStyle.Top; SimpleButton cancelButton = new SimpleButton(); cancelButton.Text = "Cancel Command Execution"; cancelButton.Dock = DockStyle.Top; cancelButton.Parent = this; commandButton.Parent = this; progressBar.Parent = this; #endregion SetUp #region #simpleCommandWithCancellation mvvmContext.ViewModelType = typeof(ViewModelWithAsyncCommandAndCancellation); // UI binding for button mvvmContext.BindCommand <ViewModelWithAsyncCommandAndCancellation>(commandButton, x => x.DoSomethingAsynchronously()); // UI binding for cancelation mvvmContext.BindCancelCommand <ViewModelWithAsyncCommandAndCancellation>(cancelButton, x => x.DoSomethingAsynchronously()); // UI binding for progress mvvmContext.SetBinding(progressBar, p => p.EditValue, "Progress"); #endregion #simpleCommandWithCancellation }
public SimpleCommandUserControl() { 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 #simpleCommand mvvmContext.ViewModelType = typeof(ViewModelWithSimpleCommand); // UI binding for button mvvmContext.BindCommand <ViewModelWithSimpleCommand>(commandButton, x => x.DoSomething()); #endregion #simpleCommand }
public ParameterizedCommandUserControl() { 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 #parameterizedCommand mvvmContext.ViewModelType = typeof(ViewModelWithParametrizedCommand); // object parameter = 5; // UI binding for button with `queryParameter` function mvvmContext.BindCommand <ViewModelWithParametrizedCommand, object>(commandButton, (x, p) => x.DoSomething(p), x => parameter); #endregion #parameterizedCommand }
public CustomServiceUserControl() { 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 #customService mvvmContext.ViewModelType = typeof(ViewModelWithCustomService); // Custom service registration mvvmContext.RegisterService(new CustomService()); // UI binding for button mvvmContext.BindCommand <ViewModelWithCustomService>(commandButton, x => x.DoSomethingViaCustomService()); #endregion #customService }
public XtraMessageBoxServiceUserControl() { 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 #xtraMessageBoxService // Force use the XtraMessageBoxService MVVMContext.RegisterXtraMessageBoxService(); // mvvmContext.ViewModelType = typeof(SayHelloViewModel); // UI binding for button mvvmContext.BindCommand <SayHelloViewModel>(commandButton, x => x.SayHello()); #endregion #xtraMessageBoxService }