Contains the arguments needed to asynchronously get the network.
Inheritance: Object
        BackgroundWorker_DoWork
        (
            object sender,
            DoWorkEventArgs e
        )
        {
            Debug.Assert(sender is BackgroundWorker);

            BackgroundWorker oBackgroundWorker = (BackgroundWorker)sender;

            Debug.Assert(e.Argument is GetNetworkAsyncArgs);

            GetNetworkAsyncArgs oGetNetworkAsyncArgs =
                (GetNetworkAsyncArgs)e.Argument;

            try
            {
                e.Result = GetRelatedTagsInternal(oGetNetworkAsyncArgs.Tag,
                                                  oGetNetworkAsyncArgs.WhatToInclude,
                                                  oGetNetworkAsyncArgs.NetworkLevel,
                                                  oGetNetworkAsyncArgs.ApiKey);
            }
            catch (CancellationPendingException)
            {
                e.Cancel = true;
            }
        }
        GetNetworkAsync
        (
            String searchTerm,
            WhatToInclude whatToInclude,
            Int32 maximumVideos
        )
        {
            Debug.Assert(!String.IsNullOrEmpty(searchTerm));
            Debug.Assert(maximumVideos > 0);
            AssertValid();

            const String MethodName = "GetNetworkAsync";

            CheckIsBusy(MethodName);

            // Wrap the arguments in an object that can be passed to
            // BackgroundWorker.RunWorkerAsync().

            GetNetworkAsyncArgs oGetNetworkAsyncArgs = new GetNetworkAsyncArgs();

            oGetNetworkAsyncArgs.SearchTerm    = searchTerm;
            oGetNetworkAsyncArgs.WhatToInclude = whatToInclude;
            oGetNetworkAsyncArgs.MaximumVideos = maximumVideos;

            m_oBackgroundWorker.RunWorkerAsync(oGetNetworkAsyncArgs);
        }
        GetNetworkAsync
        (
            String tag,
            WhatToInclude whatToInclude,
            NetworkLevel networkLevel,
            String apiKey
        )
        {
            Debug.Assert(!String.IsNullOrEmpty(tag));

            Debug.Assert(networkLevel == NetworkLevel.One ||
                         networkLevel == NetworkLevel.OnePointFive ||
                         networkLevel == NetworkLevel.Two);

            Debug.Assert(!String.IsNullOrEmpty(apiKey));
            AssertValid();

            const String MethodName = "GetNetworkAsync";

            CheckIsBusy(MethodName);

            // Wrap the arguments in an object that can be passed to
            // BackgroundWorker.RunWorkerAsync().

            GetNetworkAsyncArgs oGetNetworkAsyncArgs = new GetNetworkAsyncArgs();

            oGetNetworkAsyncArgs.Tag           = tag;
            oGetNetworkAsyncArgs.NetworkLevel  = networkLevel;
            oGetNetworkAsyncArgs.WhatToInclude = whatToInclude;
            oGetNetworkAsyncArgs.ApiKey        = apiKey;

            m_oBackgroundWorker.RunWorkerAsync(oGetNetworkAsyncArgs);
        }
        BackgroundWorker_DoWork
        (
            object sender,
            DoWorkEventArgs e
        )
        {
            Debug.Assert(sender is BackgroundWorker);

            BackgroundWorker oBackgroundWorker = (BackgroundWorker)sender;

            Debug.Assert(e.Argument is GetNetworkAsyncArgs);

            GetNetworkAsyncArgs oGetNetworkAsyncArgs =
                (GetNetworkAsyncArgs)e.Argument;

            try
            {
                e.Result = GetVideoNetworkInternal(oGetNetworkAsyncArgs.SearchTerm,
                                                   oGetNetworkAsyncArgs.WhatToInclude,
                                                   oGetNetworkAsyncArgs.MaximumVideos);
            }
            catch (CancellationPendingException)
            {
                e.Cancel = true;
            }
        }
