/// <summary> /// Called when the event was fired (processing completed). /// </summary> /// <param name="eventTopic">The event topic.</param> /// <param name="publication">The publication.</param> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> public override void FiredEvent(IEventTopicInfo eventTopic, IPublication publication, object sender, EventArgs e) { INamedItem namedItem = publication.Publisher as INamedItem; if (namedItem != null) { this.log.DebugFormat( CultureInfo.InvariantCulture, "Fired event '{0}'. Invoked by publisher '{1}' with name '{2}' with sender '{3}' and EventArgs '{4}'.", eventTopic.Uri, publication.Publisher, namedItem.EventBrokerItemName, sender, e); } else { this.log.DebugFormat( CultureInfo.InvariantCulture, "Fired event '{0}'. Invoked by publisher '{1}' with sender '{2}' and EventArgs '{3}'.", eventTopic.Uri, publication.Publisher, sender, e); } }
public void AddPublication(IPublication publication) { Ensure.ArgumentNotNull(publication, "publication"); this.Clean(); if (!publication.AllowsMultipleRegistrationsOnSamePublisher) { this.ThrowIfRepeatedPublication(publication.Publisher, publication.EventName); } this.extensionHost.ForEach(extension => extension.CreatedPublication(this, publication)); foreach (ISubscription subscription in this.subscriptions) { ThrowIfPublisherAndSubscriberEventArgumentsMismatch(subscription, publication); ThrowIfSubscriptionHandlerDoesNotMatchHandlerRestrictionOfPublisher(subscription, publication); } lock (this) { var newPublications = new List<IPublication>(this.publications) { publication }; this.publications = newPublications; } this.extensionHost.ForEach(extension => extension.AddedPublication(this, publication)); }
public bool Match(IPublication publication, ISubscription subscription, EventArgs e) { var publisher = publication.Publisher as IVhptIdentificationProvider; var subscriber = subscription.Subscriber as IVhptIdentificationProvider; return publisher != null && subscriber != null && publisher.Identification.Equals(subscriber.Identification); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Test class that mocks the PageSetupDlg. /// </summary> /// <param name="pgLayout">The page layout.</param> /// <param name="publication">The publication.</param> /// <param name="division">The division.</param> /// <param name="pubPageInfo">The publication page info.</param> /// ------------------------------------------------------------------------------------ public DummyPageSetupDlg(IPubPageLayout pgLayout, IPublication publication, IPubDivision division, List<PubPageInfo> pubPageInfo) : base(pgLayout, null, publication, division, null, null, new DummyApp(), pubPageInfo) { // need to set selected index to something other than 0, otherwise tests fail // on machines with default printer set to A4. PaperSizeName = "A5"; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Constructs a TePrintLayoutConfig to configure the main print layout /// </summary> /// <param name="cache">The cache.</param> /// <param name="styleSheet">The style sheet.</param> /// <param name="publication">The publication.</param> /// <param name="viewType">Type of the view.</param> /// <param name="filterInstance">the book filter instance in effect</param> /// <param name="printDateTime">printing date and time</param> /// <param name="fIntroDivision">set to <c>true</c> for a division that displays book /// title and introduction material, <c>false</c> for a division that displays main /// scripture text.</param> /// <param name="hvoBook">The hvo of the book.</param> /// <param name="sharedStream">A layout stream used for footnotes which is shared across /// multiple divisions</param> /// <param name="ws">The writing system to use for the back translation</param> /// ------------------------------------------------------------------------------------ public TeBtPrintLayoutConfig(FdoCache cache, IVwStylesheet styleSheet, IPublication publication, TeViewType viewType, int filterInstance, DateTime printDateTime, bool fIntroDivision, int hvoBook, IVwLayoutStream sharedStream, int ws) : base(cache, styleSheet, publication, viewType, filterInstance, printDateTime, fIntroDivision, hvoBook, sharedStream, ws) { }
/// <summary> /// Initializes a new instance of the <see cref="MissingMappingContext"/> class. /// </summary> /// <param name="eventTopic">The source event topic.</param> /// <param name="destinationTopic">The destination topic URI.</param> /// <param name="publication">The publication which triggered the event.</param> /// <param name="sender">The sender of the event.</param> /// <param name="eventArgs">The <see cref="System.EventArgs"/> instance containing the event data.</param> /// <param name="exception">The exception which contains information why the mapping was not possible.</param> public MissingMappingContext(IEventTopicInfo eventTopic, string destinationTopic, IPublication publication, object sender, EventArgs eventArgs, Exception exception) { this.Exception = exception; this.EventArgs = eventArgs; this.Sender = sender; this.Publication = publication; this.DestinationTopic = destinationTopic; this.EventTopic = eventTopic; }
public PublicationControlModel(IPublication publication) { this.PublicationId = publication.PublicationId; this.Title = publication.Title; this.Publisher = publication.Publisher; this.Price = publication.Price; this.TimesInYear = publication.TimesInYear; this.SubscribersCount = 0; }
/// <summary> /// Returns whether the publication and subscription match and the event published by the /// publisher will be relayed to the subscriber. /// <para> /// This is the case if the name of the subscriber is a prefix to the name of the publisher. /// </para> /// </summary> /// <param name="publication">The publication.</param> /// <param name="subscription">The subscription.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> /// <returns><code>true</code> if event has to be sent to the subscriber.</returns> public bool Match(IPublication publication, ISubscription subscription, EventArgs e) { object publisher = publication.Publisher; object subscriber = subscription.Subscriber; string publisherName = publisher is INamedItem ? ((INamedItem)publisher).EventBrokerItemName : string.Empty; string subscriberName = subscriber is INamedItem ? ((INamedItem)subscriber).EventBrokerItemName : string.Empty; return publisherName.StartsWith(subscriberName); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="T:TePageSetupDlg"/> class. /// </summary> /// <param name="wsUser">The user writing system.</param> /// <param name="pgLayout">The page layout.</param> /// <param name="scr">The Scripture object (which owns the publications).</param> /// <param name="publication">The publication.</param> /// <param name="division">The division. The NumberOfColumns in the division should be /// set before calling this dialog.</param> /// <param name="teMainWnd">TE main window (provides callbacks).</param> /// <param name="helpTopicProvider">The help topic provider.</param> /// <param name="units">The user's prefered measurement units.</param> /// <param name="fIsTrialPub">if set to <c>true</c> view from which this dialog /// was brought up is Trial Publication view.</param> /// <param name="pubPageSizes">The page sizes available for publication.</param> /// ------------------------------------------------------------------------------------ public TePageSetupDlg(int wsUser, IPubPageLayout pgLayout, IScripture scr, IPublication publication, IPubDivision division, IPageSetupCallbacks teMainWnd, IHelpTopicProvider helpTopicProvider, MsrSysType units, bool fIsTrialPub, List<PubPageInfo> pubPageSizes) : base(wsUser, pgLayout, scr, publication, division, teMainWnd, helpTopicProvider, units, pubPageSizes) { m_fIsTrialPublication = fIsTrialPub; if (!m_chkNonStdChoices.Checked) // following the standard m_standardLeadingFactor = m_nudLineSpacing.Value / m_nudBaseCharSize.Value; }
public EventBrokerLogExtensionTest() { this.testee = new EventBrokerLogExtension(); this.log4Net = new Log4netHelper(); this.eventTopicInfo = CreateEventTopicInfo(); this.publication = CreatePublication(); this.publicationWithNamedPublisher = CreatePublicationWithNamedPublisher(); this.sender = CreateSender(); this.eventArgs = CreateEventArgs(); }
/// <summary> /// Returns whether the publication and subscription match and the event published by the /// publisher will be relayed to the subscriber. /// <para> /// This is the case if the name of the subscriber is a prefix to the name of the publisher. /// </para> /// </summary> /// <param name="publication">The publication.</param> /// <param name="subscription">The subscription.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> /// <returns><code>true</code> if event has to be sent to the subscriber.</returns> public bool Match(IPublication publication, ISubscription subscription, EventArgs e) { Ensure.ArgumentNotNull(publication, "publication"); Ensure.ArgumentNotNull(subscription, "subscription"); object publisher = publication.Publisher; object subscriber = subscription.Subscriber; string publisherName = publisher is INamedItem ? ((INamedItem)publisher).EventBrokerItemName : string.Empty; string subscriberName = subscriber is INamedItem ? ((INamedItem)subscriber).EventBrokerItemName : string.Empty; return publisherName.StartsWith(subscriberName, StringComparison.Ordinal); }
public static IBook Create(string id, IPublication publication) { if (id == null || publication == null) throw new ArgumentNullException(); return new Book() { Author = publication.Author, Id = id, ISBN = publication.ISBN, Title = publication.Title, Publisher = publication.Publisher }; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Constructs a new instance of the <see cref="ExportXhtml"/> class. /// </summary> /// <param name="fileName">pathname of the XHTML file to create</param> /// <param name="cache">data source</param> /// <param name="filter">lists the books to export</param> /// <param name="what">tells what to export: everything, filtered list, or single book</param> /// <param name="nBook">if single book, number of the book to export</param> /// <param name="iFirstSection">if single book, index of first section to export</param> /// <param name="iLastSection">if single book, index of last section to export</param> /// <param name="sDescription">The s description.</param> /// <param name="styleSheet">The style sheet.</param> /// <param name="pub">The pub.</param> /// <param name="app">The application</param> /// ------------------------------------------------------------------------------------ public ExportXhtml(string fileName, FdoCache cache, FilteredScrBooks filter, ExportWhat what, int nBook, int iFirstSection, int iLastSection, string sDescription, FwStyleSheet styleSheet, IPublication pub, IApp app) { m_fileName = fileName; m_cache = cache; m_bookFilter = filter; m_what = what; m_nBookSingle = nBook; m_iFirstSection = iFirstSection; m_iLastSection = iLastSection; m_sDescription = sDescription; m_styleSheet = styleSheet; m_pub = pub; m_app = app; m_scr = cache.LangProject.TranslatedScriptureOA; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Method to test creation of a publication view. /// </summary> /// <param name="pub">The publication.</param> /// <param name="viewType">Type of the Translation Editor view.</param> /// <returns> /// a Scripture publication for the specified view type. /// </returns> /// ------------------------------------------------------------------------------------ internal static DummyScripturePublication Create(IPublication pub, TeViewType viewType, FwStyleSheet stylesheet) { if (viewType == TeViewType.BackTranslationParallelPrint) { Debug.Assert(false, "Not yet implemented."); return null; } DummyScripturePublication pubControl = new DummyScripturePublication(pub.Cache, stylesheet, 567, pub, viewType, DateTime.Now); pubControl.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom; pubControl.Dock = DockStyle.Fill; pubControl.Name = TeEditingHelper.ViewTypeString(viewType); pubControl.Visible = false; return pubControl; }
/// <summary> /// Called after a publication was added to an event topic. /// </summary> /// <param name="eventTopic">The event topic.</param> /// <param name="publication">The publication.</param> public override void AddedPublication(IEventTopicInfo eventTopic, IPublication publication) { using (TextWriter writer = new StringWriter(CultureInfo.InvariantCulture)) { foreach (IPublicationMatcher publicationMatcher in publication.PublicationMatchers) { publicationMatcher.DescribeTo(writer); writer.Write(", "); } Console.WriteLine( "Added publication '{0}.{1}' to topic '{2}' with matchers '{3}'.", publication.Publisher != null ? publication.Publisher.GetType().FullName : "-", publication.EventName, eventTopic.Uri, writer); } }
public PublicationModel(IPublication publication, List<string> topicList) { this.PublicationId = publication.PublicationId; this.Title = publication.Title; this.LinkToCover = publication.LinkToCover; this.Description = publication.Description; this.Price = publication.Price; this.TimesInYear = publication.TimesInYear; this.Publisher = publication.Publisher; this.TopicList = new List<string>(topicList); this.Topics = String.Empty; if (topicList != null) { foreach (string item in topicList) { this.Topics += item + ", "; } } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Configure a PublicationControl /// </summary> /// <param name="fAddSubStream">if set to <c>true</c> add subordinate stream.</param> /// <param name="fAddContent">if set to <c>true</c> add real content, otherwise add /// rectangle for paragraph.</param> /// ------------------------------------------------------------------------------------ private void ConfigurePublication(bool fAddSubStream, bool fAddContent) { // When called for test setup, they will be null. // When called from within as test if (m_pub != null) { m_pub.Dispose(); } if (m_division != null) { m_division.Dispose(); } m_division = new DummyDivision(new DummyLazyPrintConfigurer(Cache, fAddSubStream, fAddContent), 2); IPublication pub = Cache.LangProject.TranslatedScriptureOA.PublicationsOC.ToArray()[0]; m_pub = new DummyPublication(pub, m_division, DateTime.Now); m_pub.Configure(); // Check initial state Assert.AreEqual(m_division, m_pub.Divisions[0]); Assert.IsNotNull(m_division.MainVc as DummyMainLazyViewVc); IVwLayoutStream layoutStream = m_division.MainLayoutStream; Assert.IsNotNull(layoutStream); m_pub.IsLeftBound = true; // Set up the publication m_pub.PageHeight = 72000 * 11; // 11 inches m_pub.PageWidth = (int)(72000 * 8.5); // 8.5 inches m_division.TopMargin = 36000; // Half inch m_division.BottomMargin = 18000; // Quarter inch m_division.InsideMargin = 9000; // 1/8 inch m_division.OutsideMargin = 4500; // 1/16 inch DummyMainLazyViewVc vc = m_division.MainVc as DummyMainLazyViewVc; vc.m_estBookHeight = 2000; vc.m_estSectionHeight = 2000; m_pub.Width = 3 * 96; // represents a window that is 3" wide at 96 DPI }
/// <summary> /// Checks whether the event of the publisher has to be relayed to the subscriber (Matchers). /// </summary> /// <param name="publication">The publication.</param> /// <param name="subscription">The subscription.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> /// <returns><code>true</code> if the event has to be relayed.</returns> private bool CheckMatchers(IPublication publication, ISubscription subscription, EventArgs e) { bool match = true; foreach (var publicationMatcher in publication.PublicationMatchers) { match &= publicationMatcher.Match(publication, subscription, e); } foreach (var globalMatcher in this.globalMatchersProvider.Matchers) { match &= globalMatcher.Match(publication, subscription, e); } foreach (var subscriptionMatcher in subscription.SubscriptionMatchers) { match &= subscriptionMatcher.Match(publication, subscription, e); } return(match); }
private void ShowPublication(int indexCurrentPublication) { if (publications.Length > 0) { IPublication publication = publications.ElementAt(indexCurrentPublication); string id = publication.Id; string wroteBy = publication.WroteBy; string createDate = publication.CreateDate.ToShortDateString(); string message = publication.Message; string location = publication.Location.ToString(); string language = publication.Language.ToString(); string lemmatized = publication.LemmatizedMessage.ToString(); string info = id + "\r\n" + wroteBy + "\r\n" + createDate + "\r\n" + message + "\r\n" + "\r\n" + lemmatized + "\r\n" + location + "\r\n" + language + "\r\n"; tbxPublication.Text = info; numericUpDown.Value = indexCurrentPublication + 1; bool isTwitter = IsTwitterPublication(publications[indexCurrentPublications]); ToEnableFullText(isTwitter); } }
public override void Initialize() { CheckDisposed(); base.Initialize(); wsUser = m_inMemoryCache.Cache.DefaultUserWs; m_inMemoryCache.InitializeAnnotationDefs(); m_pub = m_inMemoryCache.CreatePublication(0, 0, false, "TestPub", 0, BindingSide.Left, 0); m_div = m_inMemoryCache.AddDivisionToPub(m_pub, false, false, DivisionStartOption.Continuous); m_pgl = new PubPageLayout() as IPubPageLayout; m_div.PageLayoutOA = m_pgl; m_div.PageLayoutOAHvo = m_pgl.Hvo; m_pubPageInfo = new List <PubPageInfo>(); m_pubPageInfo.Add(new PubPageInfo("Full Page", 0, 0)); m_pubPageInfo.Add(new PubPageInfo("5.25 x 8.25", (int)(8.25 * 72000), (int)(5.25 * 72000))); m_pubPageInfo.Add(new PubPageInfo("5.8 x 8.7", (int)(8.7 * 72000), (int)(5.8 * 72000))); }
public static void Publish(this HttpContext httpContext, IPublication publication) { using var _ = publication.Use(); var state = publication.State; var computed = state.Computed; var isConsistent = computed.IsConsistent; var headers = httpContext.Response.Headers; if (headers.ContainsKey(FusionHeaders.PublisherId)) { throw Errors.AlreadyShared(); } headers[FusionHeaders.PublisherId] = publication.Publisher.Id.Value; headers[FusionHeaders.PublicationId] = publication.Id.Value; headers[FusionHeaders.LTag] = state.Computed.LTag.ToString(); if (!isConsistent) { headers[FusionHeaders.IsConsistent] = isConsistent.ToString(); } }
public virtual ValueTask SubscribeAsync( Channel <BridgeMessage> channel, IPublication publication, bool isUpdateRequested, CancellationToken cancellationToken = default) { ThrowIfDisposedOrDisposing(); if (!ChannelProcessors.TryGetValue(channel, out var channelProcessor)) { throw Errors.UnknownChannel(channel); } if (publication.Publisher != this) { throw Errors.WrongPublisher(this, publication.Publisher.Id); } var message = new SubscribeMessage() { PublisherId = Id, PublicationId = publication.Id, IsUpdateRequested = isUpdateRequested, }; return(channelProcessor.OnReplicaMessageAsync(message, cancellationToken)); }
/// <summary> /// Processing choice. /// </summary> /// <param name="choice"> Your choice </param> /// <param name="booklet"> Booklet </param> private static void ProcessingChoice(int choice, IPublication booklet) { switch (choice) { case 1: PrintMessage("Enter new text: ", ConsoleColor.Yellow); booklet.Write(new StringBuilder(Console.ReadLine())); break; case 2: PrintMessage("Enter text for append: ", ConsoleColor.Yellow); booklet.Append(new StringBuilder(Console.ReadLine())); break; case 3: booklet.Read(); break; default: throw new ArgumentOutOfRangeException(); } }
/// <summary> /// Adds the publication. /// </summary> /// <param name="publication">The publication.</param> private void AddPublication(IPublication publication) { this.extensionHost.ForEach(extension => extension.CreatedPublication(this, publication)); foreach (ISubscription subscription in this.subscriptions) { this.ThrowIfPublisherAndSubscriberEventArgsMismatch(subscription, publication); this.ThrowIfSubscriptionHandlerDoesNotMatchHandlerRestrictionOfPublisher(subscription, publication); } lock (this) { List <IPublication> newPublications = new List <IPublication>(this.publications) { publication }; this.publications = newPublications; this.extensionHost.ForEach(extension => extension.AddedPublication(this, publication)); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Configure a PublicationControl /// </summary> /// ------------------------------------------------------------------------------------ public void ConfigurePublication() { if (m_division != null) { m_division.Dispose(); } if (m_ScrPubCtrl != null) { m_ScrPubCtrl.Dispose(); } m_division = new DummyDivision(new DummyPrintConfigurer(Cache, null), 1); IPublication pub = Cache.LangProject.TranslatedScriptureOA.PublicationsOC.ToArray()[0]; m_ScrPubCtrl = new TeDummyPublication(pub, m_division, DateTime.Now); m_ScrPubCtrl.Configure(); // Check initial state Assert.AreEqual(m_division, m_ScrPubCtrl.Divisions[0]); Assert.IsNotNull(m_division.MainVc as StVc); IVwLayoutStream layoutStream = m_division.MainLayoutStream; Assert.IsNotNull(layoutStream); Assert.AreEqual(layoutStream, m_division.MainLayoutStream, "MainLayoutStream should not contruct a new stream each time"); IVwRootBox rootbox = layoutStream as IVwRootBox; Assert.IsNotNull(rootbox); IVwSelection sel = rootbox.Selection; Assert.IsNotNull(sel); int ich, hvo, tag, ws; // dummies bool fAssocPrev; ITsString tss; sel.TextSelInfo(false, out tss, out ich, out fAssocPrev, out hvo, out tag, out ws); Assert.AreEqual("11Verse one.", tss.Text.Substring(0, 12)); }
/// ----------------------------------------------------------------------------------- /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing"><c>true</c> to release both managed and unmanaged /// resources; <c>false</c> to release only unmanaged resources. /// </param> /// ----------------------------------------------------------------------------------- protected override void Dispose(bool disposing) { // Must not be run more than once. if (IsDisposed) { return; } if (disposing) { if (components != null) { components.Dispose(); } } CloseRootBoxes(); m_cache = null; m_HfSetOwner = null; m_pub = null; m_pubDiv = null; base.Dispose(disposing); }
/// <summary> /// Called when the event was fired (processing completed). /// </summary> /// <param name="eventTopic">The event topic.</param> /// <param name="publication">The publication.</param> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> public override void FiredEvent(IEventTopicInfo eventTopic, IPublication publication, object sender, EventArgs e) { INamedItem namedItem = publication.Publisher as INamedItem; if (namedItem != null) { Debug.WriteLine( "Fired event '{0}'. Invoked by publisher '{1}' with name '{2}' with sender '{3}' and EventArgs '{4}'.", eventTopic.Uri, publication.Publisher, namedItem.EventBrokerItemName, sender, e); } else { Debug.WriteLine( "Fired event '{0}'. Invoked by publisher '{1}' with sender '{2}' and EventArgs '{3}'.", eventTopic.Uri, publication.Publisher, sender, e); } }
public void SavePublication(IPublication publication, string[] topics) { Publication newPublication = new Publication(); newPublication.PublicationId = publication.PublicationId; newPublication.LinkToCover = publication.LinkToCover; newPublication.Title = publication.Title; newPublication.Description = publication.Description; newPublication.Price = publication.Price; newPublication.Deleted = false; newPublication.TimesInYear = publication.TimesInYear; newPublication.Publisher = publication.Publisher; UpdateTopics(topics); if (newPublication.PublicationId == 0) { AddPublication(newPublication); AddTopicsToPublications(topics); } else { UpdatePublication(newPublication); UpdateTopicsToPublications(topics, newPublication.PublicationId); } }
public void RemovePublication(IPublication publication) { // this method is a heck to get spontaneous publications with handler restrictions running!! this.Clean(); if (publication != null) { lock (this) { List <IPublication> newPublications = new List <IPublication>(); foreach (IPublication p in this.publications) { if (p != publication) { newPublications.Add(p); } } this.publications = newPublications; this.extensionHost.ForEach(extension => extension.RemovedPublication(this, publication)); } } }
/// <summary> /// Called when a publication or subscription matcher did not match and the event was not relayed to a subscription. /// </summary> /// <param name="eventTopic">The event topic.</param> /// <param name="publication">The publication.</param> /// <param name="subscription">The subscription.</param> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> public override void SkippedEvent(IEventTopicInfo eventTopic, IPublication publication, ISubscription subscription, object sender, EventArgs e) { List <IMatcher> matchers = new List <IMatcher>(); var publicationMatchers = from matcher in publication.PublicationMatchers where !matcher.Match(publication, subscription, e) select matcher; var subscriptionMatchers = from matcher in subscription.SubscriptionMatchers where !matcher.Match(publication, subscription, e) select matcher; matchers.AddRange(publicationMatchers); matchers.AddRange(subscriptionMatchers); StringBuilder sb = new StringBuilder(); using (TextWriter writer = new StringWriter(sb, CultureInfo.InvariantCulture)) { foreach (IMatcher matcher in matchers) { matcher.DescribeTo(writer); writer.Write(", "); } } if (sb.Length > 0) { sb.Length -= 2; } this.log.DebugFormat( CultureInfo.InvariantCulture, "Skipped event '{0}' from publisher '{1}' [{2}] to subscriber '{3}' [{4}] with EventArgs '{5}' because the matchers '{6}' did not match.", eventTopic.Uri, publication.Publisher, publication.Publisher is INamedItem ? ((INamedItem)publication.Publisher).EventBrokerItemName : string.Empty, subscription.Subscriber, subscription.Subscriber is INamedItem ? ((INamedItem)subscription.Subscriber).EventBrokerItemName : string.Empty, e, sb); }
/// ----------------------------------------------------------------------------------- /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing"><c>true</c> to release both managed and unmanaged /// resources; <c>false</c> to release only unmanaged resources. /// </param> /// ----------------------------------------------------------------------------------- protected override void Dispose(bool disposing) { System.Diagnostics.Debug.WriteLineIf(!disposing, "****** Missing Dispose() call for " + GetType().Name + ". ****** "); // Must not be run more than once. if (IsDisposed) { return; } if (disposing) { if (components != null) { components.Dispose(); } } CloseRootBoxes(); m_cache = null; m_HfSetOwner = null; m_pub = null; m_pubDiv = null; base.Dispose(disposing); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Constructs a TePrintLayoutConfig to configure the main print layout /// </summary> /// <param name="cache">The cache.</param> /// <param name="styleSheet">The style sheet.</param> /// <param name="publication">The publication.</param> /// <param name="viewType">Type of the view.</param> /// <param name="filterInstance">the book filter instance in effect</param> /// <param name="printDateTime">printing date and time</param> /// <param name="fIntroDivision">set to <c>true</c> for a division that displays book /// title and introduction material, <c>false</c> for a division that displays main /// scripture text.</param> /// <param name="hvoBook">The hvo of the book we're displaying.</param> /// <param name="sharedStream">A layout stream used for footnotes which is shared across /// multiple divisions</param> /// <param name="ws">The writing system to use for the view.</param> /// ------------------------------------------------------------------------------------ public TePrintLayoutConfig(FdoCache cache, IVwStylesheet styleSheet, IPublication publication, TeViewType viewType, int filterInstance, DateTime printDateTime, bool fIntroDivision, int hvoBook, IVwLayoutStream sharedStream, int ws) { m_fdoCache = cache; m_scr = m_fdoCache.LangProject.TranslatedScriptureOA; m_styleSheet = styleSheet; m_pub = publication; m_viewType = viewType; m_bookFilterInstance = filterInstance; m_printDateTime = printDateTime; m_fIntroDivision = fIntroDivision; m_hvoBook = hvoBook; m_sharedStream = sharedStream; m_ws = ws; m_sectionFilterInstance = g_nextSectionFilterInstance++; m_sectionFilter = new FilteredSequenceHandler(cache, ScrBook.kClassId, m_sectionFilterInstance, this, this, new SimpleFlidProvider((int)ScrBook.ScrBookTags.kflidSections)); m_paraCounter = ParagraphCounterManager.GetParaCounter(cache, (int)TeViewGroup.Scripture); }
/// <summary> /// Called when a publication or subscription matcher did not match and the event was not relayed to a subscription. /// </summary> /// <param name="eventTopic">The event topic.</param> /// <param name="publication">The publication.</param> /// <param name="subscription">The subscription.</param> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> public virtual void SkippedEvent(IEventTopicInfo eventTopic, IPublication publication, ISubscription subscription, object sender, EventArgs e) { }
private void EventTopicFireHandler(IEventTopicInfo eventTopic, object sender, EventArgs e, IPublication publication) { var target = this.Subscriber; if (target == null) { return; } this.extensionHost.ForEach(extension => extension.RelayingEvent(eventTopic, publication, this, this.handler, sender, e)); this.handler.Handle(eventTopic, target, sender, e, this.delegateWrapper); this.extensionHost.ForEach(extension => extension.RelayedEvent(eventTopic, publication, this, this.handler, sender, e)); }
void IPublisherImpl.OnPublicationDisposed(IPublication publication) => OnPublicationDisposed(publication);
/// <summary> /// Called when a publication or subscription matcher did not match and the event was not relayed to a subscription. /// </summary> /// <param name="eventTopic">The event topic.</param> /// <param name="publication">The publication.</param> /// <param name="subscription">The subscription.</param> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> public override void SkippedEvent(IEventTopicInfo eventTopic, IPublication publication, ISubscription subscription, object sender, EventArgs e) { List<IMatcher> matchers = new List<IMatcher>(); var publicationMatchers = from matcher in publication.PublicationMatchers where !matcher.Match(publication, subscription, e) select matcher; var subscriptionMatchers = from matcher in subscription.SubscriptionMatchers where !matcher.Match(publication, subscription, e) select matcher; matchers.AddRange(publicationMatchers); matchers.AddRange(subscriptionMatchers); StringBuilder sb = new StringBuilder(); using (TextWriter writer = new StringWriter(sb)) { foreach (IMatcher matcher in matchers) { matcher.DescribeTo(writer); writer.Write(", "); } } if (sb.Length > 0) { sb.Length -= 2; } this.log.DebugFormat( "Skipped event '{0}' from publisher '{1}' [{2}] to subscriber '{3}' [{4}] with EventArgs '{5}' because the matchers '{6}' did not match.", eventTopic.Uri, publication.Publisher, publication.Publisher is INamedItem ? ((INamedItem)publication.Publisher).EventBrokerItemName : string.Empty, subscription.Subscriber, subscription.Subscriber is INamedItem ? ((INamedItem)subscription.Subscriber).EventBrokerItemName : string.Empty, e, sb); }
/// <summary> /// Called after a publication was removed from an event topic. /// </summary> /// <param name="eventTopic">The event topic.</param> /// <param name="publication">The publication.</param> public override void RemovedPublication(IEventTopicInfo eventTopic, IPublication publication) { this.log.DebugFormat( "Removed publication '{0}.{1}' from topic '{2}'.", publication.Publisher != null ? publication.Publisher.GetType().FullName : "-", publication.EventName, eventTopic.Uri); }
/// <summary> /// Called when an event is fired. /// </summary> /// <param name="eventTopic">The event topic.</param> /// <param name="publication">The publication.</param> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> public override void FiringEvent(IEventTopicInfo eventTopic, IPublication publication, object sender, EventArgs e) { this.log.DebugFormat( "Firing event '{0}'. Invoked by publisher '{1}' with EventArgs '{2}'.", eventTopic.Uri, sender, e); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Creates a publication view of the desired type /// </summary> /// <param name="pub">The DB representation of the publication</param> /// <param name="viewType">The type of view to create </param> /// <returns>A ScripturePublication</returns> /// ------------------------------------------------------------------------------------ protected override ScripturePublication CreatePublicationView(IPublication pub, TeViewType viewType) { ScripturePublication pubControl = base.CreatePublicationView(pub, viewType); if ((viewType & TeViewType.PrintLayout) != 0 && (viewType & TeViewType.Scripture) != 0) m_PrintLayoutView = pubControl; return pubControl; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="T:TeBtPublication"/> class. /// </summary> /// <param name="cache">The database connection</param> /// <param name="stylesheet">The stylesheet to be used for this publication (can be /// different from the one used for drafting, but should probably have all the same /// styles)</param> /// <param name="filterInstance">number used to make filters unique per main window</param> /// <param name="publication">The publication to get the information from (or /// null to keep the defaults)</param> /// <param name="viewType">Type of the view.</param> /// <param name="printDateTime">Date/Time of the printing</param> /// ------------------------------------------------------------------------------------ public TeBtPublication(FdoCache cache, FwStyleSheet stylesheet, int filterInstance, IPublication publication, TeViewType viewType, DateTime printDateTime) : base(stylesheet, filterInstance, publication, viewType, printDateTime) { }
/// <summary> /// Returns whether the publication and subscription match and the event published by the /// publisher will be relayed to the subscriber. /// <para> /// Matches if the event arguments are <see cref="CancelEventArgs"/> that are not yet canceled. /// </para> /// </summary> /// <param name="publication">The publication.</param> /// <param name="subscription">The subscription.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> /// <returns><code>true</code> if event has to be sent to the subscriber.</returns> public bool Match(IPublication publication, ISubscription subscription, EventArgs e) { var cancelEventArgs = e as CancelEventArgs; return(cancelEventArgs != null && !cancelEventArgs.Cancel); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="T:PublicationControl"/> class with /// a single division. /// </summary> /// <param name="divLayoutMgr">The division</param> /// <param name="stylesheet">The stylesheet.</param> /// <param name="publication">The publication that this PublicationControl gets /// it's information from (or null to keep the defaults)</param> /// <param name="printDateTime">The printing date and time</param> /// <param name="fApplyStyleOverrides">if set to <c>true</c>, apply style overrides.</param> /// <param name="fUniformLineSpacing">if set to <c>true</c> apply uniform line spacing, /// rather than proportional spacing.</param> /// <param name="helpTopicProvider">The help topic provider.</param> /// <remarks>Only used for testing</remarks> /// ------------------------------------------------------------------------------------ protected PublicationControl(DivisionLayoutMgr divLayoutMgr, FwStyleSheet stylesheet, IPublication publication, DateTime printDateTime, bool fApplyStyleOverrides, bool fUniformLineSpacing, IHelpTopicProvider helpTopicProvider) : this(stylesheet, publication, printDateTime, fApplyStyleOverrides, fUniformLineSpacing, helpTopicProvider) { AddDivision(divLayoutMgr); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="T:PublicationControl"/> class with /// no divisions. /// </summary> /// <param name="stylesheet">The stylesheet.</param> /// <param name="publication">The publication that this PublicationControl gets /// it's information from (or null to keep the defaults)</param> /// <param name="printDateTime">The print date time.</param> /// <param name="fApplyStyleOverrides">if set to <c>true</c>, apply style overrides.</param> /// <param name="fUniformLineSpacing">if set to <c>true</c> apply uniform line spacing, /// rather than proportional spacing.</param> /// <param name="helpTopicProvider">The help topic provider.</param> /// ------------------------------------------------------------------------------------ public PublicationControl(FwStyleSheet stylesheet, IPublication publication, DateTime printDateTime, bool fApplyStyleOverrides, bool fUniformLineSpacing, IHelpTopicProvider helpTopicProvider) { m_origStylesheet = stylesheet; if (publication != null) // Can be null in tests m_cache = publication.Cache; m_publication = publication; m_printDateTime = printDateTime; m_fApplyStyleOverrides = fApplyStyleOverrides; m_fUniformLineSpacing = fUniformLineSpacing; m_helpTopicProvider = helpTopicProvider; AutoScroll = true; BackColor = SystemColors.Window; components = new System.ComponentModel.Container(); m_Timer = new Timer(this.components); m_sequencer = new MessageSequencer(this); SetInfoFromDB(); PrinterUtils.GetDefaultPrinterDPI(out m_printerDpiX, out m_printerDpiY); m_screenGraphics = new GraphicsManager(this); m_printerGraphics = new GraphicsManager(this); // If view overrides the stylesheet if (fApplyStyleOverrides) { m_origStylesheet.InitStylesheet += new EventHandler(OnInitOriginalStylesheet); ApplyPubOverrides(); } else m_stylesheet = m_origStylesheet; }
/// <summary> /// Called after a publication was created. /// </summary> /// <param name="eventTopic">The event topic.</param> /// <param name="publication">The publication.</param> public override void CreatedPublication(IEventTopicInfo eventTopic, IPublication publication) { }
public bool Match(IPublication publication, ISubscription subscription, EventArgs e) { return(false); }
/// <summary> /// Returns whether the publication and subscription match and the event published by the /// publisher will be relayed to the subscriber. /// <para> /// This is the always the case for global publications. /// </para> /// </summary> /// <param name="publication">The publication.</param> /// <param name="subscription">The subscription.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> /// <returns><code>true</code> if event has to be sent to the subscriber.</returns> public bool Match(IPublication publication, ISubscription subscription, EventArgs e) { // globally all publishers and subscribers match return(true); }
/// <summary> /// Called when the event was fired (processing completed). /// </summary> /// <param name="eventTopic">The event topic.</param> /// <param name="publication">The publication.</param> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> public virtual void FiredEvent(IEventTopicInfo eventTopic, IPublication publication, object sender, EventArgs e) { }
/// <summary> /// Called after a publication was created. /// </summary> /// <param name="eventTopic">The event topic.</param> /// <param name="publication">The publication.</param> public virtual void CreatedPublication(IEventTopicInfo eventTopic, IPublication publication) { }
/// ------------------------------------------------------------------------------------ /// <summary> /// Test class that mocks the PageSetupDlg. /// </summary> /// <param name="pgLayout">The page layout.</param> /// <param name="publication">The publication.</param> /// <param name="division">The division.</param> /// <param name="fIsTrialPub">if set to <c>true</c> view from which this dialog /// was brought up is "Trial Publication".</param> /// <param name="pubPageSizes">The publication page info.</param> /// ------------------------------------------------------------------------------------ public DummyTePageSetupDlg(IPubPageLayout pgLayout, IPublication publication, IPubDivision division, bool fIsTrialPub, List <PubPageInfo> pubPageSizes) : base(pgLayout, null, publication, division, null, null, new DummyApp(), fIsTrialPub, pubPageSizes) { }
/// ------------------------------------------------------------------------------------ /// <summary> /// Called to make the test data for the tests /// </summary> /// ------------------------------------------------------------------------------------ protected override void CreateTestData() { base.CreateTestData(); m_pub = m_scr.PublicationsOC.ToArray()[0]; Assert.IsNotNull(m_pub); m_realStylesheet = new FwStyleSheet(); m_realStylesheet.Init(Cache, m_scr.Hvo, ScriptureTags.kflidStyles); SetFontSizeLineHeightAndSpaceBeforeAfter(m_realStylesheet, ScrStyleNames.Normal, null, 10000, -12000, -1, -1); SetFontSizeLineHeightAndSpaceBeforeAfter(m_realStylesheet, ScrStyleNames.NormalParagraph, ScrStyleNames.Normal, -1, -1, -1, -1); SetFontSizeLineHeightAndSpaceBeforeAfter(m_realStylesheet, ScrStyleNames.NormalFootnoteParagraph, ScrStyleNames.NormalParagraph, 8000, 10000, -1, -1); SetFontSizeLineHeightAndSpaceBeforeAfter(m_realStylesheet, ScrStyleNames.IntroParagraph, ScrStyleNames.NormalParagraph, 9000, -11000, -1, -1); SetFontSizeLineHeightAndSpaceBeforeAfter(m_realStylesheet, ScrStyleNames.IntroSectionHead, ScrStyleNames.SectionHead, 8000, -10000, -1, -1); SetFontSizeLineHeightAndSpaceBeforeAfter(m_realStylesheet, ScrStyleNames.SectionHead, ScrStyleNames.NormalParagraph, 9000, -1, 8000, 4000); SetFontSizeLineHeightAndSpaceBeforeAfter(m_realStylesheet, ScrStyleNames.MainBookTitle, ScrStyleNames.SectionHead, 20000, -24000, 36000, 12000); m_pub.DivisionsOS.Add(Cache.ServiceLocator.GetInstance<IPubDivisionFactory>().Create()); }
/// <summary> /// Called after a publication was added to an event topic. /// </summary> /// <param name="eventTopic">The event topic.</param> /// <param name="publication">The publication.</param> public override void AddedPublication(IEventTopicInfo eventTopic, IPublication publication) { using (TextWriter writer = new StringWriter()) { foreach (IPublicationMatcher publicationMatcher in publication.PublicationMatchers) { publicationMatcher.DescribeTo(writer); writer.Write(", "); } this.log.DebugFormat( "Added publication '{0}.{1}' to topic '{2}' with matchers '{3}'.", publication.Publisher != null ? publication.Publisher.GetType().FullName : "-", publication.EventName, eventTopic.Uri, writer); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="T:DummyScripturePublication"/> class. /// </summary> /// <param name="cache">The database connection</param> /// <param name="stylesheet">The stylesheet to be used for this publication (can be /// different from the one used for drafting, but should probably have all the same /// styles)</param> /// <param name="filterInstance">number used to make filters unique per main window</param> /// <param name="publication">The publication to get the information from (or /// null to keep the defaults)</param> /// <param name="viewType">Type of the view.</param> /// <param name="printDateTime">Date/Time of the printing</param> /// ------------------------------------------------------------------------------------ protected DummyScripturePublication(FdoCache cache, FwStyleSheet stylesheet, int filterInstance, IPublication publication, TeViewType viewType, DateTime printDateTime) : base(stylesheet, filterInstance, publication, viewType, printDateTime, null, null, cache.DefaultVernWs) { }
/// <summary> /// Called after the event was relayed from the publication to the subscribers. /// </summary> /// <param name="eventTopic">The event topic.</param> /// <param name="publication">The publication.</param> /// <param name="subscription">The subscription.</param> /// <param name="handler">The handler.</param> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> public override void RelayedEvent(IEventTopicInfo eventTopic, IPublication publication, ISubscription subscription, IHandler handler, object sender, EventArgs e) { this.log.DebugFormat( "Relayed event '{6}' from publisher '{0}' [{1}] to subscriber '{2}' [{3}] with EventArgs '{4}' with handler '{5}'.", publication.Publisher, publication.Publisher is INamedItem ? ((INamedItem)publication.Publisher).EventBrokerItemName : string.Empty, subscription.Subscriber, subscription.Subscriber is INamedItem ? ((INamedItem)subscription.Subscriber).EventBrokerItemName : string.Empty, e, handler, eventTopic.Uri); }
/// <summary> /// Called after a publication was removed from an event topic. /// </summary> /// <param name="eventTopic">The event topic. Null if removed by code.</param> /// <param name="publication">The publication.</param> public virtual void RemovedPublication(IEventTopicInfo eventTopic, IPublication publication) { }
public void SkippedEvent(IEventTopicInfo eventTopic, IPublication publication, ISubscription subscription, object sender, EventArgs e) { this.log.AppendLine("SkippedEvent"); }
/// <summary> /// Called after the event was relayed from the publication to the subscribers. /// </summary> /// <param name="eventTopic">The event topic.</param> /// <param name="publication">The publication.</param> /// <param name="subscription">The subscription.</param> /// <param name="handler">The handler.</param> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> public virtual void RelayedEvent(IEventTopicInfo eventTopic, IPublication publication, ISubscription subscription, IHandler handler, object sender, EventArgs e) { }
public BuyOrderServices(SocialNetworkDeveloperContext context, IMapper mapper, IEmail email, IUser user, IPublication publication, ITwilio twilioServices) { _context = context; _mapper = mapper; _emailServices = email; _userServices = user; _publicationServices = publication; _twilioServices = twilioServices; }
public PublicationService(IPublication publication, IUser user, ITopicService topic) { _publication = publication; _user = user; _topic = topic; }