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


C# List.Contains方法代码示例

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


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

示例1: buttonReLoan_Click

        private void buttonReLoan_Click(object sender, EventArgs e)
        {
            LibraryReader.LibraryEntities context = new LibraryReader.LibraryEntities();

            List<int> books = new List<int>();

            foreach (DataGridViewRow row in dataGridViewLoaned.SelectedRows)
            {
                if (row.Cells[0].Value != null)
                {
                    books.Add(Convert.ToInt32(row.Cells[0].Value));
                }
            }

            if (books.Count > 0)
            {

                var client = (from c in context.Clients
                              where c.ClientID == id
                              select c).SingleOrDefault();

                foreach (LibraryReader.ClientsBook cBook in client.ClientsBooks)
                {
                    if (books.Contains(cBook.BookID))
                    {
                        cBook.DateLoaned = DateTime.Now;
                        cBook.DateReturned = DateTime.Now.AddMonths(1);
                        MessageBox.Show("Презаписването е успешно!");
                    }
                }

                context.SaveChanges();
            }
        }
开发者ID:nikup,项目名称:Library-IT-Olympiad,代码行数:34,代码来源:FormReturn.cs

示例2: buttonReserve_Click

        private void buttonReserve_Click(object sender, EventArgs e)
        {
            LibraryReader.LibraryEntities context = new LibraryReader.LibraryEntities();

            List<int> books = new List<int>();

            foreach (DataGridViewRow row in dataGridViewBooks.SelectedRows)
            {
                if (row.Cells[0].Value != null)
                {
                    books.Add(Convert.ToInt32(row.Cells[0].Value));
                }
            }

            if (books.Count > 0)
            {

                var client = (from c in context.Clients
                              where c.ClientID == id
                              select c).SingleOrDefault();

                foreach (LibraryReader.ClientsBook cBook in client.ClientsBooks)
                {
                    if (books.Contains(cBook.BookID))
                    {
                        cBook.Reservation = true;
                        MessageBox.Show("Резервирането е успешно!");
                    }
                }

                context.SaveChanges();
            }
        }
开发者ID:nikup,项目名称:Library-IT-Olympiad,代码行数:33,代码来源:FormSearch.cs

示例3: AddUri

        private bool AddUri(string uri)
        {
            lock (_thisLock)
            {
                lock (_amoebaManager.ThisLock)
                {
                    var baseNode = _amoebaManager.BaseNode;

                    var uris = new List<string>(baseNode.Uris);
                    if (uris.Contains(uri) || uris.Count >= Node.MaxUriCount) return false;

                    uris.Add(uri);

                    _amoebaManager.SetBaseNode(new Node(baseNode.Id, uris));
                }
            }

            return true;
        }
开发者ID:Alliance-Network,项目名称:Amoeba,代码行数:19,代码来源:OverlayNetworkManager.cs

示例4: CheckLocation

 private static void CheckLocation(Location location, Location seed, HashSet<Location> alreadyChecked, List<Location> todoList)
 {
     if (location != null && !location.Marked)
     {
         if (!alreadyChecked.Contains(location) && !todoList.Contains(location))
         {
             if (seed.Color.Equals(location.Color))
             {
                 todoList.Insert(0, location);
             }
             else
             {
                 todoList.Add(location);
             }
         }
     }
 }
开发者ID:neuroradiology,项目名称:Sxz,代码行数:17,代码来源:ParseImage.cs

示例5: AddUri

        private bool AddUri(string uri)
        {
            lock (this.ThisLock)
            {
                lock (_outoposManager.ThisLock)
                {
                    var baseNode = _outoposManager.BaseNode;

                    var uris = new List<string>(baseNode.Uris);
                    if (uris.Contains(uri)) return false;

                    uris.Add(uri);

                    _outoposManager.SetBaseNode(new Node(baseNode.Id, uris));
                }
            }

            return true;
        }
开发者ID:networkelements,项目名称:Outopos,代码行数:19,代码来源:AutoBaseNodeSettingManager.cs