Esempio n. 5
0
        BackgroundWorker_DoWork
        (
            object sender,
            DoWorkEventArgs e
        )
        {
            Debug.Assert(e.Argument is GetNetworkAsyncArgs);

            GetNetworkAsyncArgs oGetNetworkAsyncArgs =
                (GetNetworkAsyncArgs)e.Argument;

            try
            {
                e.Result = GetNetworkInternal(
                    oGetNetworkAsyncArgs.StatusCriteria,
                    oGetNetworkAsyncArgs.ExpandStatusUrls,
                    oGetNetworkAsyncArgs.GraphServerUserName,
                    oGetNetworkAsyncArgs.GraphServerPassword
                    );
            }
            catch (CancellationPendingException)
            {
                e.Cancel = true;
            }
        }
Esempio n. 6
0
        GetNetworkAsync
        (
            String searchTerm,
            DateTime maximumStatusDateUtc,
            Int32 maximumStatusesGoingBackward,
            Boolean expandStatusUrls,
            String graphServerUserName,
            String graphServerPassword
        )
        {
            Debug.Assert(!String.IsNullOrEmpty(searchTerm));
            Debug.Assert(maximumStatusesGoingBackward > 0);
            Debug.Assert(!String.IsNullOrEmpty(graphServerUserName));
            Debug.Assert(!String.IsNullOrEmpty(graphServerPassword));
            AssertValid();

            const String MethodName = "GetNetworkAsync";

            CheckIsBusy(MethodName);

            // Wrap the arguments in an object that can be passed to
            // BackgroundWorker.RunWorkerAsync().

            GetNetworkAsyncArgs oGetNetworkAsyncArgs = new GetNetworkAsyncArgs();

            oGetNetworkAsyncArgs.StatusCriteria = new StatusCriteria(
                searchTerm, maximumStatusDateUtc, maximumStatusesGoingBackward);

            oGetNetworkAsyncArgs.ExpandStatusUrls    = expandStatusUrls;
            oGetNetworkAsyncArgs.GraphServerUserName = graphServerUserName;
            oGetNetworkAsyncArgs.GraphServerPassword = graphServerPassword;

            m_oBackgroundWorker.RunWorkerAsync(oGetNetworkAsyncArgs);
        }
        BackgroundWorker_DoWork
        (
            object sender,
            DoWorkEventArgs e
        )
        {
            Debug.Assert(sender is BackgroundWorker);

            BackgroundWorker oBackgroundWorker = (BackgroundWorker)sender;

            Debug.Assert(e.Argument is GetNetworkAsyncArgs);

            GetNetworkAsyncArgs oGetNetworkAsyncArgs =
                (GetNetworkAsyncArgs)e.Argument;

            try
            {
                e.Result = GetUserNetworkInternal(
                    oGetNetworkAsyncArgs.UserNameToAnalyze,
                    oGetNetworkAsyncArgs.WhatToInclude,
                    oGetNetworkAsyncArgs.NetworkLevel,
                    oGetNetworkAsyncArgs.MaximumPeoplePerRequest);
            }
            catch (CancellationPendingException)
            {
                e.Cancel = true;
            }
        }
        GetNetworkAsync
        (
            String userNameToAnalyze,
            WhatToInclude whatToInclude,
            NetworkLevel networkLevel,
            Int32 maximumPeoplePerRequest
        )
        {
            Debug.Assert(!String.IsNullOrEmpty(userNameToAnalyze));

            Debug.Assert(networkLevel == NetworkLevel.One ||
                         networkLevel == NetworkLevel.OnePointFive ||
                         networkLevel == NetworkLevel.Two);

            Debug.Assert(maximumPeoplePerRequest > 0);

            AssertValid();

            const String MethodName = "GetNetworkAsync";

            CheckIsBusy(MethodName);

            // Wrap the arguments in an object that can be passed to
            // BackgroundWorker.RunWorkerAsync().

            GetNetworkAsyncArgs oGetNetworkAsyncArgs = new GetNetworkAsyncArgs();

            oGetNetworkAsyncArgs.UserNameToAnalyze       = userNameToAnalyze;
            oGetNetworkAsyncArgs.WhatToInclude           = whatToInclude;
            oGetNetworkAsyncArgs.NetworkLevel            = networkLevel;
            oGetNetworkAsyncArgs.MaximumPeoplePerRequest = maximumPeoplePerRequest;

            m_oBackgroundWorker.RunWorkerAsync(oGetNetworkAsyncArgs);
        }
