/// <summary>
        ///   Raises the <see cref = "E:System.Web.UI.Control.Load" /> event.
        /// </summary>
        /// <param name = "e">The <see cref = "T:System.EventArgs" /> object that contains the event data.</param>
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            PropertyAliasTextBox.Text = PropertyAlias;
            MaxHeightTextBox.Text     = MaxHeight.ToString(CultureInfo.InvariantCulture);
            MaxWidthTextBox.Text      = MaxWidth.ToString(CultureInfo.InvariantCulture);
        }
Ejemplo n.º 2
0
        /// <inheritdoc />
        public override void Process(TagHelperContext context, TagHelperOutput output)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }
            if (output == null)
            {
                throw new ArgumentNullException(nameof(output));
            }

            // Return if not enabled
            if (!Enabled)
            {
                output.TagName = null;
                return;
            }

            // Format properties
            var alwaysShowNavOnTouchDevicesFormatted = AlwaysShowNavOnTouchDevices.ToString().ToLower();
            var albumLabelFormatted           = AlbumLabel;
            var disableScrollingFormatted     = DisableScrolling.ToString().ToLower();
            var fadeDurationFormatted         = ((int)FadeDuration.TotalMilliseconds).ToString();
            var fitImagesInViewportFormatted  = FitImagesInViewport.ToString().ToLower();
            var imageFadeDurationFormatted    = ((int)ImageFadeDuration.TotalMilliseconds).ToString();
            var maxWidthFormatted             = MaxWidth?.ToString() ?? "null";
            var maxHeightFormatted            = MaxHeight?.ToString() ?? "null";
            var positionFromTopFormatted      = PositionFromTop.ToString();
            var resizeDurationFormatted       = ((int)ResizeDuration.TotalMilliseconds).ToString();
            var showImageNumberLabelFormatted = ShowImageNumberLabel.ToString().ToLower();
            var wrapAroundFormatted           = WrapAround.ToString().ToLower();

            // Format the content
            var content = TemplateHtml;

            content = content.Replace("__AlwaysShowNavOnTouchDevices__", alwaysShowNavOnTouchDevicesFormatted);
            content = content.Replace("__AlbumLabel__", albumLabelFormatted);
            content = content.Replace("__DisableScrolling__", disableScrollingFormatted);
            content = content.Replace("__FadeDuration__", fadeDurationFormatted);
            content = content.Replace("__FitImagesInViewport__", fitImagesInViewportFormatted);
            content = content.Replace("__ImageFadeDuration__", imageFadeDurationFormatted);
            content = content.Replace("__MaxWidth__", maxWidthFormatted);
            content = content.Replace("__MaxHeight__", maxHeightFormatted);
            content = content.Replace("__PositionFromTop__", positionFromTopFormatted);
            content = content.Replace("__ResizeDuration__", resizeDurationFormatted);
            content = content.Replace("__ShowImageNumberLabel__", showImageNumberLabelFormatted);
            content = content.Replace("__WrapAround__", wrapAroundFormatted);

            // Output
            output.TagName = null;
            output.Content.SetHtmlContent(content);

            base.Process(context, output);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Gets raw html response body for a URL
        /// </summary>
        /// <param name="url"></param>
        /// <returns></returns>
        public string GetEmbedResponse(string url)
        {
            StringBuilder       output      = new StringBuilder();
            NameValueCollection queryString = System.Web.HttpUtility.ParseQueryString(string.Empty);

            queryString["url"]    = url;
            queryString["format"] = "json";
            if (MaxHeight > 0)
            {
                queryString["maxheight"] = MaxHeight.ToString();
            }
            if (MaxWidth > 0)
            {
                queryString["maxwidth"] = MaxWidth.ToString();
            }

            string fullURL = String.Format("{0}?{1}", EndpointURL, queryString.ToString());

            WebRequest embedReq;

            embedReq = WebRequest.Create(fullURL);
            Stream objStream;

            objStream = embedReq.GetResponse().GetResponseStream();

            StreamReader objReader = new StreamReader(objStream);

            string sLine = "";
            int    i     = 0;

            while (sLine != null)
            {
                i++;
                sLine = objReader.ReadLine();
                if (sLine != null)
                {
                    output.AppendLine(sLine);
                }
            }

            return(output.ToString());
        }
