public ConversationsPlugin() { state = new ConversationsState(); EventBroker.Subscribe<Message>(AppEvents.New, delegate { State.New(); }); EventBroker.Subscribe(AppEvents.New, delegate(SourceAddress address) { ClientState.Current.ViewController.MoveTo( PluginsManager.Current.GetPlugin<ConversationsPlugin>().NewItemView, new NewMessageDataHelper { To = address.ToList() }); }); EventBroker.Subscribe(AppEvents.New, delegate(string url) { ClientState.Current.ViewController.MoveTo( PluginsManager.Current.GetPlugin<ConversationsPlugin>().NewItemView, NewMessageDataHelper.Parse(url)); }); EventBroker.Subscribe(AppEvents.View, delegate(Message message) { if (message.MessageFolder == Folders.Drafts) { var access = new ClientMessageAccess(message); ClientState.Current.ViewController.MoveTo( PluginsManager.Current.GetPlugin<ConversationsPlugin>().NewItemView, new NewMessageDataHelper { SourceMessageId = message.MessageId, Context = message.Context, To = message.To, Cc = message.CC, Bcc = message.BCC, Body = access.BodyHtml, SelectedChannelId = message.SourceChannelId, AttachedFiles = message.Attachments.Select(a => new AttachmentDataHelper(a)).ToList(), SuppressSignature = true } ); } else { state.SelectedMessages.Replace(new[] { message }); state.View(); } }); EventBroker.Subscribe(AppEvents.RequestFirstImportant, delegate(Message message) { state.SelectedMessages.Replace(new[] { message }); ClientState.Current.ViewController.MoveTo( PluginsManager.Current.GetPlugin<ConversationsPlugin>().DetailsView, new OverviewDataHelper { MessageId = message.MessageId.Value, MakeNavigatorCurrent = true }); }); }
public ConversationsPlugin() { state = new ConversationsState(); EventBroker.Subscribe <Message>(AppEvents.New, delegate { State.New(); }); EventBroker.Subscribe(AppEvents.New, delegate(SourceAddress address) { ClientState.Current.ViewController.MoveTo( PluginsManager.Current.GetPlugin <ConversationsPlugin>().NewItemView, new NewMessageDataHelper { To = address.ToList() }); }); EventBroker.Subscribe(AppEvents.New, delegate(string url) { ClientState.Current.ViewController.MoveTo( PluginsManager.Current.GetPlugin <ConversationsPlugin>().NewItemView, NewMessageDataHelper.Parse(url)); }); EventBroker.Subscribe(AppEvents.View, delegate(Message message) { if (message.MessageFolder == Folders.Drafts) { var access = new ClientMessageAccess(message); ClientState.Current.ViewController.MoveTo( PluginsManager.Current.GetPlugin <ConversationsPlugin>().NewItemView, new NewMessageDataHelper { SourceMessageId = message.MessageId, Context = message.Context, To = message.To, Cc = message.CC, Bcc = message.BCC, Body = access.BodyHtml, SelectedChannelId = message.SourceChannelId, AttachedFiles = message.Attachments.Select(a => new AttachmentDataHelper(a)).ToList(), SuppressSignature = true } ); } else { state.SelectedMessages.Replace(new[] { message }); state.View(); } }); EventBroker.Subscribe(AppEvents.RequestFirstImportant, delegate(Message message) { state.SelectedMessages.Replace(new[] { message }); ClientState.Current.ViewController.MoveTo( PluginsManager.Current.GetPlugin <ConversationsPlugin>().DetailsView, new OverviewDataHelper { MessageId = message.MessageId.Value, MakeNavigatorCurrent = true }); }); }