コード例 #1
0
        /// <summary>
        /// Handles the specified intent.
        /// </summary>
        public void HandleIntent(IIntent intent, OpenTabOptions options)
        {
            // Handle the intent.
            var tabIntent = (IItemDetailsTabIntent)intent;
            var location  = mSubsettingExampleLocations.GeneratePathToItem(tabIntent.Id, tabIntent.Source);

            ItemUrl = location.ToString();
        }
コード例 #2
0
        /// <summary>
        /// Handles the specified intent.
        /// </summary>
        public void HandleIntent(IIntent intent, OpenTabOptions options)
        {
            // Handle the intent.
            var tabIntent = (ISubsettingTabIntent)intent;

            // Note: This example does not use the Data property, but in general
            // an intent can have any content, and all of that content is
            // available here.
            var intentData = tabIntent.Data;
        }
コード例 #3
0
        private void ProcessJsonIntent(string data)
        {
            var jsonIntent = mJsonSerializerWrapper.Deserialize <JsonSubsetIntent>(data);

            var dataSource = mDataSourcesAndSchema.DataSources.SingleOrDefault(x => x.Id.Equals(jsonIntent.DataSourceId));

            if (dataSource == null)
            {
                throw new ArgumentException(string.Format(CultureInfo.InvariantCulture,
                                                          "Unable to find datasource with id '{0}'",
                                                          jsonIntent.DataSourceId));
            }

            var token = new ExternalDataSubsetIdentifier(jsonIntent.Token, jsonIntent.SubsetName);

            IIntent intent;

            // Switch based on the string defined in the DomainTools.html
            switch (jsonIntent.PortalIntentToLaunch)
            {
            case "VisualQuery":
                var networkSearchConfig = mNetworkSearchConfigBuilder
                                          .StartNew()
                                          .SetDataSource(dataSource)
                                          .SetExternalDataSubsetIdentifier(token)
                                          .Build();

                intent = new OpenNetworkSearchWithConfig(networkSearchConfig, false);
                break;

            case "Browse":
                var exploreConfig = mExploreConfigBuilder
                                    .StartNew()
                                    .SetDataSource(dataSource)
                                    .SetExternalDataSubsetIdentifier(token)
                                    .Build();

                intent = mExplorationIntentFactory.CreateExploreIntent(exploreConfig);
                break;

            default:
                throw new ArgumentException("Unknown portal intent to launch: " + jsonIntent.PortalIntentToLaunch);
            }

            // Open the tab next to the current one
            var openTabOptions = new OpenTabOptions
            {
                Location = OpenTabLocation.OpenNearCurrent
            };

            mIntentManager.Run(intent, openTabOptions);
        }
コード例 #4
0
        /// <inheritdoc />
        public void HandleIntent(IIntent intent, OpenTabOptions options)
        {
            // Handle the intent
            var    tabIntent = (IDomainToolsTabIntent)intent;
            string url       = mBaseURL;

            if (tabIntent.Type != null)
            {
                url += "?type=" + tabIntent.Type;
                if (tabIntent.Query != null)
                {
                    url += "&query=" + tabIntent.Query;
                }
            }
            PageLocation = url;
            SetAsViewModelForView(View);
        }
コード例 #5
0
        //Launch Daod Intent in browse mode
        private void BrowseSuccess(IExternalDataSubsetIdentifier t, IExploreConfig exploreConfig)
        {
            var newConfig = mExploreConfigBuilder
                            .StartNew()
                            .SetDataSource(exploreConfig.DataSource)
                            .SetExternalDataSubsetIdentifier(t)
                            .Build();

            var browseSearchIntent = mExplorationIntentFactory.CreateExploreIntent(newConfig);
            // Open the tab next to the current one
            var openTabOptions = new OpenTabOptions
            {
                Location = OpenTabLocation.OpenNearCurrent
            };

            mIntentManager.Run(browseSearchIntent, openTabOptions);
        }
コード例 #6
0
        //Launch Daod Intent in visual query mode
        private void VQSuccess(IExternalDataSubsetIdentifier t, IExploreConfig exploreConfig)
        {
            var networkSearchConfig = mNetworkSearchConfigBuilder
                                      .StartNew()
                                      .SetDataSource(exploreConfig.DataSource)
                                      .SetExternalDataSubsetIdentifier(t)
                                      .Build();

            var visualQuerySearchIntent = new OpenNetworkSearchWithConfig(networkSearchConfig, false);
            // Open the tab next to the current one
            var openTabOptions = new OpenTabOptions
            {
                Location = OpenTabLocation.OpenNearCurrent
            };

            mIntentManager.Run(visualQuerySearchIntent, openTabOptions);
        }
