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


C# SortableBindingList.Add方法代码示例

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


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

示例1: Update

 internal void Update()
 {
     var typeList = _model.GetTypesFromGroup(_groupID);
     var infoList = new SortableBindingList<EveTypeInfo>();
     foreach (var type in typeList)
         infoList.Add(EveTypeInfoRepository.GetEveTypeInfo(type));
        _list.DataObject = infoList;
 }
开发者ID:jburchhardt,项目名称:EveStuff,代码行数:8,代码来源:EveTypeManager.cs

示例2: LoadMyAuctions

        public SortableBindingList<Auction> LoadMyAuctions()
        {
            var results = new SortableBindingList<Auction>();
            var items = Context.Auctions.AsQueryable();
            foreach (var res  in items)
            {
                results.Add(res.ToDomainObject());
            }

            return results;
        }
开发者ID:Alchemy86,项目名称:DAS-Desktop,代码行数:11,代码来源:UserDesktopRepository.cs

示例3: LegendDuplicatorForm

        public LegendDuplicatorForm(InputData inputData)
        {
            this.inputData = inputData;

            InitializeComponent();

            // populate data grid view with sheets
            SortableBindingList<SheetWrapper> sheetBindingList = new SortableBindingList<SheetWrapper>();
            foreach (SheetWrapper sw in inputData.Sheets)
            {
                sheetBindingList.Add(sw);
            }
            dgvSheets.AutoGenerateColumns = false;
            dgvSheets.DataSource = sheetBindingList;

        }
开发者ID:cridder,项目名称:archi-lab.net,代码行数:16,代码来源:LegendDuplicatorForm.cs

示例4: BindTeams

        public void BindTeams(League lge)
        {
            teamGrid.Columns["abbrevColumn"].DataPropertyName = "Abbrev";
            teamGrid.Columns["teamNameColumn"].DataPropertyName = "Name";
            teamGrid.Columns["winsColumn"].DataPropertyName = "Wins";
            teamGrid.Columns["lossesColumn"].DataPropertyName = "Losses";

            bindingList = new SortableBindingList<Team>();

            teams = lge.Teams;

            foreach (Team tm in teams)
            {
                bindingList.Add(tm);
            }

            teamGrid.DataSource = bindingList;
        }
开发者ID:cdkmoose,项目名称:ShowDownSharp,代码行数:18,代码来源:TeamListForm.cs

示例5: BindPlayers

        public void BindPlayers(League lge)
        {
            playerGrid.Columns[0].DataPropertyName = "Name";
            playerGrid.Columns[1].DataPropertyName = "CardSeason";
            playerGrid.Columns[2].DataPropertyName = "CardTeam";
            playerGrid.Columns[3].DataPropertyName = "Points";
            playerGrid.Columns[4].DataPropertyName = "PositionText";
            playerGrid.Columns[5].DataPropertyName = "KeyStatLine";

            SortableBindingList<Player> players = new SortableBindingList<Player>();

            foreach (Player plyr in lge.PlayerList.Values)
            {
                players.Add(plyr);
            }

            playerGrid.DataSource = players;
        }
开发者ID:cdkmoose,项目名称:ShowDownSharp,代码行数:18,代码来源:PlayerListForm.cs