示例6: ArrayList

 private void _路线属性_VisibilityChange(bool isvisible)
 {
     ListBoxEx innerControl = this._路线属性.InnerControl as ListBoxEx;
     if (!isvisible)
     {
         string str = "";
         new List<string>();
         ListBox.SelectedObjectCollection selectedItems = innerControl.SelectedItems;
         int count = innerControl.Items.Count;
         ArrayList list = new ArrayList(count);
         int val = 0;
         for (int i = 0; i < count; i++)
         {
             if (selectedItems.Contains(innerControl.Items[i]))
             {
                 ListBoxItem item = innerControl.Items[i] as ListBoxItem;
                 val |= Convert.ToInt32(item.Tag.ToString());
                 str = str + item.Name.ToString() + ",";
             }
         }
         this.setTimeSpeedReadOnly(this.dgvSubSpeedParam.CurrentRow, val);
         list.Add(Convert.ToString(val, 2).PadLeft(6, '0').ToCharArray());
         if (this.dgvSubSpeedParam.CurrentCell != null)
         {
             try
             {
                 this.dgvSubSpeedParam.CurrentCell.Value = str.Trim(",".ToCharArray());
                 this.dgvSubSpeedParam.CurrentCell.Tag = list;
             }
             catch (Exception)
             {
             }
         }
     }
     else
     {
         innerControl.ClearSelected();
         if (this.dgvSubSpeedParam.CurrentCell.Tag == null)
         {
             List<string> list2 = new List<string>();
             list2.AddRange(this.dgvSubSpeedParam.CurrentCell.Value.ToString().Split(",".ToCharArray()));
             int num4 = innerControl.Items.Count;
             for (int j = 0; j < num4; j++)
             {
                 ListBoxItem item2 = innerControl.Items[j] as ListBoxItem;
                 if (list2.Contains(item2.Name))
                 {
                     innerControl.SetSelected(j, true);
                 }
             }
         }
         else if (this.dgvSubSpeedParam.CurrentCell.Tag != null)
         {
             ArrayList tag = this.dgvSubSpeedParam.CurrentCell.Tag as ArrayList;
             if ((tag[0] as char[])[0].ToString().Equals("1"))
             {
                 innerControl.SetSelected(4, true);
             }
             else
             {
                 innerControl.SetSelected(4, false);
             }
             if ((tag[0] as char[])[1].ToString().Equals("1"))
             {
                 innerControl.SetSelected(3, true);
             }
             else
             {
                 innerControl.SetSelected(3, false);
             }
             if ((tag[0] as char[])[2].ToString().Equals("1"))
             {
                 innerControl.SetSelected(2, true);
             }
             else
             {
                 innerControl.SetSelected(2, false);
             }
             if ((tag[0] as char[])[3].ToString().Equals("1"))
             {
                 innerControl.SetSelected(1, true);
             }
             else
             {
                 innerControl.SetSelected(1, false);
             }
             if ((tag[0] as char[])[5].ToString().Equals("1"))
             {
                 innerControl.SetSelected(0, true);
             }
             else
             {
                 innerControl.SetSelected(0, false);
             }
         }
     }
 }
开发者ID:lexzh,项目名称:Myproject,代码行数:97,代码来源:JTBitmSegPathEX.cs

