public ExplorerTopBarViewModel(ExplorerSettingsContainer settings, ITypeFactory typeFactory, IUIVisualizerService uIVisualizerService, INuGetConfigurationService configurationService,
                                       INuGetCacheManager nuGetCacheManager, IPleaseWaitService pleaseWaitService, IMessageService messageService, IMessageMediator messageMediator)
        {
            Argument.IsNotNull(() => typeFactory);
            Argument.IsNotNull(() => uIVisualizerService);
            Argument.IsNotNull(() => configurationService);
            Argument.IsNotNull(() => settings);
            Argument.IsNotNull(() => nuGetCacheManager);
            Argument.IsNotNull(() => pleaseWaitService);
            Argument.IsNotNull(() => messageService);
            Argument.IsNotNull(() => messageMediator);

            _typeFactory          = typeFactory;
            _uIVisualizerService  = uIVisualizerService;
            _configurationService = configurationService;
            _nuGetCacheManager    = nuGetCacheManager;
            _pleaseWaitService    = pleaseWaitService;
            _messageService       = messageService;
            _messageMediator      = messageMediator;

            Settings = settings;

            Title = "Manage NuGet Packages";
            CommandInitialize();
        }
Ejemplo n.º 2
0
        public MessageCreation(IMessageMediator messageMediator)
        {
            InitializeComponent();

            MessageMediator = messageMediator;
            NameMessage     = new MessageModel();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EmployeesViewModel"/> class.
        /// </summary>
        public EmployeesViewModel(IMessageMediator messageMediator, IUIVisualizerService uiVisualizerService, IEmployeeRepository employeeRepository,
                                  IMessageService messageService)
            : base(messageMediator)
        {
            Argument.IsNotNull(() => uiVisualizerService);
            Argument.IsNotNull(() => employeeRepository);
            Argument.IsNotNull(() => messageService);

            _uiVisualizerService = uiVisualizerService;
            _employeeRepository  = employeeRepository;
            _messageService      = messageService;

            AddEmployee    = new Command(OnAddEmployeeExecute);
            EditEmployee   = new Command(OnEditEmployeeExecute, OnEditEmployeeCanExecute);
            DeleteEmployee = new Command(OnDeleteEmployeeExecute, OnDeleteEmployeeCanExecute);

            Employees = new FastObservableCollection <IEmployee>();
            if (!ObjectHelper.IsNull(SelectedDepartment))
            {
                Employees.AddRange(EmployeeRepository.GetAllEmployees(SelectedDepartment.Name));
            }

            if (Employees.Count > 0)
            {
                SelectedEmployee = Employees[0];
            }

            Mediator.Register <string>(this, OnSelectedDepartmentUpdated, "UpdateEmployees");
        }
Ejemplo n.º 4
0
        public DocumentViewModel(string path,
                                 IMessageService messageService,
                                 ISaveFileService saveFileService,
                                 IMessageMediator messageMediator)
        {
            this.messageService  = messageService;
            this.saveFileService = saveFileService;
            this.messageMediator = messageMediator;

            SaveCommand   = new TaskCommand(SaveAsync, () => HasChanges);
            SaveAsCommand = new TaskCommand(SaveFileAs);

            if (string.IsNullOrWhiteSpace(path))
            {
                Name       = "Document " + (++documentCounter) + ".txt";
                HasChanges = true;
            }
            else
            {
                fullFileName = path;
                Name         = Path.GetFileName(path);
                Text         = File.ReadAllText(path);
                HasChanges   = false;
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Unsubscribes all methods of the specified instance that are decorated with the <see cref="MessageRecipientAttribute"/>.
        /// </summary>
        /// <param name="instance">The instance.</param>
        /// <param name="messageMediator">The message mediator. If <c>null</c>, the default will be used.</param>
        /// <exception cref="ArgumentNullException">The <paramref name="instance"/> is <c>null</c>.</exception>
        public static void UnsubscribeRecipient(object instance, IMessageMediator messageMediator = null)
        {
            Argument.IsNotNull("instance", instance);

            var mediator = messageMediator ?? ServiceLocator.Default.ResolveType<IMessageMediator>();
            mediator.UnregisterRecipient(instance);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="EmployeesViewModel"/> class.
        /// </summary>
        public EmployeesViewModel(IMessageMediator messageMediator, IUIVisualizerService uiVisualizerService, IEmployeeRepository employeeRepository,
            IMessageService messageService)
            : base(messageMediator)
        {
            Argument.IsNotNull(() => uiVisualizerService);
            Argument.IsNotNull(() => employeeRepository);
            Argument.IsNotNull(() => messageService);

            _uiVisualizerService = uiVisualizerService;
            _employeeRepository = employeeRepository;
            _messageService = messageService;

            AddEmployee = new Command(OnAddEmployeeExecute);
            EditEmployee = new Command(OnEditEmployeeExecute, OnEditEmployeeCanExecute);
            DeleteEmployee = new Command(OnDeleteEmployeeExecute, OnDeleteEmployeeCanExecute);

            Employees = new FastObservableCollection<IEmployee>();
            if (!ObjectHelper.IsNull(SelectedDepartment))
            {
                Employees.AddRange(EmployeeRepository.GetAllEmployees(SelectedDepartment.Name));
            }

            if (Employees.Count > 0)
            {
                SelectedEmployee = Employees[0];
            }

            Mediator.Register<string>(this, OnSelectedDepartmentUpdated, "UpdateEmployees");
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Can be used to set the message mediator instance; this is useful to replace
 /// the built-in system service.
 /// </summary>
 /// <param name="mediator">Mediator to use.</param>
 public static void SetMessageMediator(IMessageMediator mediator)
 {
     if (instance != null)
     {
         throw new InvalidOperationException("Can only set the MessageMediator once.");
     }
     instance = mediator;
 }
Ejemplo n.º 8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DocumentMapViewModel"/> class.
        /// </summary>
        public DocumentMapViewModel(string Regex)
        {
            RegexContent = Regex;

            SaveRegex = new Command(OnSaveRegexExecute);

            _messageMediator = Catel.IoC.ServiceLocator.Default.ResolveType <IMessageMediator>();
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Unsubscribes all methods of the specified instance that are decorated with the <see cref="MessageRecipientAttribute"/>.
        /// </summary>
        /// <param name="instance">The instance.</param>
        /// <param name="messageMediator">The message mediator. If <c>null</c>, the default will be used.</param>
        /// <exception cref="ArgumentNullException">The <paramref name="instance"/> is <c>null</c>.</exception>
        public static void UnsubscribeRecipient(object instance, IMessageMediator messageMediator = null)
        {
            Argument.IsNotNull("instance", instance);

            var mediator = messageMediator ?? ServiceLocator.Default.ResolveType <IMessageMediator>();

            mediator.UnregisterRecipient(instance);
        }
Ejemplo n.º 10
0
 public BrowserDocumentViewModel(IMessageMediator messageMediator)
 {
     _MessageMediator = messageMediator;
     Url       = "http://www.metaseed.com";
     GoBack    = new Command(OnGoBackExecute, OnGoBackCanExecute);
     GoForward = new Command(OnGoForwardExecute, OnGoForwardCanExecute);
     Browse    = new Command(OnBrowseExecute, OnBrowseCanExecute);
 }
Ejemplo n.º 11
0
        /// <summary>Initializes a new instance of the <see cref="BrowserViewModel" /> class.</summary>
        /// <param name="mediator">The mediator.</param>
        public BrowserViewModel(IMessageMediator mediator)
        {
            _browserQueryViewerViewModel =
                TypeFactory.Default.CreateInstance <BrowserQueryViewerViewModel>();

            CurrentModel = _browserQueryViewerViewModel;

            mediator.Register <SimpleMessage>(this, OnMessageReceived);
        }
Ejemplo n.º 12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DataGridViewModel"/> class.
 /// </summary>
 /// <param name="title">The title.</param>
 /// <param name="openFileService">The open file service.</param>
 /// <param name="saveFileService">The save file service.</param>
 /// <param name="uiVisualizerService">The UI visualizer service.</param>
 /// <param name="messageMediator">The message mediator.</param>
 public DataGridViewModel(string title, IOpenFileService openFileService, ISaveFileService saveFileService, IUIVisualizerService uiVisualizerService,
                          IMessageMediator messageMediator, IContextualViewModelManager contextualViewModelManager)
     : this(openFileService, saveFileService, uiVisualizerService, messageMediator, contextualViewModelManager)
 {
     if (!string.IsNullOrWhiteSpace(title))
     {
         Title = title;
     }
 }
Ejemplo n.º 13
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EmployeeViewModel" /> class.
        /// </summary>
        /// <param name="employee">The employee.</param>
        /// <param name="messageMediator">The message mediator.</param>
        /// <param name="departmentRepository">The department repository.</param>
        /// <exception cref="ArgumentNullException">The <paramref name="employee" /> is <c>null</c>.</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="messageMediator" /> is <c>null</c>.</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="departmentRepository" /> is <c>null</c>.</exception>
        public EmployeeViewModel(IEmployee employee, IMessageMediator messageMediator, IDepartmentRepository departmentRepository)
            : base(messageMediator)
        {
            Argument.IsNotNull(() => employee);
            Argument.IsNotNull(() => messageMediator);

            Employee = employee;

            AvailableDepartments = new FastObservableCollection <IDepartment>(departmentRepository.GetAllDepartments());
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="EmployeeViewModel" /> class.
        /// </summary>
        /// <param name="employee">The employee.</param>
        /// <param name="messageMediator">The message mediator.</param>
        /// <param name="departmentRepository">The department repository.</param>
        /// <exception cref="ArgumentNullException">The <paramref name="employee" /> is <c>null</c>.</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="messageMediator" /> is <c>null</c>.</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="departmentRepository" /> is <c>null</c>.</exception>
        public EmployeeViewModel(IEmployee employee, IMessageMediator messageMediator, IDepartmentRepository departmentRepository)
            : base(messageMediator)
        {
            Argument.IsNotNull(() => employee);
            Argument.IsNotNull(() => messageMediator);

            Employee = employee;

            AvailableDepartments = new FastObservableCollection<IDepartment>(departmentRepository.GetAllDepartments());
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:System.Object"/> class.
        /// </summary>
        static MessageBase()
        {
            var serviceLocator = ServiceLocator.Default;

            if (!serviceLocator.IsTypeRegistered <IMessageMediator>())
            {
                serviceLocator.RegisterInstance <IMessageMediator>(MessageMediator.Default);
            }

            _mediator = ServiceLocator.Default.ResolveType <IMessageMediator>();
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:System.Object"/> class.
        /// </summary>
        static MessageBase()
        {
            var serviceLocator = IoCConfiguration.DefaultServiceLocator;

            if (!serviceLocator.IsTypeRegistered <IMessageMediator>())
            {
                serviceLocator.RegisterInstance(MessageMediator.Default);
            }

            _mediator = serviceLocator.ResolveType <IMessageMediator>();
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Unsubscribes all methods of the specified instance that are decorated with the <see cref="MessageRecipientAttribute"/>.
        /// </summary>
        /// <param name="instance">The instance.</param>
        /// <param name="messageMediator">The message mediator. If <c>null</c>, the default will be used.</param>
        /// <exception cref="ArgumentNullException">The <paramref name="instance"/> is <c>null</c>.</exception>
        public static void UnsubscribeRecipient(object instance, IMessageMediator messageMediator = null)
        {
            Argument.IsNotNull("instance", instance);

            if (messageMediator == null)
            {
                var dependencyResolver = IoCConfiguration.DefaultDependencyResolver;
                messageMediator = dependencyResolver.Resolve <IMessageMediator>();
            }

            messageMediator.UnregisterRecipient(instance);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="DepartmentsViewModel"/> class. 
        /// </summary>
        public DepartmentsViewModel(IMessageMediator messageMediator, IDepartmentRepository departmentRepository, IUIVisualizerService uiVisualizerService)
            : base(messageMediator)
        {
            _uiVisualizerService = uiVisualizerService;

            Departments = new FastObservableCollection<IDepartment>(departmentRepository.GetAllDepartments());
            if (Departments.Count > 0)
            {
                SelectedDepartment = Departments[0];
            }

            Select = new Command(OnSelectExecute);
        }
Ejemplo n.º 19
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DepartmentsViewModel"/> class.
        /// </summary>
        public DepartmentsViewModel(IMessageMediator messageMediator, IDepartmentRepository departmentRepository, IUIVisualizerService uiVisualizerService)
            : base(messageMediator)
        {
            _uiVisualizerService = uiVisualizerService;

            Departments = new FastObservableCollection <IDepartment>(departmentRepository.GetAllDepartments());
            if (Departments.Count > 0)
            {
                SelectedDepartment = Departments[0];
            }

            Select = new Command(OnSelectExecute);
        }
Ejemplo n.º 20
0
        public DataGridViewModel(IOpenFileService openFileService, ISaveFileService saveFileService, IUIVisualizerService uiVisualizerService,
                                 IMessageMediator messageMediator)
        {
            Argument.IsNotNull(() => openFileService);
            Argument.IsNotNull(() => saveFileService);
            Argument.IsNotNull(() => uiVisualizerService);
            Argument.IsNotNull(() => messageMediator);

            _openFileService     = openFileService;
            _saveFileService     = saveFileService;
            _uiVisualizerService = uiVisualizerService;
            _messageMediator     = messageMediator;
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Subscribes all methods of the specified instance that are decorated with the <see cref="MessageRecipientAttribute"/>.
        /// </summary>
        /// <param name="instance">The instance to subscribe.</param>
        /// <param name="messageMediator">The message mediator. If <c>null</c>, the default will be used.</param>
        /// <exception cref="ArgumentNullException">The <paramref name="instance"/> is <c>null</c>.</exception>
        /// <exception cref="NotSupportedException">The object has non-public methods decorated with the <see cref="MessageRecipientAttribute"/>, but the
        /// application is not written in .NET (but in Silverlight, Windows Phone or WinRT).</exception>
        /// <exception cref="InvalidCastException">One of the methods cannot be casted to a valid message method.</exception>
        public static void SubscribeRecipient(object instance, IMessageMediator messageMediator = null)
        {
            Argument.IsNotNull("instance", instance);

            if (messageMediator == null)
            {
                var dependencyResolver = IoCConfiguration.DefaultDependencyResolver;
                messageMediator = dependencyResolver.Resolve<IMessageMediator>();
            }

            var mediator = messageMediator;
            var methodInfos = instance.GetType().GetMethodsEx(BindingFlagsHelper.GetFinalBindingFlags(true, false));

            foreach (var methodInfo in methodInfos)
            {
                var customAttributes = methodInfo.GetCustomAttributesEx(typeof(MessageRecipientAttribute), true);

                foreach (var customAttribute in customAttributes)
                {
                    var attribute = (MessageRecipientAttribute)customAttribute;
                    var parameterInfos = methodInfo.GetParameters();

                    Type actionType;
                    Type actionParameterType;

                    switch (parameterInfos.Length)
                    {
                        case 0:
                            actionType = typeof(Action<object>);
                            actionParameterType = typeof(object);
                            break;

                        case 1:
                            actionType = typeof(Action<>).MakeGenericType(parameterInfos[0].ParameterType);
                            actionParameterType = parameterInfos[0].ParameterType;
                            break;

                        default:
                            var error = string.Format("Cannot cast '{0}' to Action or Action<T> delegate type.", methodInfo.Name);
                            Log.Error(error);
                            throw new InvalidCastException(error);
                    }

                    var tag = attribute.Tag;
                    var action = DelegateHelper.CreateDelegate(actionType, instance, methodInfo);

                    var registerMethod = mediator.GetType().GetMethodEx("Register").MakeGenericMethod(actionParameterType);
                    registerMethod.Invoke(mediator, new[] { instance, action, tag });
                }
            }
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Subscribes all methods of the specified instance that are decorated with the <see cref="MessageRecipientAttribute"/>.
        /// </summary>
        /// <param name="instance">The instance to subscribe.</param>
        /// <param name="messageMediator">The message mediator. If <c>null</c>, the default will be used.</param>
        /// <exception cref="ArgumentNullException">The <paramref name="instance"/> is <c>null</c>.</exception>
        /// <exception cref="NotSupportedException">The object has non-public methods decorated with the <see cref="MessageRecipientAttribute"/>, but the
        /// application is not written in .NET (but in SL, WP7 or WinRT).</exception>
        /// <exception cref="InvalidCastException">One of the methods cannot be casted to a valid message method.</exception>
        public static void SubscribeRecipient(object instance, IMessageMediator messageMediator = null)
        {
            Argument.IsNotNull("instance", instance);

            if (messageMediator == null)
            {
                var dependencyResolver = IoCConfiguration.DefaultDependencyResolver;
                messageMediator = dependencyResolver.Resolve <IMessageMediator>();
            }

            var mediator    = messageMediator;
            var methodInfos = instance.GetType().GetMethodsEx(BindingFlagsHelper.GetFinalBindingFlags(true, false));

            foreach (var methodInfo in methodInfos)
            {
                var customAttributes = methodInfo.GetCustomAttributesEx(typeof(MessageRecipientAttribute), true);

                foreach (var customAttribute in customAttributes)
                {
                    var attribute      = (MessageRecipientAttribute)customAttribute;
                    var parameterInfos = methodInfo.GetParameters();

                    Type actionType;
                    Type actionParameterType;

                    switch (parameterInfos.Length)
                    {
                    case 0:
                        actionType          = typeof(Action <object>);
                        actionParameterType = typeof(object);
                        break;

                    case 1:
                        actionType          = typeof(Action <>).MakeGenericType(parameterInfos[0].ParameterType);
                        actionParameterType = parameterInfos[0].ParameterType;
                        break;

                    default:
                        var error = string.Format("Cannot cast '{0}' to Action or Action<T> delegate type.", methodInfo.Name);
                        Log.Error(error);
                        throw new InvalidCastException(error);
                    }

                    var tag    = attribute.Tag;
                    var action = DelegateHelper.CreateDelegate(actionType, instance, methodInfo);

                    var registerMethod = mediator.GetType().GetMethodEx("Register").MakeGenericMethod(actionParameterType);
                    registerMethod.Invoke(mediator, new[] { instance, action, tag });
                }
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="PropertiesViewModel"/> class.
        /// </summary>
        public PropertiesViewModel(IMessageService messageService, IOrchestraService orchestraService, IMessageMediator messageMediator, IContextualViewModelManager contextualViewModelManager)
        {
            Argument.IsNotNull(() => orchestraService);
            Argument.IsNotNull(() => orchestraService);
            Argument.IsNotNull(() => messageMediator);

            _messageService   = messageService;
            _orchestraService = orchestraService;
            _messageMediator  = messageMediator;

            Title = "Properties";

            // Comands
            DocMapSelectedCommand = new Command(OnDocMapSelectedCommandExecute, OnDocMapSelectedCommandCanExecute);
        }
Ejemplo n.º 24
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HomeWindowViewModel"/> class.
 /// </summary>
 public HomeWindowViewModel(IUpdateMessagesListTask updateMessagesListTask, IMessageMediator mediator, IPleaseWaitService pleaseWaitService, IFolderWatcher folderWatcher, ITryFindParent tryFindParent, IOpenEmailFile openEmailFile)
 {
     this.updateMessagesListTask = updateMessagesListTask;
     this.mediator          = mediator;
     this.pleaseWaitService = pleaseWaitService;
     this.folderWatcher     = folderWatcher;
     this.tryFindParent     = tryFindParent;
     this.openEmailFile     = openEmailFile;
     RowDoubleClick         = new Command <MouseButtonEventArgs>(OnRowDoubleClickExecute, OnRowDoubleClickCanExecute);
     CheckMessagesCommand   = new AsynchronousCommand(OnCheckMessagesCommandExecute, () => !CheckMessagesCommand.IsExecuting);
     MarkAsReadCommand      = new Command <MessageModel>(OnMarkAsReadCommandExecute);
     ImageSingleClick       = new Command <MessageModel>(OnImageSingleClickExecute);
     Messages = new InitialLoadCommand().Load();
     CheckMessagesWithWaiting();
 }
Ejemplo n.º 25
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BrowserViewModel" /> class.
        /// </summary>
        /// <param name="messageService">The message service.</param>
        /// <param name="orchestraService">The orchestra service.</param>
        /// <param name="messageMediator">The message mediator.</param>
        public BrowserViewModel(IMessageService messageService, IOrchestraService orchestraService, IMessageMediator messageMediator)
        {
            Argument.IsNotNull(() => orchestraService);
            Argument.IsNotNull(() => orchestraService);
            Argument.IsNotNull(() => messageMediator);

            _messageService   = messageService;
            _orchestraService = orchestraService;
            _messageMediator  = messageMediator;

            GoBack       = new Command(OnGoBackExecute, OnGoBackCanExecute);
            GoForward    = new Command(OnGoForwardExecute, OnGoForwardCanExecute);
            Browse       = new Command(OnBrowseExecute, OnBrowseCanExecute);
            Test         = new Command(OnTestExecute);
            CloseBrowser = new Command(OnCloseBrowserExecute);

            Title = "Browser";
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="NotificationBarViewModel"/> class.
        /// </summary>
        public NotificationBarViewModel(IMessageMediator messageMediator)
            : base(messageMediator)
        {
            MessageMediator.Register <string>(this, data =>
            {
                if (ObjectHelper.IsNull(data))
                {
                    return;
                }

                try
                {
                    EventMessage = data;
                }
                catch
                {
                }
            }, "UpdateNotification");
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="NotificationBarViewModel"/> class.
        /// </summary>
        public NotificationBarViewModel(IMessageMediator messageMediator)
            : base(messageMediator)
        {
            MessageMediator.Register<string>(this, data =>
            {
                if (ObjectHelper.IsNull(data))
                {
                    return;
                }

                try
                {
                    EventMessage = data;
                }
                catch
                {
                }
            }, "UpdateNotification");
        }
Ejemplo n.º 28
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DataGridViewModel"/> class.
        /// </summary>
        /// <param name="openFileService">The open file service.</param>
        /// <param name="saveFileService">The save file service.</param>
        /// <param name="uiVisualizerService">The UI visualizer service.</param>
        /// <param name="messageMediator">The message mediator.</param>
        public DataGridViewModel(IOpenFileService openFileService, ISaveFileService saveFileService, IUIVisualizerService uiVisualizerService,
                                 IMessageMediator messageMediator, IContextualViewModelManager contextualViewModelManager)
        {
            Argument.IsNotNull(() => openFileService);
            Argument.IsNotNull(() => saveFileService);
            Argument.IsNotNull(() => uiVisualizerService);
            Argument.IsNotNull(() => messageMediator);
            Argument.IsNotNull(() => contextualViewModelManager);

            _openFileService            = openFileService;
            _saveFileService            = saveFileService;
            _uiVisualizerService        = uiVisualizerService;
            _messageMediator            = messageMediator;
            _contextualViewModelManager = contextualViewModelManager;

            Items.CollectionChanged += ItemsCollectionChanged;

            Title = "Datagrid";
        }
Ejemplo n.º 29
0
 public QueryMediator(IMessageMediator messageMediator)
 {
     _messageMediator = messageMediator;
 }
Ejemplo n.º 30
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BrowserViewModel" /> class.
 /// </summary>
 /// <param name="title">The title.</param>
 /// <param name="messageService">The message service.</param>
 /// <param name="orchestraService">The orchestra service.</param>
 /// <param name="messageMediator">The message mediator.</param>
 public BrowserViewModel(string title, IMessageService messageService, IOrchestraService orchestraService, IMessageMediator messageMediator)
     : this(messageService, orchestraService, messageMediator)
 {
     if (!string.IsNullOrWhiteSpace(title))
     {
         Title = title;
     }
 }
Ejemplo n.º 31
0
        protected ViewModelBase(IMessageMediator messageMediator)
        {
            Argument.IsNotNull(() => messageMediator);

            MessageMediator = messageMediator;
        }
Ejemplo n.º 32
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Catel.Modules.ModuleBase`1" /> class.
 /// </summary>
 /// <param name="messageMediator">The message mediator.</param>
 public OxyPlotModule(IMessageMediator messageMediator)
     : base(Name)
 {
     messageMediator.Register(this, new Action <Tuple <ObservableCollection <int>, ObservableCollection <int> > >(OnPlot));
 }
Ejemplo n.º 33
0
 public void UnsubscribeViaMessageMediatorHelper(IMessageMediator messageMediator)
 {
     MessageMediatorHelper.UnsubscribeRecipient(this, messageMediator);
 }
Ejemplo n.º 34
0
 public bool SendMessage(IMessageMediator messageMediator, string message)
 {
     return(SendMessage(messageMediator, message, null));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ShellViewModel"/> class.
 /// </summary>
 public ShellViewModel(IMessageMediator messageMediator)
     : base(messageMediator)
 {
 }
Ejemplo n.º 36
0
        /// <summary>
        /// Unsubscribes all methods of the specified instance that are decorated with the <see cref="MessageRecipientAttribute"/>.
        /// </summary>
        /// <param name="instance">The instance.</param>
        /// <param name="messageMediator">The message mediator. If <c>null</c>, the default will be used.</param>
        /// <exception cref="ArgumentNullException">The <paramref name="instance"/> is <c>null</c>.</exception>
        public static void UnsubscribeRecipient(object instance, IMessageMediator messageMediator = null)
        {
            Argument.IsNotNull("instance", instance);

            if (messageMediator == null)
            {
                var dependencyResolver = IoCConfiguration.DefaultDependencyResolver;
                messageMediator = dependencyResolver.Resolve<IMessageMediator>();
            }

            messageMediator.UnregisterRecipient(instance);
        }
 public MessageMediatorBViewModel(IMessageMediator messageMediator)
 {
     _messageMediator = messageMediator;
 }
Ejemplo n.º 38
0
 public bool SendMessage(IMessageMediator messageMediator, string message)
 {
     return SendMessage(messageMediator, message, null);
 }
Ejemplo n.º 39
0
 public ClassWithSeveralMatchesForDependencyInjection(IMessageMediator messageMediator, IMessageService messageService)
 {
     IsRightConstructorUsed = true;
 }
Ejemplo n.º 40
0
 public bool SendMessage(IMessageMediator messageMediator, string message, object tag)
 {
     return messageMediator.SendMessage(message, tag);
 }
Ejemplo n.º 41
0
 public bool SendMessage(IMessageMediator messageMediator, string message, object tag)
 {
     return(messageMediator.SendMessage(message, tag));
 }
Ejemplo n.º 42
0
 public void UnsubscribeViaMessageMediatorHelper(IMessageMediator messageMediator)
 {
     MessageMediatorHelper.UnsubscribeRecipient(this, messageMediator);
 }
Ejemplo n.º 43
0
 public ClassWithSeveralMatchesForDependencyInjection(IMessageMediator messageMediator, IMessageService messageService)
 {
     IsRightConstructorUsed = true;
 }
Ejemplo n.º 44
0
 public CommandMediator(IMessageMediator messageMediator)
 {
     _messageMediator = messageMediator;
 }