Exemple #1
0
        void OnDisposing()
        {
            var context = MVVMContext.FromControl(this);

            if (context != null)
            {
                context.Dispose();
            }
        }
        void OnDisposing()
        {
            MVVMContext.RegisterXtraMessageBoxService();
            var context = MVVMContext.FromControl(this);

            if (context != null)
            {
                context.Dispose();
            }
        }
Exemple #3
0
        public UCMannual()
        {
            InitializeComponent();
            InitializeBindings();

            this.Load += (sender, e) =>
            {
                var viewModel = MVVMContext.FromControl(this).GetViewModel <ManualViewModel>();
                var monitor   = new UnitMonitor(this, () => viewModel.RaisePropertiesChanged());
                monitor.Listen();
            };
        }
        public UCMachineControl()
        {
            InitializeComponent();
            InitializeBindings();

            this.btnPause.Enabled           = false;
            this.btnBreakPointStart.Enabled = false;
            this.btnLocate.Enabled          = false;
            this.btnForward.Enabled         = false;
            this.btnBackward.Enabled        = false;

            this.Load += (sender, e) =>
            {
                var viewModel = MVVMContext.FromControl(this).GetViewModel <MachineViewModel>();
                var monitor   = new UnitMonitor(this, () => viewModel.RaisePropertiesChanged());
                monitor.Listen();
            };
        }
 public static object GetViewModel(this Control @this, Type type)
 {
     if (@this != null)
     {
         MVVMContext context = MVVMContext.FromControl(@this);
         if (context != null && context.ViewModelType == type)
         {
             return(MVVMContext.GetViewModel(@this));
         }
         var dockPanel = @this as DockPanel;
         if (dockPanel != null)
         {
             return(GetViewModel(dockPanel.DockManager.Form, type));
         }
         if (@this.Parent != null)
         {
             return(GetViewModel(@this.Parent, type));
         }
     }
     return(null);
 }