protected BaseViewModel(string view, bool vmResolvesView, bool signedMaintenanceContract) { Log = LogManager.GetLogger(view); // ViewModel resolves the view if (vmResolvesView) { var attr = (ViewAttribute)GetType().GetCustomAttributes(typeof(ViewAttribute), true).FirstOrDefault(); if (attr == null) { throw new ApplicationException("ViewAttribute is missing"); } ViewReference = (FrameworkElement)Activator.CreateInstance(attr.ViewType); Uri resourceLocater = new Uri("/" + attr.ViewType.Module.ScopeName.Replace(".dll", "") + ";component/Views/" + attr.ViewType.Name + ".xaml", UriKind.Relative); Application.LoadComponent(ViewReference, resourceLocater); ViewReference.DataContext = this; } // View already resolved the viewModel if (ViewReference is Window) { ((Window)ViewReference).Left = Convert.ToDouble(ViewReference.GetValue(WindowProperties.LeftProperty)); ((Window)ViewReference).Top = Convert.ToDouble(ViewReference.GetValue(WindowProperties.TopProperty)); ((Window)ViewReference).Width = Convert.ToDouble(ViewReference.GetValue(WindowProperties.WidthProperty)); ((Window)ViewReference).Height = Convert.ToDouble(ViewReference.GetValue(WindowProperties.HeightProperty)); } if (signedMaintenanceContract) { DispatcherFacade = new MaintenanceEngineer(view, Log, Dispatcher); } }
public LoadControllerFactory(IDispatcherFacade Dispatcher, IFirmwarePackageViewModelKeyFormatter KeyFormatter, IFirmwarePackageViewModelFactory FirmwarePackageViewModelFactory) { _dispatcher = Dispatcher; _keyFormatter = KeyFormatter; _firmwarePackageViewModelFactory = FirmwarePackageViewModelFactory; }
public RemoteRepositoryLoadController(INotifyRepository Repository, ICollection<FirmwarePackageViewModel> PackagesCollection, List<ComponentTarget> RequiredTargets, IDispatcherFacade Dispatcher, IFirmwarePackageViewModelKeyFormatter KeyFormatter, CancellationTokenSource CancellationTokenSource, IFirmwarePackageViewModelFactory PackageViewModelFactory) : base(Repository, PackagesCollection, RequiredTargets, Dispatcher, KeyFormatter, CancellationTokenSource) { _packageViewModelFactory = PackageViewModelFactory; }
public EventAggregatorExceptionDialogSource(IEventAggregator EventAggregator, IDispatcherFacade DispatcherFacade, IHintProvider HintProvider) { _dispatcherFacade = DispatcherFacade; _hintProvider = HintProvider; DialogInteractionRequest = new InteractionRequest<RequestDialogInteractionContext<ExceptionDialogViewModel>>(); EventAggregator.GetEvent<HandledExceptionEvent>().Subscribe(OnExceptionHandled); }
public DispatcherRepositoryLoadControllerBase(INotifyRepository Repository, ICollection<FirmwarePackageViewModel> PackagesCollection, List<ComponentTarget> RequiredTargets, IDispatcherFacade Dispatcher, IFirmwarePackageViewModelKeyFormatter KeyFormatter, CancellationTokenSource CancellationTokenSource) { _repository = Repository; _packagesCollection = PackagesCollection; _requiredTargets = RequiredTargets; _dispatcher = Dispatcher; _keyFormatter = KeyFormatter; _cancellationTokenSource = CancellationTokenSource; }
/// <summary> /// Gets the <see cref="Dispatcher"/> that is bound to the UI elements. /// </summary> /// <value>The <see cref="Dispatcher"/> to use when subscribing using <see cref="ThreadOption.UIThread"/>.</value> private IDispatcherFacade GetUIDispatcher(SynchronizationContext synchronizationContext) { if (synchronizationContext == null) { throw new ArgumentNullException("synchronizationContext"); } if (uiDispatcher == null) { this.uiDispatcher = new DefaultDispatcher(synchronizationContext); } return(uiDispatcher); }
///<summary> /// Creates a new instance of <see cref="BackgroundEventSubscription{TPayload}"/>. ///</summary> ///<param name="actionReference">A reference to a delegate of type <see cref="System.Action{TPayload}"/>.</param> ///<param name="filterReference">A reference to a delegate of type <see cref="Predicate{TPayload}"/>.</param> ///<param name="dispatcher">The dispatcher to use when executing the <paramref name="actionReference"/> delegate.</param> ///<exception cref="ArgumentNullException">When <paramref name="actionReference"/> or <see paramref="filterReference"/> are <see langword="null" />.</exception> ///<exception cref="ArgumentException">When the target of <paramref name="actionReference"/> is not of type <see cref="System.Action{TPayload}"/>, ///or the target of <paramref name="filterReference"/> is not of type <see cref="Predicate{TPayload}"/>.</exception> public DispatcherEventSubscription(IDelegateReference actionReference, IDelegateReference filterReference, IDispatcherFacade dispatcher) : base(actionReference, filterReference) { this.dispatcher = dispatcher; }
public Operation(IEnumerable<Action> enumerable, IDispatcherFacade synchronizationContext) { this.enumerable = enumerable; this.facade = synchronizationContext; }
public AsyncManager(IDispatcherFacade context) { this.context = context; }
public DispatcherChannelSubscription(DelegateReference actionReference, DelegateReference filterReference, IDispatcherFacade dispatcher) : base(actionReference, filterReference) { _dispatcher = dispatcher; }
public FileRequestServiceViewModel(IDispatcherFacade Dispatcher) { _dispatcher = Dispatcher; SaveFileRequest = new InteractionRequest<SaveFileInteractionContext>(); }