示例6: SetCurrentDatabase

        private void SetCurrentDatabase(PogsDatabase pogsDatabase)
        {
            if (pogsDatabase != null)
            {
                using (var ls = new LockScreen(pogsDatabase))
                {
                    if (ls.ShowDialog() != DialogResult.OK)
                    {
                        return;
                    }
                }
            }

            if (this.CurrentDatabase != null)
            {
                this.CurrentDatabase.ConnectionUnexpectedlyClosed -= new EventHandler(CurrentDatabase_ConnectionUnexpectedlyClosed);
                this.CurrentDatabase.ClientsAdded -= new EventHandler<ClientRecordEventArgs>(CurrentDatabase_ClientsAdded);
                this.CurrentDatabase.ClientsRemoved -= new EventHandler<ClientRecordEventArgs>(CurrentDatabase_ClientsRemoved);
                this.CurrentDatabase.Dispose();
            }

            this.CurrentDatabase = pogsDatabase;

            if (this.CurrentDatabase == null)
            {
                this.Text = "Pogs";
                _clients = null;
                clientListBindingSource.DataSource = typeof(ClientRecord);
                addClientButton.Enabled = false;
                newClientToolStripMenuItem.Enabled = false;
                changePINToolStripMenuItem.Enabled = false;
            }
            else
            {
                this.Text = String.Format("Pogs - [{0} on {1}]", pogsDatabase.DatabaseName, pogsDatabase.ServerName);

                this.CurrentDatabase.Refresh(this.CurrentDatabase.DefaultSecurity);
                this.CurrentDatabase.RefreshClientList();

                //set up the initial client list
                _clients = new SortableBindingList<ClientRecord>();
                foreach (var client in this.CurrentDatabase.Clients)
                    _clients.Add(client);

                clientListBindingSource.DataSource = _clients;

                //listen for future changes
                this.CurrentDatabase.ConnectionUnexpectedlyClosed += new EventHandler(CurrentDatabase_ConnectionUnexpectedlyClosed);
                this.CurrentDatabase.ClientsAdded += new EventHandler<ClientRecordEventArgs>(CurrentDatabase_ClientsAdded);
                this.CurrentDatabase.ClientsRemoved += new EventHandler<ClientRecordEventArgs>(CurrentDatabase_ClientsRemoved);

                //set up the UI
                addClientButton.Enabled = this.CurrentDatabase.CurrentUser.IsAdmin;
                newClientToolStripMenuItem.Enabled = true;
                changePINToolStripMenuItem.Enabled = true;
            }
        }
开发者ID:kevinmmccormick,项目名称:POGS,代码行数:57,代码来源:MainForm.cs

示例7: UpdateSuggestionsAsync

 private void UpdateSuggestionsAsync(double minPp, int gameMode)
 {
     scoreSugDisplay = new SortableBindingList<ScoreInfo>();
     beatmapCache = new Dictionary<int, Beatmap>();
     for (int index = 0; index < currentUser.BestScores.Count; index++)
     {
         var score = currentUser.BestScores[index];
         beatmapCache.Add(score.Beatmap_Id, null);
     }
     string statsjson = "";
     Debug.WriteLine(@"http://osustats.ezoweb.de/API/osuTrainer.php?mode=" + gameMode + @"&pp_value=" + (int)minPp + @"&mod_only_selected=" + ExclusiveCB.Checked.ToString().ToLower() + @"&mod_string=" + SelectedModsToString());
     try
     {
         statsjson = client.DownloadString(@"http://osustats.ezoweb.de/API/osuTrainer.php?mode=" + gameMode + @"&pp_value=" + (int)minPp + @"&mod_only_selected=" + ExclusiveCB.Checked.ToString().ToLower() + @"&mod_string=" + SelectedModsToString());
     }
     catch (Exception)
     {
         return;
     }           
     if (statsjson.Length < 3) return;
     var osuStatsScores = JsonSerializer.DeserializeFromString<List<OsuStatsScores>>(statsjson);
     osuStatsScores =
         osuStatsScores.GroupBy(e => new { e.Beatmap_Id, e.Enabled_Mods }).Select(g => g.First()).ToList();
     for (int i = 0; i < osuStatsScores.Count; i++)
     {
         if (beatmapCache.ContainsKey((osuStatsScores[i].Beatmap_Id))) continue;
         var dtmodifier = 1.0;
         var beatmap = new Beatmap
         {
             Beatmap_id = osuStatsScores[i].Beatmap_Id,
             BeatmapSet_id = osuStatsScores[i].Beatmap_SetId,
             Total_length = osuStatsScores[i].Beatmap_Total_Length,
             Hit_length = osuStatsScores[i].Beatmap_Hit_Length,
             Version = osuStatsScores[i].Beatmap_Version,
             Artist = osuStatsScores[i].Beatmap_Artist,
             Title = osuStatsScores[i].Beatmap_Title,
             Creator = osuStatsScores[i].Beatmap_Creator,
             Bpm = osuStatsScores[i].Beatmap_Bpm,
             Difficultyrating = osuStatsScores[i].Beatmap_Diffrating,
             Url = GlobalVars.Beatmap + osuStatsScores[i].Beatmap_Id,
             BloodcatUrl = GlobalVars.Bloodcat + osuStatsScores[i].Beatmap_SetId,
             ThumbnailUrl = @"http://b.ppy.sh/thumb/" + osuStatsScores[i].Beatmap_SetId + @"l.jpg"
         };
         beatmapCache[osuStatsScores[i].Beatmap_Id] = beatmap;
         if (osuStatsScores[i].Enabled_Mods.HasFlag(GlobalVars.Mods.DT) || osuStatsScores[i].Enabled_Mods.HasFlag(GlobalVars.Mods.NC))
         {
             dtmodifier = 1.5;
         }
         scoreSugDisplay.Add(new ScoreInfo
         {
             Mods = (osuStatsScores[i].Enabled_Mods & ~GlobalVars.Mods.Autoplay),
             BeatmapName = osuStatsScores[i].Beatmap_Title,
             Version = osuStatsScores[i].Beatmap_Version,
             Creator = osuStatsScores[i].Beatmap_Creator,
             Artist = osuStatsScores[i].Beatmap_Artist,
             BPM = (int)Math.Truncate(beatmap.Bpm * dtmodifier),
             ppRaw = (int)Math.Truncate(osuStatsScores[i].PP_Value),
             RankImage = GetRankImage(osuStatsScores[i].Rank),
             BeatmapId = osuStatsScores[i].Beatmap_Id
         });
         Invoke((MethodInvoker)delegate
         {
             if (progressBar1.Value < pbMax)
             {
                 progressBar1.Value++;
             }
             ScoresAddedLbl.Text = Convert.ToString(scoreSugDisplay.Count);
         });
     }
 }