コード例 #7
0
        private void ProcessJsonIntent(string data)
        {
            // We are expecting to receive strings that represent serialized
            // JsonSubsetIntent classes.
            var jsonIntent = mJsonSerializerWrapper.Deserialize<JsonSubsetIntent>(data);

            // Determine which data source the intent refers to.
            var dataSource = mDataSourcesAndSchema.DataSources.SingleOrDefault(x => x.Id.Equals(jsonIntent.DataSourceId));

            if (dataSource == null)
            {
                // No data source matched the intent, so throw an exception.
                throw new ArgumentException(string.Format(CultureInfo.InvariantCulture,
                                                          "Unable to find data source with ID '{0}'",
                                                          jsonIntent.DataSourceId));
            }

            // Generate a subset identifier from the token and the name in the
            // intent. The identifier ensures that any Browse or Visual Query
            // operation runs over the subset that the token defines. The name
            // is displayed to the user to identify which subset they are
            // working with.
            var externalDataSubsetIdentifier = new ExternalDataSubsetIdentifier(jsonIntent.Token, jsonIntent.SubsetName);

            IIntent intent;

            // Generate an appropriate intent, according to the analytic
            // operation that the user selected in SubsettingHtml.html.
            switch (jsonIntent.PortalIntentToLaunch)
            {
                case VisualQueryIntentType:
                    var networkSearchConfig = mNetworkSearchConfigBuilder
                        .StartNew()
                        .SetDataSource(dataSource)
                        .SetExternalDataSubsetIdentifier(externalDataSubsetIdentifier)
                        .Build();

                    intent = new OpenNetworkSearchWithConfig(networkSearchConfig, false);
                    break;

                case BrowseIntentType:
                    var exploreConfig = mExploreConfigBuilder
                        .StartNew()
                        .SetDataSource(dataSource)
                        .SetExternalDataSubsetIdentifier(externalDataSubsetIdentifier)
                        .Build();

                    intent = mExplorationIntentFactory.CreateExploreIntent(exploreConfig);
                    break;
                default:
                    throw new ArgumentException("Unknown Portal intent: " + jsonIntent.PortalIntentToLaunch);
            }

            // Open the tab for the results, next to the current tab.
            var openTabOptions = new OpenTabOptions
                                     {
                                         Location = OpenTabLocation.OpenNearCurrent
                                     };

            // Fire off the intent.
            mIntentManager.Run(intent, openTabOptions);
        }
コード例 #8
0
        private void RunIntentNearCurrent(IIntent intent)
        {
            // Open the tab next to the current one
            var openTabOptions = new OpenTabOptions
            {
                Location = OpenTabLocation.OpenNearCurrent
            };

            mIntentManager.Run(intent, openTabOptions);
        }
コード例 #9
0
 /// <inheritdoc />
 public void HandleIntent(IIntent intent, OpenTabOptions opts)
 {
     PageLocation = mBaseURL;
     SetAsViewModelForView(View);
 }
        private void ProcessJsonIntent(string data)
        {
            // We are expecting to receive strings that represent serialized
            // JsonSubsetIntent classes.
            var jsonIntent = mJsonSerializerWrapper.Deserialize <JsonSubsetIntent>(data);

            // Determine which data source the intent refers to.
            var dataSource = mDataSourcesAndSchema.DataSources.SingleOrDefault(x => x.Id.Equals(jsonIntent.DataSourceId));

            if (dataSource == null)
            {
                // No data source matched the intent, so throw an exception.
                throw new ArgumentException(string.Format(CultureInfo.InvariantCulture,
                                                          "Unable to find data source with ID '{0}'",
                                                          jsonIntent.DataSourceId));
            }

            // Generate a subset identifier from the token and the name in the
            // intent. The identifier ensures that any Browse or Visual Query
            // operation runs over the subset that the token defines. The name
            // is displayed to the user to identify which subset they are
            // working with.
            var externalDataSubsetIdentifier = new ExternalDataSubsetIdentifier(jsonIntent.Token, jsonIntent.SubsetName);

            IIntent intent;

            // Generate an appropriate intent, according to the analytic
            // operation that the user selected in SubsettingHtml.html.
            switch (jsonIntent.PortalIntentToLaunch)
            {
            case VisualQueryIntentType:
                var networkSearchConfig = mNetworkSearchConfigBuilder
                                          .StartNew()
                                          .SetDataSource(dataSource)
                                          .SetExternalDataSubsetIdentifier(externalDataSubsetIdentifier)
                                          .Build();

                intent = new OpenNetworkSearchWithConfig(networkSearchConfig, false);
                break;

            case BrowseIntentType:
                var exploreConfig = mExploreConfigBuilder
                                    .StartNew()
                                    .SetDataSource(dataSource)
                                    .SetExternalDataSubsetIdentifier(externalDataSubsetIdentifier)
                                    .Build();

                intent = mExplorationIntentFactory.CreateExploreIntent(exploreConfig);
                break;

            default:
                throw new ArgumentException("Unknown Portal intent: " + jsonIntent.PortalIntentToLaunch);
            }

            // Open the tab for the results, next to the current tab.
            var openTabOptions = new OpenTabOptions
            {
                Location = OpenTabLocation.OpenNearCurrent
            };

            // Fire off the intent.
            mIntentManager.Run(intent, openTabOptions);
        }
