コード例 #1
0
 public void OnWebPageLoaded(StringCollection sc)
 {
     sc.Add("limnorgooglemaps.addMarker('");
     sc.Add(_owner.VarName);
     sc.Add("',");
     sc.Add(this.Location.lat().ToString(CultureInfo.InvariantCulture));
     sc.Add(",");
     sc.Add(this.Location.lng().ToString(CultureInfo.InvariantCulture));
     sc.Add(",");
     if (string.IsNullOrEmpty(this.name))
     {
         sc.Add("null,");
     }
     else
     {
         sc.Add("'");
         sc.Add(this.name.Replace("'", "\\'"));
         sc.Add("',");
     }
     if (string.IsNullOrEmpty(this.title))
     {
         sc.Add("null,");
     }
     else
     {
         sc.Add("'");
         sc.Add(this.title.Replace("'", "\\'"));
         sc.Add("',");
     }
     sc.Add("'");
     sc.Add(this.uuid);
     sc.Add("',");
     if (string.IsNullOrEmpty(this.iconUrl))
     {
         sc.Add("null");
     }
     else
     {
         string iconAddr = this.iconUrl;
         try
         {
             if (File.Exists(this.iconUrl))
             {
                 if (_resourceFiles == null)
                 {
                     _resourceFiles = new List <WebResourceFile>();
                 }
                 bool            b;
                 WebResourceFile wrf = new WebResourceFile(iconUrl, WebResourceFile.WEBFOLDER_Images, out b);
                 _resourceFiles.Add(wrf);
                 iconAddr = wrf.WebAddress;
             }
         }
         catch
         {
         }
         sc.Add("'");
         sc.Add(iconAddr);
         sc.Add("'");
     }
     if (this.markerSize != Size.Empty && this.markerSize.Width > 0 && this.markerSize.Height > 0)
     {
         sc.Add(",");
         sc.Add(this.markerSize.Width.ToString(CultureInfo.InvariantCulture));
         sc.Add(",");
         sc.Add(this.markerSize.Height.ToString(CultureInfo.InvariantCulture));
     }
     else
     {
         sc.Add(",32,32");
     }
     sc.Add(",");
     if (this.markerColor == Color.Empty)
     {
         sc.Add("'FFFF00'");
     }
     else
     {
         sc.Add(string.Format(CultureInfo.InvariantCulture, "'{0}'", VPLUtil.GetColorHexString2(this.markerColor)));
     }
     sc.Add(");\r\n");
 }