当前位置: 首页>>代码示例>>C#>>正文


C# StringCollection.Join方法代码示例

本文整理汇总了C#中StringCollection.Join方法的典型用法代码示例。如果您正苦于以下问题:C# StringCollection.Join方法的具体用法?C# StringCollection.Join怎么用?C# StringCollection.Join使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在StringCollection的用法示例。


在下文中一共展示了StringCollection.Join方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Page_Load

  protected void Page_Load(object sender, EventArgs e)
  {
    Configuration config = AppContext.GetConfiguration();

    if (Request.QueryString["check"] != null)
    {
      string status = "unknown";

      switch (Request.QueryString["check"].ToLower())
      {
        case "app":
          status = AppSettings.AppIsAvailable ? "up" : "down";
          break;

        case "appmessage":
          status = AppSettings.AppStatusMessage;
          break;

        case "mapservices":
          StringCollection serviceStatus = new StringCollection();

          foreach (Configuration.MapTabRow mapTab in config.MapTab)
          {
            bool isAvailable = AppContext.GetDataFrame(mapTab.MapTabID).Service.IsAvailable;
            serviceStatus.Add(mapTab.MapTabID + ": " + (isAvailable ? "up" : "down"));
          }

          status = serviceStatus.Join("; ");
          break;
      }

      Response.Write(status);
      Response.End();
    }

    labMessage.Text = AppSettings.AppStatusMessage;

    if (AppSettings.AppIsAvailable)
    {
      DataTable table = config.MapTab.Copy();
      table.Columns.Add("Status", typeof(string));

      foreach (DataRow row in table.Rows)
      {
        CommonDataFrame dataFrame = AppContext.GetDataFrame(row["MapTabID"].ToString());
        row["Status"] = dataFrame.Service.IsAvailable ? "up" : "down";
      }

      grdMapServices.DataSource = table;
      grdMapServices.DataBind();
      grdMapServices.Visible = true;
    }
  }
开发者ID:ClaireBrill,项目名称:GPV,代码行数:53,代码来源:Status.aspx.cs

示例2: DefaultMethod


//.........这里部分代码省略.........

      if (!isCandidateLayer)
      {
        bool shownInLegend = !mapTabLayer.IsShowInLegendNull() && mapTabLayer.ShowInLegend == 1;
        bool checkedInLegend = mapTabLayer.IsCheckInLegendNull() || mapTabLayer.CheckInLegend < 0 || visibleLayers.Any(o => o == mapTabLayer.LayerID);
        isCandidateLayer = !shownInLegend || checkedInLegend;
      }

      if (isCandidateLayer)
      {
        Configuration.LayerRow layer = mapTabLayer.LayerRow;
        Configuration.LayerFunctionRow layerFunction = layer.GetLayerFunctionRows().FirstOrDefault(o => o.FunctionName.ToLower() == "maptip");

        if (layerFunction != null)
        {
          layers.Add(layer.LayerName, layer);
          layerFunctions.Add(layer.LayerName, layerFunction);
        }
      }
    }

    string tipText = null;

    for (int i = 0; i < dataFrame.Layers.Count - 1 && tipText == null; ++i)
    {
      CommonLayer commonLayer = dataFrame.Layers[i];
      string id = null;

      if (layers.ContainsKey(commonLayer.Name) && commonLayer.IsWithinScaleThresholds(scale))
      {
        if (commonLayer.Type == CommonLayerType.Feature)
        {
          Configuration.LayerRow layer = layers[commonLayer.Name];
          string levelQuery = layer.GetLevelQuery(commonLayer, level);

          CommonField keyField = commonLayer.FindField(layer.KeyField);
          DataTable table = commonLayer.GetFeatureTable(keyField.Name, levelQuery, x, y, commonLayer.FeatureType == OgcGeometryType.MultiPolygon ? 0 : distance * scale);

          if (table != null && table.Rows.Count > 0)
          {
            id = table.Rows[table.Rows.Count - 1][0].ToString();
          }
        }

        if (commonLayer.Type == CommonLayerType.Image)
        {
          id = ((AgsLayer)commonLayer).GetRasterValue(x, y);
        }
      }

      if (!String.IsNullOrEmpty(id))
      {
        Configuration.LayerFunctionRow layerFunction = layerFunctions[commonLayer.Name];

        using (OleDbCommand command = layerFunction.GetDatabaseCommand())
        {
          command.Parameters[0].Value = id;

          if (command.Parameters.Count > 1)
          {
            command.Parameters[1].Value = AppUser.GetRole();
          }

          using (OleDbDataReader reader = command.ExecuteReader())
          {
            if (reader.Read())
            {
              StringCollection text = new StringCollection();

              for (int j = 0; j < reader.FieldCount; ++j)
              {
                if (!reader.IsDBNull(j))
                {
                  text.Add(reader.GetValue(j).ToString());
                }
              }

              if (text.Count > 0)
              {
                tipText = text.Join("\n");
              }
            }
          }

          command.Connection.Close();
        }
      }
    }

    if (tipText == null)
    {
      ReturnJson(null);
    }
    else
    {
      Dictionary<String, Object> result = new Dictionary<String, Object>();
      result.Add("tipText", tipText);
      ReturnJson(result);
    }
  }