开发者ID:Leon1405,项目名称:osuTrainer,代码行数:70,代码来源:OsuTrainerOS.cs

示例8: CswObjectsToSortableBindingList

 private SortableBindingList<CswRecord> CswObjectsToSortableBindingList(CswObjects cswObjs)
 {
         SortableBindingList<CswRecord> csws = new SortableBindingList<CswRecord>();
         for (int i = 0; i < cswObjs.Count; i++)
         {
             csws.Add((CswRecord)cswObjs[i]);
         }
         return csws;
 }
开发者ID:Geoneer,项目名称:pdok-extensie,代码行数:9,代码来源:CswSearch.cs

示例9: cloneStudents

        private SortableBindingList<StudentViewModel> cloneStudents(SortableBindingList<StudentViewModel> students)
        {
            SortableBindingList<StudentViewModel> clonedStudents = new SortableBindingList<StudentViewModel>();
            foreach (StudentViewModel student in students)
            {
                clonedStudents.Add((StudentViewModel)student.Clone());
            }

            return clonedStudents;
        }
开发者ID:akauffmanGG,项目名称:Gradebook,代码行数:10,代码来源:SchoolYearViewModel.cs

示例10: button12_Click

        private void button12_Click(object sender, EventArgs e)
        {
            Program.addAmount = 0;
            Program.tasks = 1;

            SortableBindingList<Bookmark> allURLs = new SortableBindingList<Bookmark>();
            foreach (ObjectCheckBox checkBox in ((Button)sender).Parent.Controls.OfType<ObjectCheckBox>().Where(box => box.Checked == true && box.SyncOrGet == ObjectCheckBox.SyncOrGetEnum.Get))
            {
                allURLs.Union(checkBox.Binding.ReturnBookmarks(), new Program.BookmarkComparer()).ToList().ForEach(a => allURLs.Add(a));
            }

            Display.DisplayBookmarks(allURLs);
        }
开发者ID:CCInc,项目名称:CCWinformsCode,代码行数:13,代码来源:Form1.cs

