public void ButtonWonder_Click(object sender, RoutedEventArgs e) { globalFuncs.scoutTimer.start(); if (searching) { stopSearching = true; searching = false; return; } this.windowMain.CurrentGameDate.Text = context.fm.MetaData.IngameDate.ToLongDateString(); this.windowMain.vm.tabteams.TextBlockText = globalFuncs.localization.WindowMainLabels[2]; this.vm.wonder.TextBlockText = globalFuncs.localization.SearchingResults[ScoutLocalization.SR_STOP]; //this.ButtonWonder.IsEnabled = false; this.vm.results.Text = globalFuncs.localization.SearchingResults[ScoutLocalization.SR_SEARCHING] + "..."; setControlAvailability(false); this.ButtonSearch.IsEnabled = false; SearchDelegate d = new SearchDelegate(this.retrieveFieldsWonder); d.BeginInvoke(null, null); ProgressBarDelegate p = new ProgressBarDelegate(this.updateProgressBar); p.BeginInvoke(null, null); }
public Uri SearchFor(IRequest criteria) { IEnumerable <IPeer> peers = Peer.Self.PeerContainer.GetAvailablePeers(); foreach (var peer in peers) { SearchDelegate del = peer.SearchEngine.StartSearching; IAsyncResult result = del.BeginInvoke(criteria, null, null); if (result.IsCompleted) { try { del.EndInvoke(result); } catch (WebException) { Peer.Self.PeerContainer.RemovePeer(peer); } catch (RemotingException) { Peer.Self.PeerContainer.RemovePeer(peer); } } } return(null); }
public void ButtonSearch_Click(object sender, RoutedEventArgs e) { globalFuncs.scoutTimer.start(); if (searching) { stopSearching = true; searching = false; return; } this.windowMain.CurrentGameDate.Text = context.fm.MetaData.IngameDate.ToLongDateString(); this.windowMain.vm.tabteams.TextBlockText = globalFuncs.localization.WindowMainLabels[2]; this.vm.search.TextBlockText = globalFuncs.localization.SearchingResults[ScoutLocalization.SR_STOP]; //this.ButtonSearch.IsEnabled = false; setControlAvailability(false); this.ButtonWonder.IsEnabled = false; this.vm.results.Text = globalFuncs.localization.SearchingResults[ScoutLocalization.SR_SEARCHING] + "..."; searchUI.name = this.name.TextBox.Text.ToLower(); searchUI.nation = this.nation.TextBox.Text.ToLower(); searchUI.stadium = this.stadium.TextBox.Text.ToLower(); globalFuncs.specialCharactersReplacement(ref searchUI.name); globalFuncs.specialCharactersReplacement(ref searchUI.nation); globalFuncs.specialCharactersReplacement(ref searchUI.stadium); searchUI.teamtypeIndex = this.teamtype.ComboBox.SelectedIndex; if (this.teamtype.ComboBox.SelectedItem != null) { searchUI.teamtypeItem = (String)this.teamtype.ComboBox.SelectedItem; } searchUI.regionIndex = this.region.ComboBox.SelectedIndex; if (this.region.ComboBox.SelectedItem != null) { searchUI.regionItem = globalFuncs.localization.regionsNative[searchUI.regionIndex]; } searchUI.reputationIndex = this.reputation.ComboBox.SelectedIndex; if (this.reputation.ComboBox.SelectedItem != null) { searchUI.reputationItem = (String)this.reputation.ComboBox.SelectedItem; } searchUI.transferBudgetMin = (int)this.transferBudget.NumericUpDownMin.Value; searchUI.transferBudgetMax = (int)this.transferBudget.NumericUpDownMax.Value; searchUI.wageBudgetMin = (int)this.wageBudget.NumericUpDownMin.Value; searchUI.wageBudgetMax = (int)this.wageBudget.NumericUpDownMax.Value; SearchDelegate d = new SearchDelegate(this.retrieveFields); d.BeginInvoke(null, null); ProgressBarDelegate p = new ProgressBarDelegate(this.updateProgressBar); p.BeginInvoke(null, null); }