Exemple #1
0
        /// <summary>
        /// Populates the element (including children) with information from its XML definition.
        /// </summary>
        /// <param name="Input">XML definition.</param>
        public override void FromXml(XmlElement Input)
        {
            base.FromXml(Input);

            this.translateX = new DoubleAttribute(Input, "translateX");
            this.translateY = new DoubleAttribute(Input, "translateY");
        }
Exemple #2
0
        /// <summary>
        /// Populates the element (including children) with information from its XML definition.
        /// </summary>
        /// <param name="Input">XML definition.</param>
        public override void FromXml(XmlElement Input)
        {
            base.FromXml(Input);

            this.radians = new DoubleAttribute(Input, "radians");
            this.degrees = new DoubleAttribute(Input, "degrees");
        }
Exemple #3
0
        /// <summary>
        /// Populates the element (including children) with information from its XML definition.
        /// </summary>
        /// <param name="Input">XML definition.</param>
        public override void FromXml(XmlElement Input)
        {
            base.FromXml(Input);

            this.scaleX = new DoubleAttribute(Input, "scaleX");
            this.scaleY = new DoubleAttribute(Input, "scaleY");
        }
Exemple #4
0
        /// <summary>
        /// Populates the element (including children) with information from its XML definition.
        /// </summary>
        /// <param name="Input">XML definition.</param>
        public override void FromXml(XmlElement Input)
        {
            base.FromXml(Input);

            this.sigmaX   = new DoubleAttribute(Input, "sigmaX");
            this.sigmaY   = new DoubleAttribute(Input, "sigmaY");
            this.tileMode = new EnumAttribute <SKShaderTileMode>(Input, "tileMode");
        }
Exemple #5
0
        /// <summary>
        /// Populates the element (including children) with information from its XML definition.
        /// </summary>
        /// <param name="Input">XML definition.</param>
        public override void FromXml(XmlElement Input)
        {
            base.FromXml(Input);

            this.dX     = new LengthAttribute(Input, "dX");
            this.dY     = new LengthAttribute(Input, "dY");
            this.sigmaX = new DoubleAttribute(Input, "sigmaX");
            this.sigmaY = new DoubleAttribute(Input, "sigmaY");
            this.color  = new ColorAttribute(Input, "color");
        }
Exemple #6
0
        /// <summary>
        /// Populates the element (including children) with information from its XML definition.
        /// </summary>
        /// <param name="Input">XML definition.</param>
        public override void FromXml(XmlElement Input)
        {
            base.FromXml(Input);

            this.startAngleRadians = new DoubleAttribute(Input, "startAngleRadians");
            this.startAngleDegrees = new DoubleAttribute(Input, "startAngleDegrees");
            this.endAngleRadians   = new DoubleAttribute(Input, "endAngleRadians");
            this.endAngleDegrees   = new DoubleAttribute(Input, "endAngleDegrees");
            this.clockwise         = new BooleanAttribute(Input, "clockwise");
        }