Ejemplo n.º 4
0
        protected override void WriteDataXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            ele.TryPathTo("Width/Min", true, out subEle);
            subEle.Value = MinWidth.ToString("G15");

            ele.TryPathTo("Width/Max", true, out subEle);
            subEle.Value = MaxWidth.ToString("G15");

            ele.TryPathTo("Height/Min", true, out subEle);
            subEle.Value = MinHeight.ToString("G15");

            ele.TryPathTo("Height/Max", true, out subEle);
            subEle.Value = MaxHeight.ToString("G15");

            ele.TryPathTo("Depth", true, out subEle);
            subEle.Value = Depth.ToString("G15");

            ele.TryPathTo("Shininess", true, out subEle);
            subEle.Value = Shininess.ToString("G15");

            ele.TryPathTo("Parallax/Scale", true, out subEle);
            subEle.Value = ParallaxScale.ToString("G15");

            ele.TryPathTo("Parallax/Passes", true, out subEle);
            subEle.Value = ParallaxPasses.ToString();

            ele.TryPathTo("Flags", true, out subEle);
            subEle.Value = DecalFlags.ToString();

            WriteUnusedXML(ele, master);

            ele.TryPathTo("Color", true, out subEle);
            Color.WriteXML(subEle, master);
        }
Ejemplo n.º 5
0
        /*  //For if we ever want to make this into a DB that can be updated
         *  public event PropertyChangedEventHandler PropertyChanged;
         *
         *  private void OnPropertyChanged(string propertyName)
         *  {
         *      this.PropertyChanged?.Invoke(this,
         *          new PropertyChangedEventArgs(propertyName));
         *  }
         */

        public override string ToString()
        {
            return(string.Format("[Plant: {0}, {1}, {2}, {3}]", PlantName, ScientificName, Sun, MaxHeight.ToString()));
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Save Features.Charts settings to the settings file
        /// </summary>
        /// <param name="generalNode">XML-node for the Features.Charts settings</param>
        public void Save(XmlNode chartsNode)
        {
            string  xpath;
            XmlNode node;

            xpath = "./height";
            SettingsHelper.SetSettingValue(xpath, chartsNode, Height.ToString());

            xpath = "./maxHeight";
            SettingsHelper.SetSettingValue(xpath, chartsNode, MaxHeight.ToString());

            xpath = "./width";
            SettingsHelper.SetSettingValue(xpath, chartsNode, Width.ToString());

            xpath = "./maxWidth";
            SettingsHelper.SetSettingValue(xpath, chartsNode, MaxWidth.ToString());

            xpath = "./colors";
            SettingsHelper.SetSettingValue(xpath, chartsNode, "color", Colors);

            xpath = "./lineThickness";
            SettingsHelper.SetSettingValue(xpath, chartsNode, LineThickness.ToString());

            xpath = "./maxLineThickness";
            SettingsHelper.SetSettingValue(xpath, chartsNode, MaxLineThickness.ToString());

            xpath = "./logotype";
            SettingsHelper.SetSettingValue(xpath, chartsNode, Logotype);

            xpath = "./maxValues";
            SettingsHelper.SetSettingValue(xpath, chartsNode, MaxValues.ToString());

            xpath = "./timeSortOrder";
            SettingsHelper.SetSettingValue(xpath, chartsNode, TimeSortOrder.ToString());

            xpath = "./labelOrientation";
            SettingsHelper.SetSettingValue(xpath, chartsNode, LabelOrientation.ToString());

            xpath = "./font";
            node  = SettingsHelper.GetNode(chartsNode, xpath);
            _fontSettings.Save(node);

            xpath = "./legend";
            node  = SettingsHelper.GetNode(chartsNode, xpath);
            _legendSettings.Save(node);

            xpath = "./guidelines";
            node  = SettingsHelper.GetNode(chartsNode, xpath);
            _guidelinesSettings.Save(node);

            xpath = "./showSourse";
            SettingsHelper.SetSettingValue(xpath, chartsNode, ShowSource.ToString());

            xpath = "./showLogo";
            SettingsHelper.SetSettingValue(xpath, chartsNode, ShowLogo.ToString());

            xpath = "./lineThicknessPhrame";
            SettingsHelper.SetSettingValue(xpath, chartsNode, LineThicknessPhrame.ToString());

            xpath = "./lineColorPhrame";
            SettingsHelper.SetSettingValue(xpath, chartsNode, LineColorPhrame.ToString());

            xpath = "./backgroundColorGraphs";
            SettingsHelper.SetSettingValue(xpath, chartsNode, BackgroundColorGraphs.ToString());
        }
Ejemplo n.º 7
0
 private void SaveWindowSettings()
 {
     Properties.Settings.Default.instancegui_windowsettings = String.Join(";", new string[] { Left.ToString(), Top.ToString(), MaxWidth.ToString(), MaxHeight.ToString() });
     Properties.Settings.Default.instancegui_ispinned       = ispinned;
     Properties.Settings.Default.Save();
 }
Ejemplo n.º 8
0
        public void WriteXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            ele.TryPathTo("Object", true, out subEle);
            Object.WriteXML(subEle, master);

            ele.TryPathTo("ParentIndex", true, out subEle);
            subEle.Value = ParentIndex.ToString();

            ele.TryPathTo("Unused", true, out subEle);
            subEle.Value = Unused.ToHex();

            ele.TryPathTo("Density", true, out subEle);
            subEle.Value = Density.ToString("G15");

            ele.TryPathTo("Clustering", true, out subEle);
            subEle.Value = Clustering.ToString();

            ele.TryPathTo("Slope/Min", true, out subEle);
            subEle.Value = MinSlope.ToString();

            ele.TryPathTo("Slope/Max", true, out subEle);
            subEle.Value = MaxSlope.ToString();

            ele.TryPathTo("Flags", true, out subEle);
            subEle.Value = Flags.ToString();

            ele.TryPathTo("RadiusWithRespectToParent", true, out subEle);
            subEle.Value = RadiusWithRespectToParent.ToString();

            ele.TryPathTo("Radius", true, out subEle);
            subEle.Value = Radius.ToString();

            ele.TryPathTo("Unknown1", true, out subEle);
            subEle.Value = Unknown1.ToHex();

            ele.TryPathTo("MaxHeight", true, out subEle);
            subEle.Value = MaxHeight.ToString("G15");

            ele.TryPathTo("Sink", true, out subEle);
            subEle.Value = Sink.ToString("G15");

            ele.TryPathTo("SinkVariance", true, out subEle);
            subEle.Value = SinkVariance.ToString("G15");

            ele.TryPathTo("SizeVariance", true, out subEle);
            subEle.Value = SizeVariance.ToString("G15");

            ele.TryPathTo("XAngleVariance", true, out subEle);
            subEle.Value = XAngleVariance.ToString();

            ele.TryPathTo("YAngleVariance", true, out subEle);
            subEle.Value = YAngleVariance.ToString();

            ele.TryPathTo("ZAngleVariance", true, out subEle);
            subEle.Value = ZAngleVariance.ToString();

            ele.TryPathTo("Unknown2", true, out subEle);
            subEle.Value = Unknown2.ToHex();
        }
 private void SaveWindowSettings()
 {
     LBConfiguration.Config.instancegui_windowsettings = String.Join(";", new string[] { Left.ToString(), Top.ToString(), MaxWidth.ToString(), MaxHeight.ToString() });
     LBConfiguration.Config.instancegui_ispinned       = ispinned;
     LBConfiguration.Save();
 }