示例7: InitGridView

 private void InitGridView()
 {
     try
     {
         string strCarId = (base.sCarId.Split(",".ToCharArray()).Length > 1) ? base.sCarId.Split(",".ToCharArray())[0] : base.sCarId;
         DataTable table = RemotingClient.Car_GetPathAlarm(strCarId);
         this._路段属性DT = RemotingClient.Car_GetPathSegmentAlarm(strCarId);
         if (this._路段属性DT != null)
         {
             DataTable table2 = this._路段属性DT.Clone();
             Hashtable hashtable = new Hashtable();
             foreach (DataRow row in this._路段属性DT.Rows)
             {
                 if (!hashtable.ContainsKey(row["PathSegmentID"]))
                 {
                     table2.Rows.Add(row.ItemArray);
                     hashtable[row["PathSegmentID"]] = "";
                 }
             }
             this._路段属性DT = table2;
             this._路段source.DataSource = this._路段属性DT;
             DataColumn column = new DataColumn("SegmentFlagValue") {
                 DefaultValue = 0
             };
             this._路段属性DT.Columns.Add(column);
             try
             {
                 this._路段属性DT.PrimaryKey = new DataColumn[] { this._路段属性DT.Columns["PathSegmentID"] };
             }
             catch (Exception exception)
             {
                 MessageBox.Show("初始化路段数据时存在脏数据,请检查!");
                 Record.execFileRecord("分段路线报警设置-->获取数据时路段数据存在脏数据", exception.Message);
             }
         }
         if (table != null)
         {
             if (!table.Columns.Contains("PathFlag"))
             {
                 table.Columns.Add(new DataColumn("PathFlag"));
             }
             table.Columns["PathFlag"].ReadOnly = false;
             DataColumn column2 = new DataColumn("PathSegment") {
                 DefaultValue = "设置"
             };
             table.Columns.Add(column2);
             List<string> list = new List<string>();
             if ((this._路段属性DT != null) && (this._路段属性DT.Rows.Count > 0))
             {
                 foreach (DataRow row2 in this._路段属性DT.Select("Flag is not null"))
                 {
                     if (!list.Contains(row2["PathID"].ToString()))
                     {
                         list.Add(row2["PathID"].ToString());
                     }
                     if (row2["Flag"] != null)
                     {
                         row2["SegmentFlagValue"] = row2["Flag"];
                         int result = 0;
                         string str2 = "";
                         if (int.TryParse(row2["Flag"].ToString(), out result))
                         {
                             if ((result & 1) != 0)
                             {
                                 str2 = str2 + "行驶时间,";
                             }
                             if ((result & 2) != 0)
                             {
                                 str2 = str2 + "限速,";
                             }
                             if ((result & 4) != 0)
                             {
                                 str2 = str2 + "南纬,";
                             }
                             if ((result & 8) != 0)
                             {
                                 str2 = str2 + "西经,";
                             }
                             row2["Flag"] = str2.Trim(new char[] { ',' });
                         }
                     }
                 }
             }
             foreach (DataRow row3 in table.Rows)
             {
                 if (this._路段属性DT.Select("PathId = '" + row3["PathID"].ToString() + "'").Length > 0)
                 {
                     DataRow row4 = this.m_dtSegPathData.NewRow();
                     row4["PathName"] = row3["PathName"];
                     row4["PathID"] = row3["PathID"];
                     row4["carID"] = row3["carID"];
                     row4["Choose"] = row3["Choose"];
                     row4["IsChoose"] = row3["IsChoose"];
                     row4["HoldTime"] = row3["HoldTime"];
                     row4["TopSpeed"] = row3["TopSpeed"];
                     row4["BeginTime"] = row3["BeginTime"];
                     row4["EndTime"] = row3["EndTime"];
                     row4["PathGroupID"] = row3["PathGroupID"];
                     row4["PathFlag"] = row3["PathFlag"];
                     int val = 0;
//.........这里部分代码省略.........
开发者ID:lexzh,项目名称:Myproject,代码行数:101,代码来源:JTBitmSegPathEX.cs

示例8: InitGridView

 private void InitGridView()
 {
     try
     {
         string str = ((int)this.sCarId.Split(",".ToCharArray()).Length > 1 ? this.sCarId.Split(",".ToCharArray())[0] : this.sCarId);
         this.m_dtSegPathData = RemotingClient.Car_GetPathAlarm(str);
         this._路段属性DT = RemotingClient.Car_GetPathSegmentAlarm(str);
         if (this._路段属性DT != null)
         {
             DataTable dataTable = this._路段属性DT.Clone();
             Hashtable hashtables = new Hashtable();
             foreach (DataRow row in this._路段属性DT.Rows)
             {
                 if (hashtables.ContainsKey(row["PathSegmentID"]))
                 {
                     continue;
                 }
                 dataTable.Rows.Add(row.ItemArray);
                 hashtables[row["PathSegmentID"]] = "";
             }
             this._路段属性DT = dataTable;
             this._路段source.DataSource = this._路段属性DT;
             DataColumnCollection columns = this._路段属性DT.Columns;
             DataColumn dataColumn = new DataColumn("SegmentFlagValue")
             {
                 DefaultValue = 0
             };
             columns.Add(dataColumn);
             try
             {
                 DataTable dataTable1 = this._路段属性DT;
                 DataColumn[] item = new DataColumn[] { this._路段属性DT.Columns["PathSegmentID"] };
                 dataTable1.PrimaryKey = item;
             }
             catch (Exception exception1)
             {
                 Exception exception = exception1;
                 MessageBox.Show("初始化路段数据时存在脏数据,请检查!");
                 Record.execFileRecord("分段路线报警设置-->获取数据时路段数据存在脏数据", exception.Message);
             }
         }
         if (this.m_dtSegPathData != null)
         {
             if (!this.m_dtSegPathData.Columns.Contains("PathFlag"))
             {
                 this.m_dtSegPathData.Columns.Add(new DataColumn("PathFlag"));
             }
             this.m_dtSegPathData.Columns["PathFlag"].ReadOnly = false;
             this.m_dtSegPathData.Columns.Add(new DataColumn("PathSegment")
             {
                 DefaultValue = "设置"
             });
             List<string> strs = new List<string>();
             if (this._路段属性DT != null && this._路段属性DT.Rows.Count > 0)
             {
                 DataRow[] dataRowArray = this._路段属性DT.Select("Flag is not null");
                 for (int i = 0; i < (int)dataRowArray.Length; i++)
                 {
                     DataRow dataRow = dataRowArray[i];
                     if (!strs.Contains(dataRow["PathID"].ToString()))
                     {
                         strs.Add(dataRow["PathID"].ToString());
                     }
                     if (dataRow["Flag"] != null)
                     {
                         dataRow["SegmentFlagValue"] = dataRow["Flag"];
                         int num = 0;
                         string str1 = "";
                         if (int.TryParse(dataRow["Flag"].ToString(), out num))
                         {
                             if ((num & 1) != 0)
                             {
                                 str1 = string.Concat(str1, "行驶时间,");
                             }
                             if ((num & 2) != 0)
                             {
                                 str1 = string.Concat(str1, "限速,");
                             }
                             if ((num & 4) != 0)
                             {
                                 str1 = string.Concat(str1, "南纬,");
                             }
                             if ((num & 8) != 0)
                             {
                                 str1 = string.Concat(str1, "西经,");
                             }
                             char[] chrArray = new char[] { ',' };
                             dataRow["Flag"] = str1.Trim(chrArray);
                         }
                     }
                 }
             }
             foreach (DataRow value in this.m_dtSegPathData.Rows)
             {
                 int num1 = 0;
                 bool flag = (value["choose"] == null || !value["choose"].ToString().Equals("1") ? false : true);
                 if (strs.Contains(value["PathID"].ToString()) && flag)
                 {
                     value["PathSegment"] = "已设置";
                 }
//.........这里部分代码省略.........
开发者ID:lexzh,项目名称:Myproject,代码行数:101,代码来源:JTBitmSegPath.cs

示例9: ArrayList

 private void _区域属性_VisibilityChange(bool isvisible)
 {
     ListBoxEx innerControl = this._区域属性.InnerControl as ListBoxEx;
     if (!isvisible)
     {
         string str = "";
         new List<string>();
         ListBox.SelectedObjectCollection selectedItems = innerControl.SelectedItems;
         int count = innerControl.Items.Count;
         ArrayList val = new ArrayList(count);
         for (int i = 0; i < count; i++)
         {
             string str2 = "";
             if (selectedItems.Contains(innerControl.Items[i]))
             {
                 str2 = "1";
                 ListBoxItem item = innerControl.Items[i] as ListBoxItem;
                 str = str + item.Name.ToString() + ",";
             }
             else
             {
                 str2 = "0";
             }
             val.Add(str2);
         }
         this.setTimeSpeedReadOnly(this.dgvArea.CurrentRow, val);
         if (this.dgvArea.CurrentCell != null)
         {
             this.dgvArea.CurrentCell.Value = str.Trim(",".ToCharArray());
             this.dgvArea.CurrentCell.Tag = val;
         }
     }
     else
     {
         innerControl.ClearSelected();
         if (this.dgvArea.CurrentCell.Tag == null)
         {
             List<string> list2 = new List<string>();
             list2.AddRange(this.dgvArea.CurrentCell.Value.ToString().Split(",".ToCharArray()));
             int num3 = innerControl.Items.Count;
             for (int j = 0; j < num3; j++)
             {
                 ListBoxItem item2 = innerControl.Items[j] as ListBoxItem;
                 if (list2.Contains(item2.Name))
                 {
                     innerControl.SetSelected(j, true);
                 }
             }
         }
         else if (this.dgvArea.CurrentCell.Tag != null)
         {
             ArrayList tag = this.dgvArea.CurrentCell.Tag as ArrayList;
             for (int k = 0; k < innerControl.Items.Count; k++)
             {
                 innerControl.SetSelected(k, tag[k].ToString().Equals("1"));
             }
         }
     }
 }
开发者ID:lexzh,项目名称:Myproject,代码行数:59,代码来源:JTBitmSetRegionAlarm.cs

示例10: ArrayList

 private void _路线属性_VisibilityChange(bool isvisible)
 {
     ListBoxEx innerControl = this._路线属性.InnerControl as ListBoxEx;
     if (isvisible)
     {
         innerControl.ClearSelected();
         if (this.dgvSubSpeedParam.CurrentCell.Tag == null)
         {
             List<string> strs = new List<string>();
             strs.AddRange(this.dgvSubSpeedParam.CurrentCell.Value.ToString().Split(",".ToCharArray()));
             int count = innerControl.Items.Count;
             for (int i = 0; i < count; i++)
             {
                 if (strs.Contains((innerControl.Items[i] as ListBoxItem).Name))
                 {
                     innerControl.SetSelected(i, true);
                 }
             }
             return;
         }
         if (this.dgvSubSpeedParam.CurrentCell.Tag != null)
         {
             ArrayList tag = this.dgvSubSpeedParam.CurrentCell.Tag as ArrayList;
             if (!(tag[0] as char[])[0].ToString().Equals("1"))
             {
                 innerControl.SetSelected(4, false);
             }
             else
             {
                 innerControl.SetSelected(4, true);
             }
             if (!(tag[0] as char[])[1].ToString().Equals("1"))
             {
                 innerControl.SetSelected(3, false);
             }
             else
             {
                 innerControl.SetSelected(3, true);
             }
             if (!(tag[0] as char[])[2].ToString().Equals("1"))
             {
                 innerControl.SetSelected(2, false);
             }
             else
             {
                 innerControl.SetSelected(2, true);
             }
             if (!(tag[0] as char[])[3].ToString().Equals("1"))
             {
                 innerControl.SetSelected(1, false);
             }
             else
             {
                 innerControl.SetSelected(1, true);
             }
             if ((tag[0] as char[])[5].ToString().Equals("1"))
             {
                 innerControl.SetSelected(0, true);
                 return;
             }
             innerControl.SetSelected(0, false);
         }
     }
     else
     {
         string str = "";
         List<string> strs1 = new List<string>();
         ListBox.SelectedObjectCollection selectedItems = innerControl.SelectedItems;
         int num = innerControl.Items.Count;
         ArrayList arrayLists = new ArrayList(num);
         int num1 = 0;
         for (int j = 0; j < num; j++)
         {
             if (selectedItems.Contains(innerControl.Items[j]))
             {
                 ListBoxItem item = innerControl.Items[j] as ListBoxItem;
                 num1 = num1 | Convert.ToInt32(item.Tag.ToString());
                 str = string.Concat(str, item.Name.ToString(), ",");
             }
         }
         this.setTimeSpeedReadOnly(this.dgvSubSpeedParam.CurrentRow, num1);
         arrayLists.Add(Convert.ToString(num1, 2).PadLeft(6, '0').ToCharArray());
         if (this.dgvSubSpeedParam.CurrentCell != null)
         {
             try
             {
                 this.dgvSubSpeedParam.CurrentCell.Value = str.Trim(",".ToCharArray());
                 this.dgvSubSpeedParam.CurrentCell.Tag = arrayLists;
             }
             catch (Exception exception)
             {
             }
         }
     }
 }
开发者ID:lexzh,项目名称:Myproject,代码行数:95,代码来源:JTBitmSegPath.cs

示例11: draw

        private void draw()
        {
            this.Text = "LAN-CDS: D:" + Utilities.FormatFileSize(tEngine.engine.TotalDownloadSpeed) + " U:" + Utilities.FormatFileSize(tEngine.engine.TotalUploadSpeed);

            //this.toolStripStatusLabel2.Text = tEngine.engine.DhtEngine.;

            List<string> covered = new List<string>();

            foreach (ListViewItem item in listView1.Items)
            {
                string hash = (string)item.Tag;
                if (localTorrents.Contains(hash))// local always has priority
                {
                    if (remoteTorrents.Contains(hash))
                        remoteTorrents.Remove(hash);
                    // updates on progress, status, availability
                    TorrentManager manager = tEngine.getTorrentByHash(hash);
                    string newText = manager.State.ToString() + ": " + Math.Round( manager.Progress,2).ToString() + "%";
                    if(newText != item.SubItems["progress"].Text)
                        item.SubItems["progress"].Text = newText;
                    if (item.Group == listView1.Groups["remote"])
                        item.Group = listView1.Groups["local"];
                    item.ToolTipText = manager.Peers.Seeds.ToString() + " friends have it. " + manager.Peers.Leechs.ToString() + " are getting it.";

                }
                else if (remoteTorrents.Contains(hash))
                {
                    // these won't have much to update as they are remote torrents, not loaded locally at all
                    // might have to check for new torrents available on the server
                }
                else
                {
                    // where the hell did it come from?!
                    item.Remove();
                }
                covered.Add(hash);
            }

            foreach (string hash in localTorrents)
            {
                if (!covered.Contains(hash))
                {
                    if (remoteTorrents.Contains(hash))
                        remoteTorrents.Remove(hash);
                    TorrentManager manager = tEngine.getTorrentByHash(hash);
                    if (manager.HasMetadata)
                    {
                        MonoTorrent.Common.Torrent torrent = manager.Torrent;
                        listView1.Items.Add(defaultItem(torrent.Name, manager.State.ToString(), hash, "Local"));
                    }
                    else
                    {
                        listView1.Items.Add(defaultItem(manager.SavePath, manager.State.ToString(), hash, "Local"));
                    }
                }
            }

            foreach (string hash in remoteTorrents)
            {
                if (!covered.Contains(hash))
                {
                    Cleverscape.UTorrentClient.WebClient.Torrent torrent = getTorrentByHash(hash);

                    listView1.Items.Add(defaultItem(torrent.Name, "", hash, "Remote"));
                }
            }
        }
开发者ID:descention,项目名称:LAN-CDS,代码行数:67,代码来源:Form1.cs

示例12: tCheckSeparateSticky_Elapsed

 private void tCheckSeparateSticky_Elapsed(object sender, ElapsedEventArgs e)
 {
     this.tCheckSeparateSticky.Enabled = false;
     try
     {
         try
         {
             DataTable busRouteConfig = this.getBusRouteConfig();
             this.clearHashT();
             if (busRouteConfig != null && busRouteConfig.Rows.Count > 0)
             {
                 DateTime svrTime = ReadDataFromDB.GetSvrTime();
                 this.initInputXML();
                 string str = "";
                 string str1 = "";
                 string str2 = "";
                 string[] strArrays = new string[2];
                 bool flag = false;
                 List<string> strs = new List<string>();
                 foreach (DataRow row in busRouteConfig.Rows)
                 {
                     str = row["RouteId"].ToString();
                     if (strs.Contains(str))
                     {
                         continue;
                     }
                     strs.Add(str);
                     this.htRouteList[str] = row["RouteName"].ToString();
                     str1 = row["Separate"].ToString();
                     str2 = row["Sticky"].ToString();
                     strArrays[0] = row["PathDotUp"].ToString();
                     strArrays[1] = row["PathDotDown"].ToString();
                     if (string.IsNullOrEmpty(strArrays[0]) && string.IsNullOrEmpty(strArrays[1]))
                     {
                         continue;
                     }
                     DataTable busPosInfo = this.getBusPosInfo(str, svrTime);
                     if (busPosInfo == null || busPosInfo.Rows.Count <= 0)
                     {
                         continue;
                     }
                     XmlElement busesInfo = this.getBusesInfo(busPosInfo);
                     this.setRouteLine(str, str1, str2, strArrays[0], strArrays[1], busesInfo);
                     flag = true;
                 }
                 this.dtNow = svrTime;
                 if (flag)
                 {
                     LogMsg logMsg = new LogMsg("PlatformAlarmPathAlarm", "tCheckSeparateSticky_Elapsed", "")
                     {
                         Msg = string.Concat("脱车粘车传 入 的xml:\r\n", this.xDoc.OuterXml)
                     };
                     this.logHelper.WriteLog(logMsg);
                     string separateAndStickyCars = ReadDataFromGis.GetSeparateAndStickyCars(this.xDoc.OuterXml);
                     logMsg.Msg = string.Concat("脱车粘车传 回 的xml:\r\n", separateAndStickyCars);
                     this.logHelper.WriteLog(logMsg);
                     if (!string.IsNullOrEmpty(separateAndStickyCars))
                     {
                         this.ltAlarmBus = new List<AlarmBus>();
                         this.AnalysisOutputXML(separateAndStickyCars);
                     }
                     this.InsertAlarmInfo(this.ltAlarmBus);
                 }
             }
         }
         catch (Exception exception1)
         {
             Exception exception = exception1;
             ErrorMsg errorMsg = new ErrorMsg("SeparateAndSticky", "tCheckSeparateSticky_Elapsed", string.Concat("定时检测脱车粘车报警错误,", exception.Message));
             this.logHelper.WriteError(errorMsg);
         }
     }
     finally
     {
         if (this.ltAlarmBus != null)
         {
             this.ltAlarmBus.Clear();
             this.ltAlarmBus = null;
         }
         if (this.dtBusesPosInfo != null)
         {
             this.dtBusesPosInfo.Rows.Clear();
             this.dtBusesPosInfo = null;
         }
         this.tCheckSeparateSticky.Enabled = true;
     }
 }
开发者ID:lexzh,项目名称:Myproject,代码行数:87,代码来源:SeparateAndSticky.cs

示例13: Olll001l11

 private void Olll001l11(DataTable dataTable)
 {
     this.clbItems.Items.Clear();
     if ((dataTable != null) && (dataTable.Rows.Count > 0))
     {
         foreach (DataRow row in dataTable.Rows)
         {
             string text = row[this.pathName].ToString();
             string str2 = row[this.pathId].ToString();
             ListItem item = new ListItem(text, str2);
             if (this.clbItems.Items.IndexOf(item) < 0)
             {
                 if (string.IsNullOrEmpty(this.sLines))
                 {
                     this.clbItems.Items.Add(item, false);
                 }
                 else
                 {
                     List<string> list = new List<string>(this.sLines.Split(new char[] { ',' }));
                     string str3 = row[this.pathId].ToString();
                     if (list.Contains(str3))
                     {
                         item.Selected = true;
                         this.clbItems.Items.Add(item, true);
                     }
                     else
                     {
                         item.Selected = false;
                         this.clbItems.Items.Add(item, false);
                     }
                 }
             }
         }
         this.O0O000llOl();
     }
     else
     {
         System.Web.UI.WebControls.CheckBox box = new System.Web.UI.WebControls.CheckBox
         {
             Text = "(无)"
         };
         this.clbItems.Items.Add(box, false);
     }
 }
开发者ID:lexzh,项目名称:Myproject,代码行数:44,代码来源:ShowPathForm.cs

示例14: ArrayList

 private void _路线属性_VisibilityChange(bool isvisible)
 {
     ListBoxEx innerControl = this._路线属性.InnerControl as ListBoxEx;
     if (!isvisible)
     {
         string str = "";
         new List<string>();
         ListBox.SelectedObjectCollection selectedItems = innerControl.SelectedItems;
         int count = innerControl.Items.Count;
         ArrayList list = new ArrayList(count);
         for (int i = 0; i < count; i++)
         {
             string str2 = "";
             if (selectedItems.Contains(innerControl.Items[i]))
             {
                 str2 = "1";
                 Client.ListBoxItem item = innerControl.Items[i] as Client.ListBoxItem;
                 str = str + item.Name.ToString() + ",";
             }
             else
             {
                 str2 = "0";
             }
             list.Add(str2);
         }
         if (this.dgvPath.CurrentCell != null)
         {
             try
             {
                 this.dgvPath.CurrentCell.Value = str.Trim(",".ToCharArray());
                 this.dgvPath.CurrentCell.Tag = list;
             }
             catch (Exception)
             {
             }
         }
     }
     else
     {
         innerControl.ClearSelected();
         if (this.dgvPath.CurrentCell.Tag == null)
         {
             if (this.dgvPath.CurrentCell.Value != null)
             {
                 List<string> list2 = new List<string>();
                 list2.AddRange(this.dgvPath.CurrentCell.Value.ToString().Split(",".ToCharArray()));
                 int num3 = innerControl.Items.Count;
                 for (int j = 0; j < num3; j++)
                 {
                     Client.ListBoxItem item2 = innerControl.Items[j] as Client.ListBoxItem;
                     if (list2.Contains(item2.Name))
                     {
                         innerControl.SetSelected(j, true);
                     }
                 }
             }
         }
         else if (this.dgvPath.CurrentCell.Tag != null)
         {
             ArrayList tag = this.dgvPath.CurrentCell.Tag as ArrayList;
             for (int k = 0; k < innerControl.Items.Count; k++)
             {
                 innerControl.SetSelected(k, tag[k].ToString().Equals("1"));
             }
         }
     }
 }
开发者ID:lexzh,项目名称:Myproject,代码行数:67,代码来源:JTBSetPathAlarm.cs


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