本文整理汇总了C#中IMessenger类的典型用法代码示例。如果您正苦于以下问题:C# IMessenger类的具体用法?C# IMessenger怎么用?C# IMessenger使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IMessenger类属于命名空间,在下文中一共展示了IMessenger类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:TristanRhodes,项目名称:SampleApp,代码行数:27,代码来源:ProductPreviewViewModel.cs
示例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();
}
开发者ID:stricq,项目名称:UPKManager,代码行数:25,代码来源:FileListingController.cs
示例3: ProjectPanelViewModel
public ProjectPanelViewModel(ITrackerService svc, IMessenger mess)
{
_Messenger = mess;
_Service = svc;
Project = new ProjectViewModel();
}
开发者ID:hyperatom,项目名称:Bug-Tracker,代码行数:7,代码来源:ProjectPanelViewModel.cs
示例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);
}
开发者ID:jamesmcroft,项目名称:Windows-Universal-SplitViewTemplate,代码行数:16,代码来源:MainPageViewModel.cs
示例5: MessageController
public MessageController(IMessageService iMessageService, IUserInfo iUserInfo, IUnitOfWork unitOfWork, IMessenger iMessenger)
{
_iMessageService = iMessageService;
_iUserInfo = iUserInfo;
_unitOfWork = unitOfWork;
_iMessenger = iMessenger;
}
开发者ID:b9502032,项目名称:MySite,代码行数:7,代码来源:MessageController.cs
示例6: MainViewModel
public MainViewModel(IViewModelNavigator navigator, IMessenger messenger)
{
messenger.Register<ContentChangedMessage>(this, OnContentChanged);
_messenger = messenger;
_navigator = navigator;
_navigator.NavigateForward<WelcomViewModel>(null);
}
开发者ID:KonigLabs,项目名称:SpriteEvent,代码行数:7,代码来源:MainViewModel.cs
示例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;
}
开发者ID:WhiteIsland,项目名称:epiworx,代码行数:32,代码来源:UserPasswordService.cs
示例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;
}
开发者ID:TheSylence,项目名称:GSD,代码行数:7,代码来源:ViewModelBaseEx.cs
示例9: LoginViewModel
public LoginViewModel(IMessenger messenger, ILoginService loginService)
{
_messenger = messenger;
_loginService = loginService;
LoginCommand = new RelayCommand<object>(Login);
}
开发者ID:korchakmv,项目名称:warehouse,代码行数:7,代码来源:LoginViewModel.cs
示例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();
}
开发者ID:stricq,项目名称:UPKManager,代码行数:28,代码来源:UpkManagerController.cs
示例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);
}
}
开发者ID:nuxleus,项目名称:nconsoler,代码行数:27,代码来源:Consolery.cs
示例12: CommonWindow
public CommonWindow(IMessenger messenger)
{
_messenger = messenger;
_messenger.Register<CloseViewMessage>(this, Close);
InitializeComponent();
}
开发者ID:Zhenya777777777,项目名称:DataGridBehaviors,代码行数:7,代码来源:CommonWindow.xaml.cs
示例13: ChangePasswordView
public ChangePasswordView(IMessenger messenger)
{
InitializeComponent();
_messenger = messenger;
_messenger.Register<PasswordChangeMsg>(this, OnPasswordChangeMsgMessage);
}
开发者ID:wasteland540,项目名称:SecureFileShare,代码行数:7,代码来源:ChangePasswordView.xaml.cs
示例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);
}
开发者ID:hyperatom,项目名称:Bug-Tracker,代码行数:29,代码来源:BugAddPanelTests.cs
示例15: MovieGroupDetailViewModel
public MovieGroupDetailViewModel(
IMovieRepository movieRepository,
IMessenger messenger)
{
MovieRepository = movieRepository;
Messenger = messenger;
}
开发者ID:brentedwards,项目名称:Movies.WinRT,代码行数:7,代码来源:MovieGroupDetailViewModel.cs
示例16: MainViewModel
public MainViewModel(
IViewModelNavigator navigator,
IMessenger messenger,
SessionService sessionService,
CommunicationManager communicationManager,
SettingsProvider settingsProvider)
{
_sessionService = sessionService;
_communicationManager = communicationManager;
_settingsProvider = settingsProvider;
messenger.Register<ShowChildWindowMessage>(this, RaiseShowWindow);
messenger.Register<WindowStateMessage>(this, state => RaiseStateChanged(state.State));
messenger.Register<ContentChangedMessage>(this, OnContentChanged);
//navigator.NavigateForward<WelcomeViewModel>(null); //temporary
navigator.NavigateForward<PasswordPromptViewModel>(null);
messenger.Register<CommandMessage>(this, OnOpenCommand);
messenger.Register<CloseCommandMessage>(this, OnCloseCommand);
UpdateSessionStart();
communicationManager.Connect();
_timer = new DispatcherTimer();
_timer.Interval = new TimeSpan(0, 0, 15);
_timer.IsEnabled = true;
_timer.Tick += SendPing;
_timer.Start();
}
开发者ID:kobyb1988,项目名称:PhotoBox,代码行数:28,代码来源:MainViewModel.cs
示例17: ProjectListViewModel
public ProjectListViewModel( IViewServiceRepository viewServices = null, ISettingsRepository settingsRepo = null, IProjectRepository projectRepo = null, IMessenger messenger = null )
: base( viewServices, settingsRepo, messenger )
{
ProjectRepo = projectRepo ?? new ProjectRepository( Session );
Projects = new ObservableCollection<ProjectViewModel>( ProjectRepo.GetAll().OrderBy( p => p.Name ).Select( p => new ProjectViewModel( p ) ) );
var last = Settings.GetById( SettingKeys.LastProject );
CurrentProject = Projects.FirstOrDefault( p => p.Model.Id == last.Get<int>() ) ?? Projects.FirstOrDefault();
foreach( var proj in Projects )
{
proj.CurrentChanged += Proj_CurrentChanged;
}
if( CurrentProject != null )
{
CurrentProject.IsCurrent = true;
}
ProjectNames = new List<string>();
Validate( nameof( NewProjectName ) ).Check( () => !string.IsNullOrWhiteSpace( NewProjectName ) ).Message( Strings.ProjectMustHaveName );
Validate( nameof( NewProjectName ) ).Check( () => !ProjectNames.Contains( NewProjectName ) ).Message( Strings.ThisNameIsAlreadyUsed );
Reset();
}
开发者ID:TheSylence,项目名称:GSD,代码行数:26,代码来源:ProjectListViewModel.cs
示例18: Playlist
public Playlist(IAudioPlayer player, ICurrentMixProvider mixProvider, IMessenger messenger)
{
if (mixProvider == null) throw new ArgumentNullException("mixProvider");
if (messenger == null) throw new ArgumentNullException("messenger");
this.player = player;
this.mixProvider = mixProvider;
}
开发者ID:rdingwall,项目名称:mixplanner,代码行数:7,代码来源:Playlist.cs
示例19: SessionManagerMonkey
public SessionManagerMonkey(IMessenger messenger, UserTaskRepository taskRepository)
{
this.messenger = messenger;
this.taskRepository = taskRepository;
messenger.Register<CreateUserTaskMessage>(this, HandleUserTaskCreatedMessage);
}
开发者ID:kiwipom,项目名称:billboard,代码行数:7,代码来源:SessionManagerMonkey.cs
示例20: Consolery
private Consolery(Type targetType, string[] args, IMessenger messenger)
{
#region Parameter Validation
if (targetType == null)
{
throw new ArgumentNullException("targetType");
}
if (args == null)
{
throw new ArgumentNullException("args");
}
if (messenger == null)
{
throw new ArgumentNullException("messenger");
}
#endregion
m_TargetType = targetType;
m_Args = args;
m_Messenger = messenger;
MethodInfo[] methods = m_TargetType.GetMethods(BindingFlags.Public | BindingFlags.Static);
foreach (MethodInfo method in methods)
{
object[] attributes = method.GetCustomAttributes(false);
if (attributes.OfType<ActionAttribute>().Any())
{
m_ActionMethods.Add(method);
}
}
}
开发者ID:senzacionale,项目名称:ncrawler,代码行数:32,代码来源:NConsoler.cs
注:本文中的IMessenger类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论