开发者ID:ClaireBrill,项目名称:GPV,代码行数:101,代码来源:MapTipHandler.cs

示例3: LayersToString

  private string LayersToString(Dictionary<String, StringCollection> dict)
  {
    StringCollection layers = new StringCollection();

    foreach (string key in dict.Keys)
    {
      string s = key;

      if (VisibleLayers[key].Count > 0)
      {
        s += Separator3.ToString() + VisibleLayers[key].Join(Separator3.ToString());
      }

      layers.Add(s);
    }

    return layers.Join(Separator2.ToString());
  }
开发者ID:ClaireBrill,项目名称:GPV,代码行数:18,代码来源:AppState.cs

示例4: CoordinatesToString

  private string CoordinatesToString(List<Coordinate> points)
  {
    StringCollection coords = new StringCollection();

    for (int i = 0; i < points.Count; ++i)
    {
      coords.Add(points[i].X.ToString() + "," + points[i].Y.ToString());
    }

    return coords.Join(Separator2.ToString());
  }
开发者ID:ClaireBrill,项目名称:GPV,代码行数:11,代码来源:AppState.cs

示例5: cmdDownload_Click

  protected void cmdDownload_Click(object sender, EventArgs e)
  {
    StringCollection query = new StringCollection();
    query.Add("a.Deleted = 0 and b.Deleted = 0");

    if (ddlMarkupCategory.SelectedValue.Length > 0)
    {
      query.Add(String.Format("b.CategoryID = '{0}'", ddlMarkupCategory.SelectedValue));
    }

    if (ddlUserName.SelectedValue.Length > 0)
    {
      query.Add(String.Format("b.CreatedBy = '{0}'", ddlUserName.SelectedValue));
    }

    if (optDateRange.Checked)
    {
      DateTime dateFrom = calDateFrom.SelectedDate < calDateTo.SelectedDate ? calDateFrom.SelectedDate : calDateTo.SelectedDate;
      DateTime dateTo = calDateFrom.SelectedDate >= calDateTo.SelectedDate ? calDateFrom.SelectedDate : calDateTo.SelectedDate;
      query.Add(String.Format("'{0}' <= b.DateCreated and b.DateCreated < '{1}'", dateFrom.ToString("MM/dd/yy"), dateTo.AddDays(1).ToString("MM/dd/yy")));
    }

    if (ddlMarkupGroup.SelectedValue.Length > 0)
    {
      query.Add(String.Format("b.DisplayName = '{0}'", ddlMarkupGroup.SelectedValue));
    }

    string baseSql = @"select c.DisplayName as Category, b.DisplayName as [Group], b.CreatedBy as CreatedBy,
          b.DateCreated as DateGroup, a.DateCreated as DateMarkup, a.Color as Color, a.Glow as Glow,
          a.Text as Text, a.Shape as Shape
          from {0}Markup a 
            inner join {0}MarkupGroup b on a.GroupID = b.GroupID
            inner join {0}MarkupCategory c on b.CategoryID = c.CategoryID {1}
          order by b.DateCreated, a.DateCreated
        ";

    Response.Clear();
    Response.ContentType = "application/zip";
    Response.AddHeader("Content-Disposition", String.Format("attachment; filename={0}.zip", tboFilePrefix.Text));

    ZipOutputStream zipStream = new ZipOutputStream(Response.OutputStream);

    // polygons

    string where = String.Format(" where {0} and a.Shape like 'POLYGON%'", query.Join(" and "));
    string sql = String.Format(baseSql, AppSettings.ConfigurationTablePrefix, where);
    DataTable table = GetShapeTable(sql, OgcGeometryType.Polygon);

    if (table.Rows.Count > 0)
    {
      table.Columns.Remove("Glow");
      table.Columns.Remove("Text");
      WriteZippedShapefile(zipStream, table, tboFilePrefix.Text + "_poly");
    }

    // lines

    where = String.Format(" where {0} and a.Shape like 'LINESTRING%'", query.Join(" and "));
    sql = String.Format(baseSql, AppSettings.ConfigurationTablePrefix, where);
    table = GetShapeTable(sql, OgcGeometryType.LineString);

    if (table.Rows.Count > 0)
    {
      table.Columns.Remove("Glow");
      table.Columns.Remove("Text");
      WriteZippedShapefile(zipStream, table, tboFilePrefix.Text + "_line");
    }

    // points

    where = String.Format(" where {0} and a.Shape like 'POINT%' and a.Text is null", query.Join(" and "));
    sql = String.Format(baseSql, AppSettings.ConfigurationTablePrefix, where);
    table = GetShapeTable(sql, OgcGeometryType.Point);

    if (table.Rows.Count > 0)
    {
      table.Columns.Remove("Glow");
      table.Columns.Remove("Text");
      WriteZippedShapefile(zipStream, table, tboFilePrefix.Text + "_point");
    }

    // text

    where = String.Format(" where {0} and a.Shape like 'POINT%' and a.Text is not null", query.Join(" and "));
    sql = String.Format(baseSql, AppSettings.ConfigurationTablePrefix, where);
    table = GetShapeTable(sql, OgcGeometryType.Point);

    if (table.Rows.Count > 0)
    {
      WriteZippedShapefile(zipStream, table, tboFilePrefix.Text + "_text");
    }

    zipStream.Finish();
    zipStream.Close();
    Response.End();
  }