示例11: Search

        public IQueryable<AuctionSearch> Search(string searchText)
        {
            const string searchString = "https://auctions.godaddy.com/trpSearchResults.aspx";
            var auctions = new SortableBindingList<AuctionSearch>();

            var doc = HtmlDocument(Post(searchString,
                "t=16&action=search&hidAdvSearch=ddlAdvKeyword:1|txtKeyword:"+
                searchText.Replace(" ",",")
                +"|ddlCharacters:0|txtCharacters:|txtMinTraffic:|txtMaxTraffic:|txtMinDomainAge:|txtMaxDomainAge:|txtMinPrice:|txtMaxPrice:|ddlCategories:0|chkAddBuyNow:false|chkAddFeatured:false|chkAddDash:true|chkAddDigit:true|chkAddWeb:false|chkAddAppr:false|chkAddInv:false|chkAddReseller:false|ddlPattern1:|ddlPattern2:|ddlPattern3:|ddlPattern4:|chkSaleOffer:false|chkSalePublic:true|chkSaleExpired:true|chkSaleCloseouts:false|chkSaleUsed:false|chkSaleBuyNow:false|chkSaleDC:false|chkAddOnSale:false|ddlAdvBids:0|txtBids:|txtAuctionID:|ddlDateOffset:&rtr=2&baid=-1&searchDir=1&rnd=0.899348703911528&jnkRjrZ=6dd022d"));


            if (QuerySelectorAll(doc.DocumentNode, "tr.srRow2, tr.srRow1") != null)
            {
                foreach (var node in QuerySelectorAll(doc.DocumentNode, "tr.srRow2, tr.srRow1"))
                {
                    if (QuerySelector(node, "span.OneLinkNoTx") != null && QuerySelector(node, "td:nth-child(5)") != null)
                    {
                        AuctionSearch auction = GenerateAuctionSearch();
                        auction.DomainName = HtmlDecode(QuerySelector(node, "span.OneLinkNoTx").InnerText);
                        Console.WriteLine(auction.DomainName);

                        auction.BidCount = TextModifier.TryParse_INT(HtmlDecode(QuerySelector(node, "td:nth-child(5)").FirstChild.InnerHtml.Replace("&nbsp;", "")));
                        auction.Traffic = TextModifier.TryParse_INT(HtmlDecode(QuerySelector(node, "td:nth-child(5) > td").InnerText.Replace("&nbsp;", "")));
                        auction.Valuation = TextModifier.TryParse_INT(HtmlDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(2)").InnerText.Replace("&nbsp;", "")));
                        auction.Price = TextModifier.TryParse_INT(HtmlDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(3)").InnerText).Replace("$", "").Replace(",", "").Replace("C", ""));
                        try
                        {
                            if (QuerySelector(node, "td:nth-child(5) > td:nth-child(4) > div") != null)
                            {
                                if (HtmlDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(4) > div").InnerText).Contains("Buy Now for"))
                                {
                                    auction.BuyItNow = TextModifier.TryParse_INT(Regex.Split(HtmlDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(4) > div").InnerText), "Buy Now for")[1].Trim().Replace(",", "").Replace("$", ""));
                                }

                            }
                            else
                            {
                                auction.BuyItNow = 0;
                            }

                        }
                        catch (Exception) { auction.BuyItNow = 0; }

                        if (QuerySelector(node, "td:nth-child(5) > td:nth-child(5)") != null &&
                            HtmlDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(5)").InnerHtml).Contains("Bid $"))
                        {
                            auction.MinBid = TextModifier.TryParse_INT(GetSubString(HtmlDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(5)").InnerHtml), "Bid $", " or more").Trim().Replace(",", "").Replace("$", ""));
                        }
                        if (QuerySelector(node, "td:nth-child(5) > td:nth-child(5)") != null &&
                            !HtmlDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(5)").InnerHtml).Contains("Bid $"))
                        {
                            auction.EstimateEndDate = GenerateEstimateEnd(QuerySelector(node, "td:nth-child(5) > td:nth-child(5)"));
                        }
                        if (QuerySelector(node, "td:nth-child(5) > td:nth-child(4)") != null &&
                            HtmlDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(4)").InnerHtml).Contains("Bid $"))
                        {
                            auction.MinBid = TextModifier.TryParse_INT(GetSubString(HtmlDecode(QuerySelector(node, "td:nth-child(5) > td:nth-child(4)").InnerHtml), "Bid $", " or more").Trim().Replace(",", "").Replace("$", ""));
                        }
                        if (QuerySelector(node, "td > div > span") != null)
                        {
                            foreach (var item in GetSubStrings(QuerySelector(node, "td > div > span").InnerHtml, "'Offer $", " or more"))
                            {
                                auction.MinOffer = TextModifier.TryParse_INT(item.Replace(",", ""));
                            }
                        }
                        auction.EndDate = GetPacificTime;
                        foreach (var item in GetSubStrings(node.InnerHtml, "ShowAuctionDetails('", "',"))
                        {
                            auction.AuctionRef = item;
                            break;
                        }
                        //AppSettings.Instance.AllAuctions.Add(auction);
                        if (auction.MinBid > 0)
                        {
                            auctions.Add(auction);
                        }

                    }

                }
            }

            return auctions.AsQueryable();

        }
开发者ID:Alchemy86,项目名称:DAS-Desktop,代码行数:85,代码来源:GoDaddyAuctionSniper.cs

示例12: loadBoxScore

        /// <summary>Loads the given box score.</summary>
        /// <param name="bse">The BoxScoreEntry to load.</param>
        private void loadBoxScore(BoxScoreEntry bse)
        {
            var bs = bse.BS;
            MainWindow.TempBSE_BS = bse.BS;
            FillTeamBoxScore(bs);

            dtpGameDate.SelectedDate = bs.GameDate;
            _curSeason = bs.SeasonNum;
            //LinkInternalsToMainWindow();
            chkIsPlayoff.IsChecked = bs.IsPlayoff;

            calculateScoreAway();
            calculateScoreHome();

            pbsAwayList = new SortableBindingList<PlayerBoxScore>();
            pbsHomeList = new SortableBindingList<PlayerBoxScore>();

            pbsAwayList.AllowNew = true;
            pbsAwayList.AllowEdit = true;
            pbsAwayList.AllowRemove = true;
            pbsAwayList.RaiseListChangedEvents = true;

            pbsHomeList.AllowNew = true;
            pbsHomeList.AllowEdit = true;
            pbsHomeList.AllowRemove = true;
            pbsHomeList.RaiseListChangedEvents = true;

            dgvPlayersAway.ItemsSource = pbsAwayList;
            dgvPlayersHome.ItemsSource = pbsHomeList;
            _loading = true;
            foreach (var pbs in bse.PBSList)
            {
                if (pbs.TeamID == bs.Team1ID)
                {
                    pbsAwayList.Add(pbs);
                }
                else
                {
                    pbsHomeList.Add(pbs);
                }
            }

            pbsAwayList.Sort((pbs1, pbs2) => (pbs2.MINS - pbs1.MINS));
            pbsHomeList.Sort((pbs1, pbs2) => (pbs2.MINS - pbs1.MINS));

            try
            {
                cmbTeam1.SelectedItem = MainWindow.TST[bs.Team1ID].DisplayName;
                cmbTeam2.SelectedItem = MainWindow.TST[bs.Team2ID].DisplayName;
            }
            catch
            {
                MessageBox.Show(
                    "One of the teams requested is disabled for this season. This box score is not available.\n"
                    + "To be able to see this box score, enable the teams included in it.");
                Close();
            }
            populateSeasonCombo();

            pbpeList = new ObservableCollection<PlayByPlayEntry>(bse.PBPEList);
            pbpeList.Sort(new PlayByPlayEntryComparerAsc());
            lstPlayByPlay.ItemsSource = pbpeList;

            _loading = false;
        }
开发者ID:jaosming,项目名称:nba-stats-tracker,代码行数:67,代码来源:BoxScoreWindow.xaml.cs

示例13: pictureBox1_Click_1

        private void pictureBox1_Click_1(object sender, EventArgs e)
        {
            try
            {
                var data = (SortableBindingList<DailyPayment>)gridData.DataSource;

                if (MessageBox.Show("ნამდვილად გსურთ ჩაწერა?", "საქონლის ჩაწერა", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    if (MessageBox.Show("ამოიბეჭდოს Z ანგარიში?", "განულება", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        Ecr.PrintReport(ReportType.Z);
                    }
                    Ecr.DeleteItems(1, 10000);

                    var list = new SortableBindingList<object>();

                    for (int i = 1; i <= data.Count; i++)
                        list.Add(Ecr.ProgramItem(data[i - 1].LoanID + "/" + data[i - 1].PersonalID + " " + data[i - 1].LastName, i, KasaGE.Commands.TaxGr.A, 1, 1, 1));

                    TaxOrderGenerator.ExportToExcel(list, typeof(ProgramItemResponse));

                    var success = list.All(x => ((ProgramItemResponse)x).CommandPassed);

                    if (success)
                        MessageBox.Show("ჩაიწერა წარმატებით.");
                    else
                        MessageBox.Show("მოხდა შეცდომა, გადახედე გახსნილ ექსელის ფაილს.");
                }
            }
            catch (Exception ex)
            {
                _ecr = null;
                throw;
            }
        }
开发者ID:BurnOutDev,项目名称:AltasoftDaily,代码行数:35,代码来源:DailyPaymentsForm.cs

示例14: Form1_Load

        private void Form1_Load(object sender, EventArgs e)
        {
            #region Initialize Servers
            _servers = new SortableBindingList<Dota2Server>();
            _servers.Add(new Dota2Server("syd.valve.net", "Australia (Sydney)"));
            _servers.Add(new Dota2Server("200.73.67.1", "Chile (Santiago)"));
            _servers.Add(new Dota2Server("dxb.valve.net", "Dubai (UAE)"));
            _servers.Add(new Dota2Server("vie.valve.net", "Europe East 1 (Vienna, Austria)"));
            _servers.Add(new Dota2Server("185.25.182.1", "Europe East 2 (Vienna, Austria)"));
            _servers.Add(new Dota2Server("lux.valve.net", "Europe West 1 (Luxembourg)"));
            _servers.Add(new Dota2Server("146.66.158.1", "Europe West 2 (Luxembourg)"));
            _servers.Add(new Dota2Server("116.202.224.146", "India (Kolkata)"));
            _servers.Add(new Dota2Server("191.98.144.1", "Peru (Lima)"));
            _servers.Add(new Dota2Server("sto.valve.net", "Russia 1 (Stockholm, Sweden"));
            _servers.Add(new Dota2Server("185.25.180.1", "Russia 2 (Stockholm, Sweden)"));
            _servers.Add(new Dota2Server("sgp-1.valve.net", "SE Asia 1 (Singapore)"));
            _servers.Add(new Dota2Server("sgp-2.valve.net", "SE Asia 2 (Singapore)"));
            _servers.Add(new Dota2Server("cpt-1.valve.net", "South Africa 1 (Cape Town)"));
            _servers.Add(new Dota2Server("197.80.200.1", "South Africa 2 (Cape Town)"));
            _servers.Add(new Dota2Server("197.84.209.1", "South Africa 3 (Cape Town)"));
            _servers.Add(new Dota2Server("196.38.180.1", "South Africa 4 (Johannesburg)"));
            _servers.Add(new Dota2Server("gru.valve.net", "South America 1 (Sao Paulo)"));
            _servers.Add(new Dota2Server("209.197.25.1", "South America 2 (Sao Paulo)"));
            _servers.Add(new Dota2Server("209.197.29.1", "South America 3 (Sao Paulo)"));
            _servers.Add(new Dota2Server("iad.valve.net", "US East (Sterling, VA)"));
            _servers.Add(new Dota2Server("eat.valve.net", "US West (Seattle, WA)"));
            #endregion

            BindingSource bs = new BindingSource();
            bs.DataSource = _servers;
            dataGrid.DataSource = bs;
            RefreshGrid();

            ConsoleWrite("Program started successfully.", Color.Lime);
        }
开发者ID:DSMorpher,项目名称:Dota2ServerPingCheck,代码行数:35,代码来源:MainForm.cs

示例15: GetBidsandOffers

        public SortableBindingList<Auctions> GetBidsandOffers()
        {
            var auctions = new SortableBindingList<Auctions>();

            const string strUrl = @"https://auctions.godaddy.com/trpMessageHandler.aspx ";
            var postData = string.Format("sec=Bi&sort=7&dir=A&page=1&at=3&rpp=50&rnd={0}",
                randomDouble(0, 1).ToString("0.00000000000000000"));
            var request = (HttpWebRequest)WebRequest.Create(strUrl);
            request.Method = "POST";
            request.ContentType = "application/x-www-form-urlencoded";
            request.ContentLength = postData.Length;
            request.Accept = "gzip,deflate,sdch";
            request.Accept = "image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, application/msword, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/x-silverlight, application/x-silverlight-2-b2, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, */*";
            request.UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)";
            request.Headers.Add("Accept-Encoding", "deflate");
            request.Referer = "https://auctions.godaddy.com/trpMyAccount.aspx?ci=22373&s=2&sc=Bi";
            request.Headers.Add("Accept-Encoding", "");
            request.KeepAlive = true;
            request.Timeout = Timeout.Infinite;

            request.CookieContainer = cookies;

            var stOut = new StreamWriter(request.GetRequestStream());
            stOut.Write(postData);
            stOut.Flush();
            stOut.Close();

            var response = (HttpWebResponse)request.GetResponse();
            response.Cookies = request.CookieContainer.GetCookies(request.RequestUri);

            var encoding = new UTF8Encoding();
            var responseReader = new StreamReader(response.GetResponseStream(), encoding, true);

            var responseData = responseReader.ReadToEnd();
            response.Close();
            responseReader.Close();
            //responseData;

            var doc = new HtmlDocument();
            doc.LoadHtml(responseData);

            foreach (var row in QuerySelectorAll(doc.DocumentNode, "tr[class^=marow]"))
            {
                var auction = GenerateAuction();
                auction.AuctionRef = QuerySelector(row, "td:nth-child(2) > a").Attributes["href"].Value.Split(new char[] { '=' })[1];
                auction.DomainName = HttpUtility.HtmlDecode(QuerySelector(row, "td:nth-child(2)").InnerText).Trim();
                auction.MinBid = TryParse_INT(HttpUtility.HtmlDecode(QuerySelector(row, "td:nth-child(5)").InnerText).Trim().Replace("$", "").Replace("C", ""));
                auction.Status = HttpUtility.HtmlDecode(QuerySelector(row, "td:nth-child(7)").InnerText.Trim());
                GetMyOfferDetails(ref auction);

                if (LoadMyLocalBids() != null)
                {
                    foreach (var auc in LoadMyLocalBids())
                    {
                        if (auc.AuctionRef == auction.AuctionRef)
                        {
                            auction.MyBid = auc.MyBid;
                        }
                    }
                }
                if (auction.MyBid == 0)
                {
                    auction.MyBid = auction.MinBid;
                }
                auctions.Add(auction);

            }

            foreach (var auction in LoadMyLocalBids())
            {

                if (!auctions.Select(s => s.AuctionRef).Distinct().Contains(auction.AuctionRef) &&
                    auction.EndDate > GetPacificTime)
                {
                    var searchList = Search(auction.DomainName).ToList();
                    if (searchList != null && searchList.Count > 0)
                    {
                        auction.BidCount = searchList[0].BidCount;
                        auction.MinBid = searchList[0].MinBid;
                        auction.Traffic = searchList[0].Traffic;
                        auction.Status = searchList[0].Status;
                        auction.Price = searchList[0].Price;
                    }
                    auctions.Add(auction);
                }

            }

            return auctions;
        }
开发者ID:Alchemy86,项目名称:GD_BackOrders,代码行数:90,代码来源:GoDaddyAuctions.cs


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