Esempio n. 9
0
        GetNetworkAsync
        (
            List<NetworkType> oEdgeType,
            bool bIncludeMe,
            DateTime oStartDate,
            DateTime oEndDate,
            bool bDownloadFirstPosts = false,
            bool bDownloadBetweenDates = false,
            bool bEgoTimeline = false,
            bool bFriendsTimeline = false,
            int iNrOfFirstPosts = 1000,
            bool bLimitCommentsLikes = false,
            int iNrLimit = 1000,
            bool bGetTooltips = true
        )
        {
            AssertValid();
            const string MethodName = "GetNetworkAsync";
            CheckIsBusy(MethodName);

            GetNetworkAsyncArgs oGetNetworkAsyncArgs = new GetNetworkAsyncArgs();
            oGetNetworkAsyncArgs.Attributes = dialogAttributes;
            oGetNetworkAsyncArgs.EdgeType = oEdgeType;
            oGetNetworkAsyncArgs.DownloadFirstPosts = bDownloadFirstPosts;
            oGetNetworkAsyncArgs.DownloadBetweenDates = bDownloadBetweenDates;
            oGetNetworkAsyncArgs.EgoTimeline = bEgoTimeline;
            oGetNetworkAsyncArgs.FriendsTimeline = bFriendsTimeline;
            oGetNetworkAsyncArgs.NrOfFirstPosts = iNrOfFirstPosts;
            oGetNetworkAsyncArgs.StartDate = oStartDate;
            oGetNetworkAsyncArgs.EndDate = oEndDate;
            oGetNetworkAsyncArgs.LimitCommentsLikes = bLimitCommentsLikes;
            oGetNetworkAsyncArgs.Limit = iNrLimit;
            oGetNetworkAsyncArgs.GetTooltips = bGetTooltips;
            oGetNetworkAsyncArgs.IncludeMe = bIncludeMe;

            m_oBackgroundWorker.RunWorkerAsync(oGetNetworkAsyncArgs);
        }
        //*************************************************************************
        //  Method: GetNetworkAsync()
        //
        /// <summary>
        /// Asynchronously gets an undirected network of related YouTube videos.
        /// </summary>
        ///
        /// <param name="searchTerm">
        /// The term to search for.
        /// </param>
        ///
        /// <param name="whatToInclude">
        /// Specifies what should be included in the network.
        /// </param>
        ///
        /// <param name="maximumVideos">
        /// Maximum number of videos to request, or Int32.MaxValue for no limit.
        /// </param>
        ///
        /// <remarks>
        /// When the analysis completes, the <see
        /// cref="HttpNetworkAnalyzerBase.AnalysisCompleted" /> event fires.  The
        /// <see cref="RunWorkerCompletedEventArgs.Result" /> property will return
        /// an XmlDocument containing the network as GraphML.
        ///
        /// <para>
        /// To cancel the analysis, call <see
        /// cref="HttpNetworkAnalyzerBase.CancelAsync" />.
        /// </para>
        ///
        /// </remarks>
        //*************************************************************************
        public void GetNetworkAsync(
            String searchTerm,
            WhatToInclude whatToInclude,
            Int32 maximumVideos
            )
        {
            Debug.Assert( !String.IsNullOrEmpty(searchTerm) );
            Debug.Assert(maximumVideos > 0);
            AssertValid();

            const String MethodName = "GetNetworkAsync";
            CheckIsBusy(MethodName);

            // Wrap the arguments in an object that can be passed to
            // BackgroundWorker.RunWorkerAsync().

            GetNetworkAsyncArgs oGetNetworkAsyncArgs = new GetNetworkAsyncArgs();

            oGetNetworkAsyncArgs.SearchTerm = searchTerm;
            oGetNetworkAsyncArgs.WhatToInclude = whatToInclude;
            oGetNetworkAsyncArgs.MaximumVideos = maximumVideos;

            m_oBackgroundWorker.RunWorkerAsync(oGetNetworkAsyncArgs);
        }
        //*************************************************************************
        //  Method: GetNetworkAsync()
        //
        /// <summary>
        /// Asynchronously gets an undirected network of Flickr tags related to a
        /// specified tag.
        /// </summary>
        ///
        /// <param name="tag">
        /// Tag to get related tags for.
        /// </param>
        ///
        /// <param name="whatToInclude">
        /// Specifies what should be included in the network.
        /// </param>
        ///
        /// <param name="networkLevel">
        /// Network level to include.
        /// </param>
        ///
        /// <param name="apiKey">
        /// Flickr API key.
        /// </param>
        ///
        /// <remarks>
        /// When the analysis completes, the <see
        /// cref="HttpNetworkAnalyzerBase.AnalysisCompleted" /> event fires.  The
        /// <see cref="RunWorkerCompletedEventArgs.Result" /> property will return
        /// an XmlDocument containing the network as GraphML.
        ///
        /// <para>
        /// To cancel the analysis, call <see
        /// cref="HttpNetworkAnalyzerBase.CancelAsync" />.
        /// </para>
        ///
        /// </remarks>
        //*************************************************************************
        public void GetNetworkAsync(
            String tag,
            WhatToInclude whatToInclude,
            NetworkLevel networkLevel,
            String apiKey
            )
        {
            Debug.Assert( !String.IsNullOrEmpty(tag) );

            Debug.Assert(networkLevel == NetworkLevel.One ||
            networkLevel == NetworkLevel.OnePointFive ||
            networkLevel == NetworkLevel.Two);

            Debug.Assert( !String.IsNullOrEmpty(apiKey) );
            AssertValid();

            const String MethodName = "GetNetworkAsync";
            CheckIsBusy(MethodName);

            // Wrap the arguments in an object that can be passed to
            // BackgroundWorker.RunWorkerAsync().

            GetNetworkAsyncArgs oGetNetworkAsyncArgs = new GetNetworkAsyncArgs();

            oGetNetworkAsyncArgs.Tag = tag;
            oGetNetworkAsyncArgs.NetworkLevel = networkLevel;
            oGetNetworkAsyncArgs.WhatToInclude = whatToInclude;
            oGetNetworkAsyncArgs.ApiKey = apiKey;

            m_oBackgroundWorker.RunWorkerAsync(oGetNetworkAsyncArgs);
        }
    GetNetworkAsync
    (
        String searchTerm,
        DateTime minimumStatusDateUtc,
        DateTime maximumStatusDateUtc,
        Boolean expandStatusUrls,
        String graphServerUserName,
        String graphServerPassword
    )
    {
        Debug.Assert( !String.IsNullOrEmpty(searchTerm) );
        Debug.Assert(maximumStatusDateUtc >= minimumStatusDateUtc);
        Debug.Assert( !String.IsNullOrEmpty(graphServerUserName) );
        Debug.Assert( !String.IsNullOrEmpty(graphServerPassword) );
        AssertValid();

        const String MethodName = "GetNetworkAsync";
        CheckIsBusy(MethodName);

        // Wrap the arguments in an object that can be passed to
        // BackgroundWorker.RunWorkerAsync().

        GetNetworkAsyncArgs oGetNetworkAsyncArgs = new GetNetworkAsyncArgs();

        oGetNetworkAsyncArgs.SearchTerm = searchTerm;
        oGetNetworkAsyncArgs.MinimumStatusDateUtc = minimumStatusDateUtc;
        oGetNetworkAsyncArgs.MaximumStatusDateUtc = maximumStatusDateUtc;
        oGetNetworkAsyncArgs.ExpandStatusUrls = expandStatusUrls;
        oGetNetworkAsyncArgs.GraphServerUserName = graphServerUserName;
        oGetNetworkAsyncArgs.GraphServerPassword = graphServerPassword;

        m_oBackgroundWorker.RunWorkerAsync(oGetNetworkAsyncArgs);
    }
    GetNetworkAsync
    (
        Boolean useListName,
        String listName,
        ICollection<String> screenNames,
        WhatToInclude whatToInclude
    )
    {
        Debug.Assert( !useListName || !String.IsNullOrEmpty(listName) );
        Debug.Assert(useListName || screenNames != null);
        AssertValid();

        const String MethodName = "GetNetworkAsync";
        CheckIsBusy(MethodName);

        // Wrap the arguments in an object that can be passed to
        // BackgroundWorker.RunWorkerAsync().

        GetNetworkAsyncArgs oGetNetworkAsyncArgs = new GetNetworkAsyncArgs();

        oGetNetworkAsyncArgs.UseListName = useListName;
        oGetNetworkAsyncArgs.ListName = listName;
        oGetNetworkAsyncArgs.ScreenNames = screenNames;
        oGetNetworkAsyncArgs.WhatToInclude = whatToInclude;

        m_oBackgroundWorker.RunWorkerAsync(oGetNetworkAsyncArgs);
    }
    GetNetworkAsync
    (
        String screenName,
        WhatToInclude whatToInclude,
        NetworkLevel networkLevel,
        Int32 maximumPerRequest,
        String apiKey
    )
    {
        Debug.Assert( !String.IsNullOrEmpty(screenName) );

        Debug.Assert(networkLevel == NetworkLevel.One ||
            networkLevel == NetworkLevel.OnePointFive ||
            networkLevel == NetworkLevel.Two);

        Debug.Assert(maximumPerRequest > 0);
        Debug.Assert( !String.IsNullOrEmpty(apiKey) );
        AssertValid();

        const String MethodName = "GetNetworkAsync";
        CheckIsBusy(MethodName);

        // Wrap the arguments in an object that can be passed to
        // BackgroundWorker.RunWorkerAsync().

        GetNetworkAsyncArgs oGetNetworkAsyncArgs = new GetNetworkAsyncArgs();

        oGetNetworkAsyncArgs.ScreenName = screenName;
        oGetNetworkAsyncArgs.WhatToInclude = whatToInclude;
        oGetNetworkAsyncArgs.NetworkLevel = networkLevel;
        oGetNetworkAsyncArgs.MaximumPerRequest = maximumPerRequest;
        oGetNetworkAsyncArgs.ApiKey = apiKey;

        m_oBackgroundWorker.RunWorkerAsync(oGetNetworkAsyncArgs);
    }
        GetNetworkAsync
        (
            String s_accessToken,            
            List<NetworkType> oEdgeType,
            bool bDownloadFromPostToPost,
            bool bDownloadBetweenDates,
            bool bEgoTimeline,
            bool bFriendsTimeline,
            int iFromPost,
            int iToPost,
            DateTime oStartDate,
            DateTime oEndDate,
            bool bLimitCommentsLikes,
            int iNrLimit,
            bool bGetTooltips,
            bool bIncludeMe,
            AttributesDictionary<bool> attributes
        )
        {            
            Debug.Assert(!String.IsNullOrEmpty(s_accessToken));
            AssertValid();
            
            const String MethodName = "GetNetworkAsync";
            CheckIsBusy(MethodName);

            GetNetworkAsyncArgs oGetNetworkAsyncArgs = new GetNetworkAsyncArgs();

            oGetNetworkAsyncArgs.AccessToken = s_accessToken;            
            oGetNetworkAsyncArgs.attributes = attributes;            
            oGetNetworkAsyncArgs.EdgeType = oEdgeType;
            oGetNetworkAsyncArgs.DownloadFromPostToPost = bDownloadFromPostToPost;
            oGetNetworkAsyncArgs.DownloadBetweenDates = bDownloadBetweenDates;
            oGetNetworkAsyncArgs.EgoTimeline = bEgoTimeline;
            oGetNetworkAsyncArgs.FriendsTimeline = bFriendsTimeline;
            oGetNetworkAsyncArgs.FromPost = iFromPost;
            oGetNetworkAsyncArgs.ToPost = iToPost;
            oGetNetworkAsyncArgs.StartDate = oStartDate;
            oGetNetworkAsyncArgs.EndDate = oEndDate;
            oGetNetworkAsyncArgs.LimitCommentsLikes = bLimitCommentsLikes;
            oGetNetworkAsyncArgs.Limit = iNrLimit;
            oGetNetworkAsyncArgs.GetTooltips = bGetTooltips;
            oGetNetworkAsyncArgs.IncludeMe = bIncludeMe;
            
            m_oBackgroundWorker.RunWorkerAsync(oGetNetworkAsyncArgs);
        }
        //*************************************************************************
        //  Method: GetNetworkAsync()
        //
        /// <summary>
        /// Asynchronously gets a directed network of YouTube users.
        /// </summary>
        ///
        /// <param name="userNameToAnalyze">
        /// The user name of the YouTube user whose network should be analyzed.
        /// </param>
        ///
        /// <param name="whatToInclude">
        /// Specifies what should be included in the network.
        /// </param>
        ///
        /// <param name="networkLevel">
        /// Network level to include.
        /// </param>
        ///
        /// <param name="maximumPeoplePerRequest">
        /// Maximum number of people to request for each query, or Int32.MaxValue
        /// for no limit.
        /// </param>
        ///
        /// <remarks>
        /// When the analysis completes, the <see
        /// cref="HttpNetworkAnalyzerBase.AnalysisCompleted" /> event fires.  The
        /// <see cref="RunWorkerCompletedEventArgs.Result" /> property will return
        /// an XmlDocument containing the network as GraphML.
        ///
        /// <para>
        /// To cancel the analysis, call <see
        /// cref="HttpNetworkAnalyzerBase.CancelAsync" />.
        /// </para>
        ///
        /// </remarks>
        //*************************************************************************
        public void GetNetworkAsync(
            String userNameToAnalyze,
            WhatToInclude whatToInclude,
            NetworkLevel networkLevel,
            Int32 maximumPeoplePerRequest
            )
        {
            Debug.Assert( !String.IsNullOrEmpty(userNameToAnalyze) );

            Debug.Assert(networkLevel == NetworkLevel.One ||
            networkLevel == NetworkLevel.OnePointFive ||
            networkLevel == NetworkLevel.Two);

            Debug.Assert(maximumPeoplePerRequest > 0);

            AssertValid();

            const String MethodName = "GetNetworkAsync";
            CheckIsBusy(MethodName);

            // Wrap the arguments in an object that can be passed to
            // BackgroundWorker.RunWorkerAsync().

            GetNetworkAsyncArgs oGetNetworkAsyncArgs = new GetNetworkAsyncArgs();

            oGetNetworkAsyncArgs.UserNameToAnalyze = userNameToAnalyze;
            oGetNetworkAsyncArgs.WhatToInclude = whatToInclude;
            oGetNetworkAsyncArgs.NetworkLevel = networkLevel;
            oGetNetworkAsyncArgs.MaximumPeoplePerRequest = maximumPeoplePerRequest;

            m_oBackgroundWorker.RunWorkerAsync(oGetNetworkAsyncArgs);
        }
        GetNetworkAsync
        (
            String s_accessToken,
            String fanPageUsernameID,
            List<NetworkType> netTypes,
            int iFromPost,
            int iToPost,
            Dictionary<Attribute,bool> attributes,
            bool getStatusUpdates,
            bool getWallPosts,
            bool includeOthers,
            DateTime startDate,
            DateTime endDate,
            int iLimit
        )
        {            
            Debug.Assert(!String.IsNullOrEmpty(s_accessToken));
            AssertValid();
            
            const String MethodName = "GetNetworkAsync";
            CheckIsBusy(MethodName);

            GetNetworkAsyncArgs oGetNetworkAsyncArgs = new GetNetworkAsyncArgs();

            oGetNetworkAsyncArgs.AccessToken = s_accessToken;
            oGetNetworkAsyncArgs.fanPageUsernameID = fanPageUsernameID;
            oGetNetworkAsyncArgs.netTypes = netTypes;
            oGetNetworkAsyncArgs.FromPost = iFromPost;
            oGetNetworkAsyncArgs.ToPost = iToPost;
            oGetNetworkAsyncArgs.attributes = attributes;
            oGetNetworkAsyncArgs.getStatusUpdates = getStatusUpdates;
            oGetNetworkAsyncArgs.getWallPosts = getWallPosts;
            oGetNetworkAsyncArgs.includeOthers = includeOthers;
            oGetNetworkAsyncArgs.startDate = startDate;
            oGetNetworkAsyncArgs.endDate = endDate;
            oGetNetworkAsyncArgs.limit = iLimit;
            
            m_oBackgroundWorker.RunWorkerAsync(oGetNetworkAsyncArgs);
        }