Esempio n. 1
0
        /// <summary>
        /// Send the event id to Project Oxford and get the related documents of that specific event.
        /// </summary>
        /// <param name="eventId">The event id to be sent to service.</param>
        /// <param name="continuToken">The continuation token to continue to get more results.</param>
        /// <returns>The documents related to the specific event.</returns>
        private async Task <Segment <Document> > SendAndGetEventDetail(string eventId, string continuToken = null)
        {
            MainWindow window          = (MainWindow)Application.Current.MainWindow;
            string     subscriptionKey = window.ScenarioControl.SubscriptionKey;

            // -----------------------------------------------------------------------
            // KEY SAMPLE CODE STARTS HERE
            // -----------------------------------------------------------------------

            window.Log("EventKnowledgeServiceClient is created");

            //
            // Create Project Oxford EventKnowledge API Service client
            //
            EventKnowledgeServiceClient eventKnowledgeServiceClient = new EventKnowledgeServiceClient(subscriptionKey);

            window.Log("Calling EventKnowledgeServiceClient.GetEventDetail()...");

            //
            // Get the event detail by event id
            //
            Segment <Document> getEventDetailResult = await eventKnowledgeServiceClient.GetEventDetailSegmentedAsync(eventId, continuationToken : continuToken);

            return(getEventDetailResult);

            // -----------------------------------------------------------------------
            // KEY SAMPLE CODE ENDS HERE
            // -----------------------------------------------------------------------
        }
Esempio n. 2
0
        /// <summary>
        /// Send the date to Project Oxford and get the hot events on that date.
        /// </summary>
        /// <param name="dateStd">The date to be sent to service.</param>
        /// <param name="continuToken">The continuation token to continue to get more results.</param>
        /// <returns>The hot events on the specific date.</returns>
        private async Task <Segment <Event> > SendAndGetHotEvents(DateTimeOffset dateStd, string continuToken = null)
        {
            MainWindow window          = (MainWindow)Application.Current.MainWindow;
            string     subscriptionKey = window.ScenarioControl.SubscriptionKey;

            // -----------------------------------------------------------------------
            // KEY SAMPLE CODE STARTS HERE
            // -----------------------------------------------------------------------

            window.Log("EventKnowledgeServiceClient is created");

            //
            // Create Project Oxford EventKnowledge API Service client
            //
            EventKnowledgeServiceClient eventKnowledgeServiceClient = new EventKnowledgeServiceClient(subscriptionKey);

            window.Log("Calling EventKnowledgeServiceClient.GetHotEventsSegmentedAsync()...");

            //
            // Get the hot events by date
            //
            Segment <Event> getHotEventsResult = await eventKnowledgeServiceClient.GetHotEventsSegmentedAsync(dateStd, continuationToken : continuToken);

            return(getHotEventsResult);


            // -----------------------------------------------------------------------
            // KEY SAMPLE CODE ENDS HERE
            // -----------------------------------------------------------------------
        }