开发者ID:ClaireBrill,项目名称:GPV,代码行数:96,代码来源:DownloadMarkup.aspx.cs

示例6: Page_PreRender

  protected void Page_PreRender(object sender, EventArgs e)
  {
    string prefix = AppSettings.ConfigurationTablePrefix;

    using (OleDbConnection connection = AppContext.GetDatabaseConnection())
    {
      StringCollection query = new StringCollection();
      query.Add("Deleted = 0");

      // category

      if (ddlMarkupCategory.SelectedValue.Length > 0)
      {
        query.Add(String.Format("CategoryID = '{0}'", ddlMarkupCategory.SelectedValue));
      }

      // user name

      string sql = String.Format("select distinct CreatedBy from {0}MarkupGroup {1} order by CreatedBy",
          prefix, String.Format(" where {0}", query.Join(" and ")));
      DataTable table = new DataTable();
      
      using (OleDbDataAdapter adapter = new OleDbDataAdapter(sql, connection))
      {
        adapter.Fill(table);
      }

      string currentUser = ddlUserName.Items.Count == 0 ? "" : ddlUserName.SelectedValue;

      ddlUserName.DataSource = table;
      ddlUserName.DataValueField = "CreatedBy";
      ddlUserName.DataBind();
      ddlUserName.Items.Insert(0, new ListItem("- all users -", ""));

      if (table.Select("CreatedBy = '" + currentUser + "'").Length > 0)
      {
        ddlUserName.SelectedValue = currentUser;
        query.Add(String.Format("CreatedBy = '{0}'", currentUser));
      }

      // date

      if (optDateRange.Checked)
      {
        DateTime dateFrom = calDateFrom.SelectedDate < calDateTo.SelectedDate ? calDateFrom.SelectedDate : calDateTo.SelectedDate;
        DateTime dateTo = calDateFrom.SelectedDate >= calDateTo.SelectedDate ? calDateFrom.SelectedDate : calDateTo.SelectedDate;
        query.Add(String.Format("'{0}' <= DateCreated and DateCreated < '{1}'", dateFrom.ToString("MM/dd/yy"), dateTo.AddDays(1).ToString("MM/dd/yy")));
      }

      // markup group

      sql = String.Format("select distinct DisplayName from {0}MarkupGroup {1} order by DisplayName",
          prefix, String.Format(" where {0}", query.Join(" and ")));
      table = new DataTable();

      using (OleDbDataAdapter adapter = new OleDbDataAdapter(sql, connection))
      {
        adapter.Fill(table);
      }

      string currentGroup = ddlMarkupGroup.Items.Count == 0 ? "" : ddlMarkupGroup.SelectedValue;

      ddlMarkupGroup.DataSource = table;
      ddlMarkupGroup.DataValueField = "DisplayName";
      ddlMarkupGroup.DataBind();
      ddlMarkupGroup.Items.Insert(0, new ListItem("- all groups -", ""));

      if (table.Select("DisplayName = '" + currentGroup + "'").Length > 0)
      {
        ddlMarkupGroup.SelectedValue = currentGroup;
        query.Add(String.Format("DisplayName = '{0}'", currentGroup));
      }

      // count

      string where = String.Format(" where {0}", query.Join(" and "));
      sql = String.Format("select count(*) from {0}MarkupGroup {1}", prefix, where);
      int numGroups;

      using (OleDbCommand command = new OleDbCommand(sql, connection))
      {
        numGroups = Convert.ToInt32(command.ExecuteScalar());
      }

      sql = String.Format("select count(*) from {0}Markup where GroupID in (select GroupID from {0}MarkupGroup {1})", prefix, where);
      int numMarkups;

      using (OleDbCommand command = new OleDbCommand(sql, connection))
      {
        numMarkups = Convert.ToInt32(command.ExecuteScalar());
      }

      labNumberFound.Text = String.Format("{0} {1} in {2} {3} found", numMarkups,
          numMarkups == 1 ? "markup" : "markups", numGroups, numGroups == 1 ? "group" : "groups");

      cmdDownload.Enabled = numGroups != 0 && numMarkups != 0;
    }

    if (String.IsNullOrEmpty(tboFilePrefix.Text))
    {
//.........这里部分代码省略.........
开发者ID:ClaireBrill,项目名称:GPV,代码行数:101,代码来源:DownloadMarkup.aspx.cs

示例7: DrawMeasure

  private void DrawMeasure(Graphics graphics, IGeometry geometry)
  {
    string measureUnits = AppSettings.MeasureUnits;
    bool inFeet = measureUnits == "feet" || measureUnits == "both";
    bool inMeters = measureUnits == "meters" || measureUnits == "both";

    System.Drawing.Font font = AppSettings.MeasureFont;
    font = new System.Drawing.Font(font.FontFamily, Convert.ToSingle(font.Size * _resolution), font.Style, font.Unit);
    SolidBrush brush = new SolidBrush(Color.FromArgb(64, 64, 64));
    SolidBrush glowBrush = new SolidBrush(Color.White);

    StringFormat format = new StringFormat();
    format.Alignment = StringAlignment.Center;
    format.LineAlignment = StringAlignment.Center;

    double convert = 1 / (AppSettings.MapUnits == "feet" ? 1 : Constants.MetersPerFoot);
    StringCollection text = new StringCollection();

    switch (geometry.OgcGeometryType)
    {
      case OgcGeometryType.LineString:
        ILineString lineString = (ILineString)geometry;

        double d = lineString.Length * convert;

        if (inFeet)
        {
          text.Add(d < 5280 ? d.ToString("0") + " ft" : (d / 5280).ToString("0.0") + " mi");
        }

        if (inMeters)
        {
          d *= Constants.MetersPerFoot;
          text.Add(d < 1000 ? d.ToString("0") + " m" : (d / 1000).ToString("0.0") + " km");
        }

        IPoint p;
        double angle;

        GetMidpoint(lineString, out p, out angle);

        angle = -(angle * 180 / Math.PI);
        angle = angle < -90 || 90 < angle ? angle + 180 : angle < 0 ? angle + 360 : angle;

        p = _transform.ReverseTransform(p);

        float x = Convert.ToSingle(p.Coordinate.X * _resolution);
        float y = Convert.ToSingle(p.Coordinate.Y * _resolution);

        format.LineAlignment = StringAlignment.Far;

        int[] pos = new int[] { 0, 1, 2, 3, 5, 6, 7, 8, 4 };

        for (int i = 0; i < 9; ++i)
        {
          float offsetX = (pos[i] % 3) - 1;
          float offsetY = Convert.ToSingle(Math.Floor(pos[i] / 3.0)) - 1;

          System.Drawing.Drawing2D.GraphicsState state = graphics.Save();
          graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
          graphics.TranslateTransform(x, y);
          graphics.RotateTransform(Convert.ToSingle(angle));
          graphics.DrawString(text.Join("\n"), font, i < 8 ? glowBrush : brush, Convert.ToSingle(offsetX * _resolution), Convert.ToSingle(offsetY - 3 * _resolution), format);
          graphics.Restore(state);
        }
        break;

      case OgcGeometryType.Polygon:
        IPolygon polygon = (IPolygon)geometry;
        IPoint c = polygon.Centroid;

        if (c != null)
        {
          double a = polygon.Area * convert * convert;
          double acres = a / Constants.SquareFeetPerAcre;

          if (inFeet)
          {
            double squareMile = Constants.FeetPerMile * Constants.FeetPerMile;
            text.Add(a <= squareMile ? a.ToString("0") + " sq ft" : (a / squareMile).ToString("0.00") + " sq mi");
          }

          if (inMeters)
          {
            a *= Constants.MetersPerFoot * Constants.MetersPerFoot;
            text.Add(a <= 100000 ? a.ToString("0") + " sq m" : (a / 1000000).ToString("0.00") + " sq km");
          }

          if (inFeet)
          {
            text.Add(acres.ToString("0.00") + " acres");
          }

          DrawText(graphics, c, text.Join("\n"), font, brush, glowBrush, 0, 0, format);
        }
        break;
    }
  }
开发者ID:ClaireBrill,项目名称:GPV,代码行数:98,代码来源:MapMaker.cs

示例8: DrawFeatures

  private void DrawFeatures(Graphics graphics, string layerId, StringCollection ids, Color color, double opacity, string polygonMode, int penWidth, int dotSize)
  {
    if (ids.Count == 0)
    {
      return;
    }

    bool drawPolygonOutlines = polygonMode == "outline";

    // get the layer

    Configuration config = AppContext.GetConfiguration();
    Configuration.LayerRow layerRow = config.Layer.FindByLayerID(layerId);

    CommonDataFrame dataFrame = AppContext.GetDataFrame(_appState.MapTab);
    CommonLayer layer = dataFrame.Layers.FirstOrDefault(lyr => String.Compare(lyr.Name, layerRow.LayerName, true) == 0);

    // build the query string and select the features

    CommonField field = layer.FindField(layerRow.KeyField);
    string joinedIds = field.IsNumeric ? ids.Join(",") : String.Format("'{0}'", ids.Join("','"));
    string query = String.Format("{0} in ({1})", field.Name, joinedIds);

    string levelQuery = layerRow.GetLevelQuery(layer, _appState.Level);

    if (!String.IsNullOrEmpty(levelQuery))
    {
      query += " and " + levelQuery;
    }

    CommonField keyField = layer.FindField(layerRow.KeyField);
    DataTable table = layer.GetFeatureTable(String.Format("{0},{1}", layer.GeometryField.Name, keyField.Name), query);

    if (table == null || table.Rows.Count == 0)
    {
      return;
    }

    OgcGeometryType geometryType = ((IGeometry)table.Rows[0][layer.GeometryField.Name]).OgcGeometryType;

    // prepare the temporary image for drawing transparent highlight graphics

    int width = Convert.ToInt32(graphics.VisibleClipBounds.Width);
    int height = Convert.ToInt32(graphics.VisibleClipBounds.Height);

    Bitmap bitMap = new Bitmap(width, height);
    Graphics imageGraphics = Graphics.FromImage(bitMap);
    imageGraphics.Clear(Color.Transparent);

    // prepare the drawing objects

    Brush brush = new SolidBrush(color);
    Pen pen = new Pen(color, Convert.ToSingle(penWidth * _resolution));
    pen.EndCap = System.Drawing.Drawing2D.LineCap.Square;
    pen.LineJoin = System.Drawing.Drawing2D.LineJoin.Round;
    Pen bufferPen = new Pen(color, Convert.ToSingle(5 * _resolution));
    bufferPen.EndCap = System.Drawing.Drawing2D.LineCap.Round;
    bufferPen.LineJoin = System.Drawing.Drawing2D.LineJoin.Round;

    float dot = Convert.ToSingle(dotSize * _resolution);

    // draw each shape in the table

    foreach (DataRow row in table.Rows)
    {
      switch (geometryType)
      {
        case OgcGeometryType.Point:
          IPoint point = (IPoint)row[layer.GeometryField.Name];
          DrawPoint(imageGraphics, point, brush, dot);
          break;

        case OgcGeometryType.MultiPoint:
          IMultiPoint multiPoint = (IMultiPoint)row[layer.GeometryField.Name];
          DrawPoint(imageGraphics, (IPoint)multiPoint[0], brush, dot);
          break;

        case OgcGeometryType.MultiLineString:
          DrawMultiLineString(imageGraphics, (IMultiLineString)row[layer.GeometryField.Name], pen);
          break;

        case OgcGeometryType.MultiPolygon:
          if (drawPolygonOutlines)
          {
            DrawMultiPolygon(imageGraphics, (IMultiPolygon)row[layer.GeometryField.Name], null, null, pen);
          }
          else
          {
            DrawMultiPolygon(imageGraphics, (IMultiPolygon)row[layer.GeometryField.Name], brush, bufferPen);
          }

          break;
      }
    }

    // draw the temporary image containing the highlight graphics on the output image at
    // the specified opacity

    float[][] matrixItems ={
      new float[] {1, 0, 0, 0, 0},
//.........这里部分代码省略.........
开发者ID:ClaireBrill,项目名称:GPV,代码行数:101,代码来源:MapMaker.cs


注:本文中的StringCollection.Join方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。