コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MessageCenterWorkspaceViewModel"/> class.
        /// </summary>
        /// <param name="accessControlManager">The access control manager.</param>
        /// <param name="commandFactory">The command factory.</param>
        /// <param name="popupService">The popup service.</param>
        /// <param name="eventAggregator">The event aggregator.</param>
        /// <param name="dispatcherFactory">The dispatcher factory.</param>
        public MessageCenterWorkspaceViewModel(
            IAccessControlManager accessControlManager,
            ICommandFactory commandFactory,
            IPopupService popupService,
            IEventAggregator eventAggregator,
            IAsyncRequestDispatcherFactory dispatcherFactory
            )
            : base(accessControlManager, commandFactory)
        {
            _popupService      = popupService;
            _dispatcherFactory = dispatcherFactory;
            IncomingMail       = new ObservableCollection <DirectMailDto>();
            SentMail           = new ObservableCollection <DirectMailDto>();

            CommandFactoryHelper <MessageCenterWorkspaceViewModel> commandFactoryHelper = CommandFactoryHelper.CreateHelper(this, commandFactory);

            SendNewMailCommand = commandFactoryHelper.BuildDelegateCommand(() => SendNewMailCommand, ExecuteSendNewMail);
            OpenSaveToExternalPatientHistoryCommand =
                commandFactoryHelper.BuildDelegateCommand <string> (
                    () => OpenSaveToExternalPatientHistoryCommand, ExecuteOpenSaveToExternalPatientHistory);
            DownloadMailAttachmentCommand = commandFactoryHelper.BuildDelegateCommand <string>(
                () => DownloadMailAttachmentCommand, DownloadMailAttachment);
            DragQueryCommand = commandFactoryHelper.BuildDelegateCommand <DragDropQueryEventArgs>(() => DragQueryCommand, ExecuteDragQuery);

            eventAggregator.GetEvent <MessageSentEvent> ().Subscribe(HandleMessageSent);

            SetupImapFolderTimers();
            RequestInboxContent(null, null);
            RequestSentItemsContent(null, null);
        }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HealthProvidersDirectoryViewModel"/> class.
        /// </summary>
        /// <param name="accessControlManager">The access control manager.</param>
        /// <param name="commandFactory">The command factory.</param>
        /// <param name="popupService">The popup service.</param>
        /// <param name="eventAggregator">The event aggregator.</param>
        /// <param name="dispatcherFactory">The dispatcher factory.</param>
        public HealthProvidersDirectoryViewModel(
            IAccessControlManager accessControlManager,
            ICommandFactory commandFactory,
            IPopupService popupService,
            IEventAggregator eventAggregator,
            IAsyncRequestDispatcherFactory dispatcherFactory)
            : base(accessControlManager, commandFactory)
        {
            _popupService    = popupService;
            _eventAggregator = eventAggregator;

            // [Agatha] Dispatcher factory
            _dispatcherFactory = dispatcherFactory;

            // Using the Command Factory Helper, build all the commands used by this ViewModel.
            // This is required because the generated command(s) are [Castle] Dynamic Proxies, which run special logic (i.e.: Run Rule Engine Rules)
            // before the Execute Action is called. See Pillar.FluentRuleEngine.CheckRulesInterceptor for an example.
            CommandFactoryHelper <HealthProvidersDirectoryViewModel> commandFactoryHelper = CommandFactoryHelper.CreateHelper(this, commandFactory);

            // UI Commands
            DoneCommand = commandFactoryHelper.BuildDelegateCommand(() => DoneCommand, ExecuteDoneCommand);

            // Navigation Command

            // Event Aggregator Events Subscription

            Providers = new ObservableCollection <HealthProviderEntryDto>
            {
                new HealthProviderEntryDto
                {
                    FirstName        = "John",
                    LastName         = "Snow",
                    Mail             = "*****@*****.**",
                    OrganizationName = "IniTech",
                    Specialization   = "Cardiologist",
                    TelephoneNumber  = "(123)456-7890"
                }
            };

            Directories = new ObservableCollection <Tuple <string, string> >
            {
                new Tuple <string, string> ("EHRDoctors", "nhin.medibridge.net")
            };

            SelectedDirectory = Directories.First();
        }