本文整理汇总了C#中IMessenger类的典型用法代码示例。如果您正苦于以下问题:C# IMessenger类的具体用法?C# IMessenger怎么用?C# IMessenger使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IMessenger类属于命名空间,在下文中一共展示了IMessenger类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProductPreviewViewModel
public ProductPreviewViewModel(IMessenger messenger, IBasketModel basketModel)
{
// Design setup
if (this.IsInDesignMode)
{
Visible = true;
Product = new Product()
{
ProductId=12345,
Name = "Product Name",
Description = "Product Description",
UpdatedDate = DateTime.Today,
};
}
// Unpack
MessengerInstance = messenger;
_basketModel = basketModel;
// Register Message Handlers
MessengerInstance.Register<ProductPreviewMessage>(this, HandleProductPreview);
// Commands
CloseCommand = new RelayCommand(CloseExecute);
AddProductCommand = new RelayCommand(AddProductExecute);
}
示例2: FileListingController
public FileListingController(FileListingViewModel ViewModel, MainMenuViewModel MenuViewModel, IMessenger Messenger, IMapper Mapper, IUpkFileRepository Repository, IUpkFileRemoteRepository RemoteRepository) {
viewModel = ViewModel;
menuViewModel = MenuViewModel;
messenger = Messenger;
mapper = Mapper;
repository = Repository;
remoteRepository = RemoteRepository;
viewModel.Files = new ObservableCollection<FileViewEntity>();
viewModel.FilterText = String.Empty;
viewModel.PropertyChanged += onViewModelPropertyChanged;
menuViewModel.PropertyChanged += onMenuViewModelPropertyChanged;
allFiles = new List<DomainUpkFile>();
allFileEntities = new List<FileViewEntity>();
registerMessages();
registerCommands();
}
示例3: ProjectPanelViewModel
public ProjectPanelViewModel(ITrackerService svc, IMessenger mess)
{
_Messenger = mess;
_Service = svc;
Project = new ProjectViewModel();
}
示例4: MainPageViewModel
/// <summary>
/// Initializes a new instance of the <see cref="MainPageViewModel"/> class.
/// </summary>
/// <param name="messenger">
/// The messenger.
/// </param>
/// <param name="navigationService">
/// The navigation service.
/// </param>
public MainPageViewModel(IMessenger messenger, NavigationService navigationService)
: base(messenger, navigationService)
{
this.InitializeMenu();
this.ItemInvokedCommand = new RelayCommand<ListViewItem>(this.ItemInvoked);
}
示例5: MessageController
public MessageController(IMessageService iMessageService, IUserInfo iUserInfo, IUnitOfWork unitOfWork, IMessenger iMessenger)
{
_iMessageService = iMessageService;
_iUserInfo = iUserInfo;
_unitOfWork = unitOfWork;
_iMessenger = iMessenger;
}
示例6: MainViewModel
public MainViewModel(IViewModelNavigator navigator, IMessenger messenger)
{
messenger.Register<ContentChangedMessage>(this, OnContentChanged);
_messenger = messenger;
_navigator = navigator;
_navigator.NavigateForward<WelcomViewModel>(null);
}
示例7: UserPasswordReset
public static UserPassword UserPasswordReset(string name, out string password, IMessenger messenger)
{
var user = UserPassword.FetchUserPassword(
new UserPasswordCriteria
{
Name = name
});
if (user != null)
{
password = PasswordHelper.GetRandomPassword(10);
user.SetPassword(password);
user = user.Save();
if (messenger == null)
{
messenger = MessageHelper.InitializeMessageForUserPasswordReset(user.Email);
}
messenger.Message = messenger.Message.Replace(MessageParameter.Password, password);
messenger.Send();
}
else
{
throw new ArgumentException("No such user exists.");
}
return user;
}
示例8: ViewModelBaseEx
protected ViewModelBaseEx( IViewServiceRepository viewServices = null, ISettingsRepository settingsRepo = null, IMessenger messenger = null )
{
MessengerInstance = messenger;
ViewServices = viewServices ?? App.ViewServices;
Session = App.Session;
Settings = settingsRepo ?? App.Settings;
}
示例9: LoginViewModel
public LoginViewModel(IMessenger messenger, ILoginService loginService)
{
_messenger = messenger;
_loginService = loginService;
LoginCommand = new RelayCommand<object>(Login);
}
示例10: UpkManagerController
public UpkManagerController(UpkManagerViewModel ViewModel, MainMenuViewModel MenuViewModel, IMessenger Messenger, ISettingsRepository SettingsRepository, IExceptionRepository ExceptionRepository, IMapper Mapper) {
if (Application.Current != null) Application.Current.DispatcherUnhandledException += onCurrentDispatcherUnhandledException;
AppDomain.CurrentDomain.UnhandledException += onDomainUnhandledException;
Dispatcher.CurrentDispatcher.UnhandledException += onCurrentDispatcherUnhandledException;
TaskScheduler.UnobservedTaskException += onUnobservedTaskException;
System.Windows.Forms.Application.ThreadException += onThreadException;
viewModel = ViewModel;
menuViewModel = MenuViewModel;
messenger = Messenger;
settingsRepository = SettingsRepository;
exceptionRepository = ExceptionRepository;
mapper = Mapper;
settings = Task.Run(() => settingsRepository.LoadSettingsAsync()).Result;
viewModel.Settings = mapper.Map<SettingsWindowViewEntity>(settings);
registerMessages();
registerCommands();
}
示例11: Consolery
public Consolery(Type targetType, object target, string[] args, IMessenger messenger, Notation notationType)
{
Contract.Requires(targetType != null);
Contract.Requires(args != null);
Contract.Requires(messenger != null);
_target = target;
_targetType = targetType;
_args = args;
_messenger = messenger;
_actionMethods = _targetType
.GetMethods(BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance)
.Where(method => method.GetCustomAttributes(false).OfType<ActionAttribute>().Any())
.ToList();
_metadata = new Metadata(_actionMethods);
_metadataValidator = new MetadataValidator(_targetType, _actionMethods, _metadata);
if (notationType == Notation.Windows)
{
_notation = new WindowsNotationStrategy(_args, _messenger, _metadata, _targetType, _actionMethods);
}
else
{
_notation = new LinuxNotationStrategy(_args, _messenger, _metadata);
}
}
示例12: CommonWindow
public CommonWindow(IMessenger messenger)
{
_messenger = messenger;
_messenger.Register<CloseViewMessage>(this, Close);
InitializeComponent();
}
示例13: ChangePasswordView
public ChangePasswordView(IMessenger messenger)
{
InitializeComponent();
_messenger = messenger;
_messenger.Register<PasswordChangeMsg>(this, OnPasswordChangeMsgMessage);
}
示例14: Init
public void Init()
{
var messengerMock = new Mock<IMessenger>();
var serviceMock = new Mock<ITrackerService>();
_Messenger = messengerMock.Object;
_MockPriorityList = new List<string>() { "High", "Low" };
_MockStatusList = new List<string>() { "In Progress", "Closed" };
_MockActiveProject = new ProjectViewModel(new Project { Id = 1, Code = "GGGGG", Description = "", Name = "TestProject" });
_AssignedUserMock = new User() { Id = 5, FirstName = "Adam", Username = "adam", Password = "password" };
_MockProjectUsersList = new List<User>() { _AssignedUserMock};
serviceMock.Setup<List<string>>(p => p.GetBugPriorityList()).Returns(_MockPriorityList);
serviceMock.Setup<List<string>>(p => p.GetBugStatusList()).Returns(_MockStatusList);
serviceMock.Setup<List<User>>(p => p.GetUsersByProject(_MockActiveProject.ToProjectModel())).Returns(_MockProjectUsersList);
serviceMock.Setup<User>(p => p.GetMyUser()).Returns(_AssignedUserMock);
var _MockNotifier = new Mock<IGrowlNotifiactions>();
_ServiceMock = serviceMock.Object;
_ActiveProjectStub = new ProjectViewModel(new Project { Id = 5, Description = "Stub Project", Name = "Stub Title" });
_AddPanel = new BugAddPanelViewModel(_Messenger, _ServiceMock, _MockActiveProject, _MockNotifier.Object);
}
示例15: MovieGroupDetailViewModel
public MovieGroupDetailViewModel(
IMovieRepository movieRepository,
IMessenger messenger)
{
MovieRepository = movieRepository;
Messenger = messenger;
}