コード例 #11
0
        //Launch Daod Intent in visual query mode
        private void VQSuccess(IExternalDataSubsetIdentifier t, IExploreConfig exploreConfig)
        {
            var networkSearchConfig = mNetworkSearchConfigBuilder
                .StartNew()
                .SetDataSource(exploreConfig.DataSource)
                .SetExternalDataSubsetIdentifier(t)
                .Build();

            var visualQuerySearchIntent = new OpenNetworkSearchWithConfig(networkSearchConfig, false);
            // Open the tab next to the current one
            var openTabOptions = new OpenTabOptions
                                    {
                                        Location = OpenTabLocation.OpenNearCurrent
                                    };

            mIntentManager.Run(visualQuerySearchIntent, openTabOptions);
        }
コード例 #12
0
        //Launch Daod Intent in property view mode
        private void PBSSuccess(IExternalDataSubsetIdentifier t, IExploreConfig exploreConfig)
        {
            var newConfig = mExploreConfigBuilder
                .StartNew()
                .SetDataSource(exploreConfig.DataSource)
                .SetExternalDataSubsetIdentifier(t)
                .Build();

            var propertySearchIntent = mExplorationIntentFactory.CreatePropertySearchIntent(newConfig);
            // Open the tab next to the current one
            var openTabOptions = new OpenTabOptions
                                    {
                                        Location = OpenTabLocation.OpenNearCurrent
                                    };

            mIntentManager.Run(propertySearchIntent, openTabOptions);
        }
コード例 #13
0
        private void ProcessJsonIntent(string data)
        {
            var jsonIntent = mJsonSerializerWrapper.Deserialize<JsonSubsetIntent>(data);

            var dataSource = mDataSourcesAndSchema.DataSources.SingleOrDefault(x => x.Id.Equals(jsonIntent.DataSourceId));

            if (dataSource == null)
            {
                throw new ArgumentException(string.Format(CultureInfo.InvariantCulture,
                                                          "Unable to find datasource with id '{0}'",
                                                          jsonIntent.DataSourceId));
            }

            var token = new ExternalDataSubsetIdentifier(jsonIntent.Token, jsonIntent.SubsetName);

            IIntent intent;

            // Switch based on the string defined in the DomainTools.html
            switch (jsonIntent.PortalIntentToLaunch)
            {
                case "VisualQuery":
                    var networkSearchConfig = mNetworkSearchConfigBuilder
                        .StartNew()
                        .SetDataSource(dataSource)
                        .SetExternalDataSubsetIdentifier(token)
                        .Build();

                    intent = new OpenNetworkSearchWithConfig(networkSearchConfig, false);
                    break;

                case "Browse":
                    var exploreConfig = mExploreConfigBuilder
                        .StartNew()
                        .SetDataSource(dataSource)
                        .SetExternalDataSubsetIdentifier(token)
                        .Build();

                    intent = mExplorationIntentFactory.CreateExploreIntent(exploreConfig);
                    break;
                default:
                    throw new ArgumentException("Unknown portal intent to launch: " + jsonIntent.PortalIntentToLaunch);
            }

            // Open the tab next to the current one
            var openTabOptions = new OpenTabOptions
                                     {
                                         Location = OpenTabLocation.OpenNearCurrent
                                     };

            mIntentManager.Run(intent, openTabOptions);
        }