Exemple #7
0
        /// <summary>
        /// Gets keyword ideas for the list of Seed keywords.
        /// </summary>
        /// <param name="user">The user for which keyword ideas are generated.
        /// </param>
        /// <param name="seedKeywords">The seed keywords for generating ideas.
        /// </param>
        /// <param name="negativeTerms">The list of keywords to exclude.</param>
        /// <returns>A list of keyword ideas.</returns>
        private List <KeywordIdea> GetKeywordIdeas(AdWordsUser user, List <string> seedKeywords,
                                                   SeedKeyword[] negativeTerms)
        {
            // Get the TargetingIdeaService.
            TargetingIdeaService targetingIdeaService =
                (TargetingIdeaService)user.GetService(AdWordsService.v201607.TargetingIdeaService);

            IdeaTextFilterSearchParameter excludedTerms = null;

            if (negativeTerms.Length > 0)
            {
                excludedTerms = GetExcludedKeywordSearchParams(negativeTerms);
            }

            LanguageSearchParameter languageParams = GetLanguageSearchParams();
            LocationSearchParameter locationParams = GetLocationSearchParams();

            List <KeywordIdea> retval = new List <KeywordIdea>();

            for (int i = 0; i < seedKeywords.Count; i += Settings.TIS_KEYWORDS_LIST_SIZE)
            {
                List <string> keywordsToSearch = new List <string>();
                for (int j = i; j < i + Settings.TIS_KEYWORDS_LIST_SIZE && j < seedKeywords.Count; j++)
                {
                    keywordsToSearch.Add(seedKeywords[j]);
                }

                // Create selector.
                TargetingIdeaSelector selector = new TargetingIdeaSelector();
                selector.requestType             = RequestType.IDEAS;
                selector.ideaType                = IdeaType.KEYWORD;
                selector.requestedAttributeTypes = new AttributeType[] {
                    AttributeType.KEYWORD_TEXT,
                    AttributeType.SEARCH_VOLUME,
                    AttributeType.AVERAGE_CPC,
                    AttributeType.COMPETITION
                };

                List <SearchParameter> paramList = new List <SearchParameter>();
                paramList.Add(new RelatedToQuerySearchParameter()
                {
                    queries = keywordsToSearch.ToArray(),
                });

                if (excludedTerms != null)
                {
                    paramList.Add(excludedTerms);
                }
                paramList.Add(locationParams);
                paramList.Add(languageParams);

                selector.searchParameters = paramList.ToArray();

                // Set selector paging (required for targeting idea service).
                Paging            paging = Paging.Default;
                TargetingIdeaPage page   = new TargetingIdeaPage();

                try {
                    do
                    {
                        // Get related keywords.
                        page = targetingIdeaService.get(selector);

                        // Display related keywords.
                        if (page.entries != null && page.entries.Length > 0)
                        {
                            foreach (TargetingIdea targetingIdea in page.entries)
                            {
                                string keyword = null;
                                long   averageMonthlySearches = 0;
                                long   averageCpc             = 0;
                                double competition            = 0f;

                                foreach (Type_AttributeMapEntry entry in targetingIdea.data)
                                {
                                    if (entry.key == AttributeType.KEYWORD_TEXT)
                                    {
                                        StringAttribute temp = (entry.value as StringAttribute);
                                        if (temp != null)
                                        {
                                            keyword = temp.value;
                                        }
                                    }

                                    if (entry.key == AttributeType.SEARCH_VOLUME)
                                    {
                                        LongAttribute temp = (entry.value as LongAttribute);
                                        if (temp != null)
                                        {
                                            averageMonthlySearches = temp.value;
                                        }
                                    }

                                    if (entry.key == AttributeType.AVERAGE_CPC)
                                    {
                                        MoneyAttribute temp = (entry.value as MoneyAttribute);
                                        if (temp != null && temp.value != null)
                                        {
                                            averageCpc = temp.value.microAmount;
                                        }
                                    }

                                    if (entry.key == AttributeType.COMPETITION)
                                    {
                                        DoubleAttribute temp = (entry.value as DoubleAttribute);
                                        if (temp != null)
                                        {
                                            competition = temp.value;
                                        }
                                    }
                                }

                                KeywordIdea keywordIdea = new KeywordIdea()
                                {
                                    KeywordText     = keyword,
                                    AverageSearches = averageMonthlySearches,
                                    AverageCpc      = averageCpc,
                                    Competition     = Math.Round(competition, Settings.ACCURACY,
                                                                 MidpointRounding.AwayFromZero)
                                };
                                retval.Add(keywordIdea);
                            }
                        }
                        selector.paging.IncreaseOffset();
                    } while (selector.paging.startIndex < page.totalNumEntries);
                } catch (Exception e) {
                    throw new System.ApplicationException("Failed to retrieve related keywords.", e);
                }
            }
            return(retval);
        }
Exemple #8
0
 public static void labelAttribute(this DoubleAttribute _p0)
 {
 }
Exemple #9
0
        /// <summary>
        /// Populates the element (including children) with information from its XML definition.
        /// </summary>
        /// <param name="Input">XML definition.</param>
        public override void FromXml(XmlElement Input)
        {
            base.FromXml(Input);

            this.factor = new DoubleAttribute(Input, "factor");
        }