本文整理汇总了C#中IMessenger.Send方法的典型用法代码示例。如果您正苦于以下问题:C# IMessenger.Send方法的具体用法?C# IMessenger.Send怎么用?C# IMessenger.Send使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMessenger
的用法示例。
在下文中一共展示了IMessenger.Send方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GroupedMoviesViewModel
public GroupedMoviesViewModel(
IMessenger messenger,
IMovieRepository movieRepository)
{
MovieRepository = movieRepository;
if (MovieRepository != null)
{
MovieGroups = MovieRepository.LoadMovies()
.GroupBy(m => m.Genre)
.Select(g => new MovieGroupViewModel(messenger)
{
Title = g.Key.ToString(),
Movies = g.ToList(),
GroupImageUrl = g.First().ImageUrl
});
}
MovieTappedCommand = new RelayCommand<Movie>((movie) =>
{
var movieGroup = MovieGroups.First(mg => mg.Movies.Contains(movie));
messenger.Send<MovieSelectedMessage>(new MovieSelectedMessage { Movie = movie, MovieGroup = movieGroup });
});
MovieSelectedCommand = new RelayCommand(() =>
{
var movieGroup = MovieGroups.First(mg => mg.Movies.Contains(SelectedMovie));
messenger.Send<MovieSelectedMessage>(new MovieSelectedMessage { Movie = SelectedMovie, MovieGroup = movieGroup });
});
}
示例2: AgileBoardViewModel
public AgileBoardViewModel(IJiraApi jiraApi,
JiraSessionViewModel jiraSession,
IMessenger messenger,
IssuesStatisticsCalculator statisticsCalculator,
RawAgileBoard board)
{
Board = board;
_messenger = messenger;
_jiraApi = jiraApi;
_jiraSession = jiraSession;
_statisticsCalculator = statisticsCalculator;
PickUpSprintCommand = new RelayCommand(OpenPickUpSprint, () => Board.Type == "scrum");
OpenPivotAnalysisCommand = new RelayCommand(() => _messenger.Send(new OpenPivotAnalysisMessage(BoardContent.Issues)));
OpenEpicsOverviewCommand = new RelayCommand(() => _messenger.Send(new OpenEpicsOverviewMessage(BoardContent.Issues, BoardContent.Epics)), () => Board.Type == "scrum");
BrowseIssuesCommand = new RelayCommand(() => _messenger.Send(new OpenIssuesBrowserMessage(BoardContent.Issues)));
OpenGraveyardCommand = new RelayCommand(() => _messenger.Send(new OpenBoardGraveyardMessage(BoardContent.Issues)));
OpenSprintsVelocityCommand = new RelayCommand(() => _messenger.Send(new OpenSprintsVelocityMessage(BoardContent)), () => Board.Type == "scrum");
RefreshDataCommand = new RelayCommand(() =>
{
_forceReload = true;
DownloadElements();
}, () => IsBusy == false);
FetchChangesCommand = new RelayCommand(() =>
{
DownloadElements();
}, () => IsBusy == false);
DownloadElements();
}
示例3: MovieGroupViewModel
public MovieGroupViewModel(IMessenger messenger)
{
SelectCommand = new RelayCommand(() =>
{
messenger.Send<GroupSelectedMessage>(new GroupSelectedMessage { GroupName = Title });
});
MovieTappedCommand = new RelayCommand<Movie>((movie) =>
{
messenger.Send<MovieSelectedMessage>(new MovieSelectedMessage { Movie = movie, MovieGroup = this });
});
}
示例4: MainViewModel
public MainViewModel(IMessenger bus)
{
_bus = bus;
AddCommand = new RelayCommand(() => _bus.Send(new AddPasswordEntryMessage()));
BrowseCommand = new RelayCommand(() => _bus.Send(new OpenDirectoriesBrowserMessage()));
SearchCommand = new RelayCommand(() => _bus.Send(new SearchForEntryMessage()));
SettingsCommand = new RelayCommand(() => _bus.Send(new ShowSettingsMessage()));
LockCommand = new RelayCommand(Lock);
HelpCommand = new RelayCommand(() => _bus.Send(new ShowHelpMessage()));
RateCommand = new RelayCommand(Rate);
}
示例5: ListViewModel
public ListViewModel(
IToDoService toDoService,
IMessenger messenger,
IDispatcher dispatcher,
ISearchService searchService,
ISharingService sharingService
)
{
_toDoService = toDoService;
_searchService = searchService;
_dispatcher = dispatcher;
_messenger = messenger;
_sharingService = sharingService;
Items = new ObservableCollection<ToDoItem>();
SearchResult = new ObservableCollection<ToDoItem>();
RegisterSubscriptions();
SetupCommands();
Items.CollectionChanged += (s, c) =>
{
var count = Items.Count;
Count = count;
messenger.Send(new ItemCountChanged { Count = count });
};
PopulateItems();
}
示例6: SprintDetailsViewModel
public SprintDetailsViewModel(RawAgileSprint sprint,
IList<JiraIssue> issues,
IMessenger messenger,
IssuesStatisticsCalculator statisticsCalculator)
{
Sprint = sprint;
Issues = issues;
_messenger = messenger;
_statisticsCalculator = statisticsCalculator;
ScrumCardsCommand = new RelayCommand(() => _messenger.Send(new OpenScrumCardsMessage(Issues)));
BurnDownCommand = new RelayCommand(() => _messenger.Send(new OpenBurnDownMessage(Sprint, Issues)));
EngagementCommand = new RelayCommand(() => _messenger.Send(new OpenEngagementChartMessage(Issues)));
BrowseIssuesCommand = new RelayCommand(() => _messenger.Send(new OpenIssuesBrowserMessage(Issues)));
GatherStatistics();
}
示例7: AgileBoardSelectViewModel
public AgileBoardSelectViewModel(IMessenger messenger, AssistantSettings settings, IJiraApi jiraApi)
{
_messenger = messenger;
_jiraApi = jiraApi;
_settings = settings;
Boards = new ObservableCollection<RawAgileBoard>();
RecentBoards = new ObservableCollection<RawAgileBoard>();
OpenBoardCommand = new RelayCommand<RawAgileBoard>(OpenBoard);
OpenSettingsCommand = new RelayCommand(() => _messenger.Send(new OpenSettingsMessage()));
}
示例8: BoardGraveyardViewModel
public BoardGraveyardViewModel(IList<JiraIssue> issues,
IMessenger messenger,
AssistantSettings appSettings,
GraveyardSettings graveyardSettings)
{
Issues = issues;
_messenger = messenger;
_graveyardSettings = graveyardSettings;
_graveyardSettings.PropertyChanged += (sender, args) => _reloadNeeded = true;
_appSettings = appSettings;
OpenDetailsCommand = new RelayCommand<JiraIssue>(issue => _messenger.Send(new OpenIssueDetailsMessage(issue)));
OpenInBrowserCommand = new RelayCommand<JiraIssue>(issue => Process.Start(string.Format("{0}/browse/{1}", _appSettings.JiraUrl, issue.Key)));
OldCreated = new ObservableCollection<JiraIssue>();
ArchaicCreated = new ObservableCollection<JiraIssue>();
OldUpdated = new ObservableCollection<JiraIssue>();
InactiveAssignee = new ObservableCollection<JiraIssue>();
MissingDescription = new ObservableCollection<JiraIssue>();
}
示例9: DetailsViewModel
public DetailsViewModel(IMessenger messenger)
{
_messenger = messenger;
if (IsInDesignMode)
{
Entry = new PasswordEntry
{
Domain = "company.com",
PasswordLength = 15,
Tag = "Some tag",
TagAsCurrentMonth = false,
UseCapitalLetters = true,
UseDigits = true,
UseSpecialCharacters = false,
Username = "username"
};
}
GenerateCommand = new RelayCommand(Generate);
EditCommand = new RelayCommand(() => _messenger.Send(new EditEntryMessage(Entry)));
DeleteCommand = new RelayCommand(Delete);
}
示例10: UserPasswordChange
public static bool UserPasswordChange(string newPassword, string confirmPassword, IMessenger messenger)
{
if (!newPassword.Equals(confirmPassword))
{
throw new Csla.Rules.ValidationException("New password and confirmation password must be the same.");
}
var user = User.FetchUser(
new UserCriteria
{
UserId = BusinessPrincipal.GetCurrentIdentity().UserId
});
if (user != null)
{
var password = newPassword;
user.SetPassword(password);
user = user.Save();
if (messenger == null)
{
messenger = MessageHelper.InitializeMessageForUserPasswordChange(user.Email);
}
messenger.Message = messenger.Message.Replace(MessageParameter.Password, password);
messenger.Send();
}
else
{
throw new ArgumentException("No such user exists.");
}
return true;
}
示例11: 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;
}
示例12: OptionsViewModel
/// <summary>
/// Initializes a new instance of the OptionsViewModel class.
/// </summary>
public OptionsViewModel(IMessenger msngr)
{
MessengerInstance = msngr;
SaveOptions = new RelayCommand(
() =>
{
if (UserOptions != null && Options != null)
{
if (SelectedCP != null)
{
if (Options.CurrentConnection != SelectedCP)
{
Options.CurrentConnection = SelectedCP;
MessengerInstance.Send<ExecuteAction>(Action.DisconnectRepositories);
MessengerInstance.Send<NavigateToPage>(Page.Connections);
}
}
UserOptions.setOptions(Options);
}
},
() =>
{
return Options.Error == null;
});
}
示例13: MainViewModel
public MainViewModel(IMessenger messenger)
{
_messenger = messenger;
_messenger.Send(new LoginMessage());
}