/// <summary> /// Loads and shows the view then returns results. /// </summary> /// <typeparam name="TParam">Type of parameter passed into view's constructor</typeparam> /// <typeparam name="TResults">Type of results returned</typeparam> /// <param name="viewName">Name of view to look up</param> /// <param name="context">The value of the parameter to pass to the view's constructor</param> /// <param name="showDialog">Show dialog when value true otherwise hide dialog</param> /// <returns></returns> private TResults InvokeInteraction <TParam, TResults>(string viewName, TParam context, bool showDialog) where TParam : Microsoft.Practices.Prism.Interactivity.InteractionRequest.Notification where TResults : class, new() { IInteractionView view = null; using (CompositionContainer container = new CompositionContainer(catalog)) { // Add context to container for satisfying ImportingConstructor container.ComposeExportedValue <TParam>(context); // Load the view. If no or more than one view satisfying the condition is found, throws InvalidOperationException view = container.GetExportedValues <IInteractionView>(viewName).First(); // Args to create the form are currently passed to single param ctor. If default ctor is used (without params) uncomment following line: // view.Initialize(e.Context); // Show form System.Windows.Forms.Form form = (System.Windows.Forms.Form)view; if (showDialog) { this.Application.ApplicationFramework.POSShowForm(form); } // Get results return(view.GetResults <TResults>()); } }
/// <summary> /// Creates an instance of <see cref="AboutInteractionProvider" /> /// </summary> /// <param name="container"> /// An instance of <see cref="IIoCContainer" /> that represents the system specific IoC container /// </param> public AboutInteractionProvider(IIoCContainer container) { Guard.AgainstNullReference(container, "container"); this._interactionView = container.Resolve <IInteractionView>(ApplicationGlobalNames.ABOUT_VIEW_NAME); this._viewModel = container.Resolve <IAboutInteractionViewModel>(); }
/// <summary> /// Creates an instance of <see cref="PasswordInteractionProvider" /> /// </summary> /// <param name="container"> /// An instance of <see cref="IIoCContainer" /> that represents the system specific IoC container /// </param> public PasswordInteractionProvider(IIoCContainer container) { Guard.AgainstNullReference(container, "container"); this._interactionView = container.Resolve <IInteractionView>(ApplicationGlobalNames.PASSWORD_VIEW_NAME); this._viewModel = container.Resolve <IPasswordInteractionViewModel>(); }
/// <summary> /// Creates an instance of <see cref="CreateNewDeviceProvider" /> /// </summary> /// <param name="container"> /// An instance of <see cref="IIoCContainer" /> to use /// </param> public CreateNewDeviceProvider(IIoCContainer container) { Guard.AgainstNullReference(container, "container"); this._interactionView = container.Resolve <IInteractionView>(ApplicationGlobalNames.CREATE_NEW_DEVICE_VIEW_NAME); this._viewModel = container.Resolve <IModifyDeviceViewModel>(); }
/// <summary> /// Creates an instance of <see cref="BusyInteractionProvider" /> /// </summary> /// <param name="container"> /// An instance of <see cref="IIoCContainer" /> that represents the system specific IoC container /// </param> public ExtraSettingsInteractionProvider(IIoCContainer container) { Guard.AgainstNullReference(container, "container"); this._interactionView = container.Resolve <IInteractionView>(ApplicationGlobalNames.EXTRASETTINGS_INTERACTION_VIEW_NAME); this._viewModel = container.Resolve <IExtraSettingsViewModel>(); }
/// <summary> /// Creates an instance of <see cref="BusyInteractionProvider" /> /// </summary> /// <param name="container"> /// An instance of <see cref="IIoCContainer" /> that represents the system specific IoC container /// </param> public BusyInteractionProvider(IIoCContainer container) { Guard.AgainstNullReference(container, "container"); this._interactionView = container.Resolve <IInteractionView>(ApplicationGlobalNames.BUSY_INTERACTION_VIEW_NAME); this._viewModel = container.Resolve <IBusyInteractionViewModel>(); }
/// <summary> /// Creates an instance of <see cref="WarningMessageBoxInteractionProvider" /> /// </summary> /// <param name="container"> /// An instance of <see cref="IIoCContainer" /> that represents the system specific IoC container /// </param> public WarningMessageBoxInteractionProvider(IIoCContainer container) { Guard.AgainstNullReference(container, "container"); this._interactionView = container.Resolve <IInteractionView>(ApplicationGlobalNames.WARNING_MESSAGEBOX_VIEW_NAME); this._viewModel = container.Resolve <IWarningMessageBoxInteractionViewModel>(); }
/// <summary> /// Creates an instance of <see cref="CommandOnTemplatesInteractionProvider" /> /// </summary> /// <param name="container"> /// An instance of <see cref="IIoCContainer" /> that represents the system specific IoC container /// </param> public CommandOnTemplatesInteractionProvider(IIoCContainer container) { Guard.AgainstNullReference(container, "container"); this._interactionView = container.Resolve <IInteractionView>(ApplicationGlobalNames.COMMAND_ON_TEMPLATES_VIEW_NAME); this._viewModel = container.Resolve <ICommandOnTemplateInteractionViewModel>(); }
/// <summary> /// Creates an instance of <see cref="SynchronizationTimeInteractionProvider" /> /// </summary> /// <param name="container"> /// An instance of <see cref="IIoCContainer" /> that represents the system specific IoC container /// </param> public SynchronizationTimeInteractionProvider(IIoCContainer container) { Guard.AgainstNullReference(container, "container"); this._interactionView = container.Resolve <IInteractionView>(ApplicationGlobalNames.SYNCHRONIZATION_TIME_VIEW_NAME); this._viewModel = container.Resolve <ISynchronizationTimeInteractionViewModel>(); }
/// <summary> /// Creates an instance of <see cref="CitywideCommandsInteractionProvider" /> /// </summary> /// <param name="container"> /// An instance of <see cref="IIoCContainer" /> that represents the system specific IoC container /// </param> public CitywideCommandsInteractionProvider(IIoCContainer container) { Guard.AgainstNullReference(container, "container"); this._interactionView = container.Resolve <IInteractionView>(ApplicationGlobalNames.CITYWIDE_COMMANDS_VIEW_NAME); this._viewModel = container.Resolve <ICitywideCommandsInteractionViewModel>(); }
/// <summary> /// Creates an instance of <see cref="InformationMessageBoxInteractionProvider" /> /// </summary> /// <param name="container"> /// An instance of <see cref="IIoCContainer" /> that represents the system specific IoC container /// </param> public InformationMessageBoxInteractionProvider(IIoCContainer container) { Guard.AgainstNullReference(container, "container"); this._interactionView = container.Resolve <IInteractionView>(ApplicationGlobalNames.INFORMATION_MESSAGEBOX_VIEW_NAME); this._viewModel = container.Resolve <IInformationMessageBoxInteractionViewModel>(); }
/// <summary> /// Creates an instance of <see cref="InteractionContext" /> from <see cref="InteractionRequestEventArgs" /> /// —оздет контекст <see cref="InteractionContext" /> дл¤ запроса <see cref="InteractionRequestEventArgs" /> /// </summary> /// <param name="args">An instance of <see cref="InteractionRequestEventArgs" /> to convert from</param> /// <returns>Created instance of <see cref="InteractionContext" /></returns> public static InteractionContext FromArguemnts(InteractionRequestEventArgs args) { IInteractionView view = args.InteractionProvider.InteractionView; IInteractionViewModel viewModel = args.InteractionProvider.InteractionViewModel; view.DataContext = viewModel; return(new InteractionContext { Invoker = args.InterceptorsInvoker, Callback = args.Callback, ViewModel = viewModel, View = view }); }