public void FetchGoldenCrossSymbols() { AllocConsole(); if (Companies.Count != 0) { Companies.Clear(); } string symbolPrefix = "<a href=\"/stock/[a-z0-9]+/\">"; var html = new WebClient().DownloadString(goldenCrossSearchHTML); MatchCollection matches = Regex.Matches(html, symbolPrefix + "[A-Z]+"); try { foreach (Match match in matches) { AdvanceLoadingMessage(); string symbol = Regex.Match(match.Value, "[A-Z]+").Value; Company c = FetchCompanyInfo(symbol); if (c != null) { Companies.Add(c); } } DisplayLoadingMessageSucceeded(); } catch (ArgumentOutOfRangeException e) { DisplayLoadingMessageFailed(); } }
private async Task ExecuteLoadCompaniesCommand() { if (IsBusy) { return; } IsBusy = true; foreach (var servers in StoredData.GetServers()) { try { //this.Companies.Clear(); Companies.Clear(); // var items = await DataStore.GetItemsAsync(true); foreach (var item in await LoadXMLCompanies(await wb.GetXml(servers.Adress).ConfigureAwait(false))) { Companies.Add(item); } } catch (Exception ex) { Debug.WriteLine(ex); } finally { IsBusy = false; } } }
public void InitializeCompanies(IEnumerable <Company> newCompanies) { Companies.Clear(); foreach (var newCompany in newCompanies) { Companies.Add(newCompany); } }
public void Load() { var companies = _commonService.GetAllCompaniesLookup(); Companies.Clear(); foreach (var company in companies) { Companies.Add(company); } }
public void LoadCompanies() { Companies.Clear(); var companies = CompanyService.GetAllCompanies(); foreach (var v in companies) { Companies.Add(v); } }
/// <summary>Loads the companies asynchronous.</summary> internal async Task LoadCompaniesAsync() { Companies.Clear(); IList <Company> listCompanies = await Data.GetCompaniesAsync(); foreach (Company comp in listCompanies) { Companies.Add(comp); } }
private void UpdateCompany(int companyId) { Companies.Clear(); _companyrepository.ReloadCompany(companyId); var companies = _commonService.GetAllCompaniesLookup(); foreach (var company in companies) { Companies.Add(company); } }
private async Task LoadCompaniesAsync() { var companies = await _repository.Company.GetRangeAsync(); Companies.Clear(); foreach (var company in companies) { Companies.Add(new CompanyModel(company, _repository)); await Task.Delay(10); } }
public void LoadCompanies() { Companies.Clear(); Companies.Add(new LookupItem.NullLocupItem { DisplayMember = "-" }); var lookup = _commonService.GetAllCompaniesLookup(); foreach (var lookupItem in lookup) { Companies.Add(lookupItem); } }
private async Task LoadCompaniesLookupAsync() { Companies.Clear(); Companies.Add(new NullLookupItem { DisplayMember = " - " }); // to have possibility to display Null (or specific sign) in our combobox var lookup = await _companyLookupDataService.GetCompanyLookupAsync(); foreach (var lookupItem in lookup) { Companies.Add(lookupItem); } }
private void DisplayCompanies() { if (_companies != null && _companies.Any()) { Companies.Clear(); foreach (var company in _companies) { if (IsDisplayingCompany(company.Stock)) { Companies.Add(company); } } } }
public override async void Refresh() { base.Refresh(); Refreshing = true; Companies.Clear(); foreach (var c in await Services.Host.CompanyService.GetCompanies()) { Companies.Add(c); } Refreshing = false; }
public override Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary <string, object> state) { string currentUser = (string)Windows.Storage.ApplicationData.Current.LocalSettings.Values["CurrentUser"]; if (!String.IsNullOrEmpty(currentUser)) { Title = "Favourites"; GetCompanies(Guid.Parse(currentUser)); } else { Title = "Please log in to see your favourites"; Companies.Clear(); } CmdGoToCompanyDetail = new DelegateCommand <Guid>(GoToCompanyDetail); return(base.OnNavigatedToAsync(parameter, mode, state)); }
public static void GetCompanies() { Companies.Clear(); using var conn = new SqlConnection(Properties.Settings.Default.ConnectionString); conn.Open(); string qry = "SELECT * FROM Company;"; var cmd = new SqlCommand(qry, conn); var reader = cmd.ExecuteReader(); while (reader.Read()) { Companies.Add(new Company(reader)); } }
public async Task <ObservableCollection <ICompany> > GetItemsAsync(string category, bool forceRefresh = false) { if (category != Category || Companies.Count == 0) { Companies.Clear(); var items = await GetItemsRequest(category); foreach (var item in items) { Companies.Add(item); } Category = category; } return(await Task.FromResult(Companies)); }
public override async void Refresh() { base.Refresh(); Refreshing = true; Companies.Clear(); var companies = await Services.Host.CompanyService.GetCompanies(); var c1 = companies; foreach (var c in companies) { Companies.Add(new CompanyViewModel(c)); } Refreshing = false; }
public async void GetCompanies(Guid categoryID) { if (Companies == null) { Companies = new ObservableCollection <SharedCompany>(); } Companies.Clear(); HttpClient client = new HttpClient(); string res = await client.GetStringAsync(new Uri("http://localhost:51070/api/company?categoryID=" + categoryID)); var list = JsonConvert.DeserializeObject <List <SharedCompany> >(res); foreach (var item in list) { Companies.Add(item); } RaisePropertyChanged("Companies"); }
public override async Task LoadAsync(int id) { Id = id; foreach (var wrapper in Companies) { wrapper.PropertyChanged -= Wrapper_PropertyChanged; } Companies.Clear(); var companies = await _companyRepository.GetAllAsync(); foreach (var model in companies) { var wrapper = new CompanyWrapper(model); wrapper.PropertyChanged += Wrapper_PropertyChanged; Companies.Add(wrapper); } }
// Prepare for the new world static public void onNewWorld(string key) { Plugin p = StockMarketPlugIn.theInstance.parent; Businesses.Clear(); Companies.Clear(); _theInstance._events.onNewWorld(); IEnumerator ie = files.GetEnumerator(); while (ie.MoveNext()) { string filename = (string)ie.Current; using (Stream file = p.loadStream(filename)) { XmlDocument doc = new XmlDocument(); doc.Load(file); IEnumerator ie2 = doc.ChildNodes.GetEnumerator(); while (ie2.MoveNext()) { XmlNode cn = (XmlNode)ie2.Current; if (cn.Name.Equals("companies")) { loadData(cn); } else if (cn.Name.Equals("events")) { _theInstance._events.loadData(cn); } } } } initTable(); theInstance.setClockHandlers(); World.world.otherObjects[key] = theInstance; World.world.otherObjects[key + "rand"] = _random; }
public override async Task ExecuteLoadCompaniesCommand() { IsServicesDisplayBusy = true; try { //then we clear the observable collection and replace it Companies.Clear(); var companies = await UserInfo.GetPermissions().GetCompaniesAsync(true); foreach (var company in companies) { Companies.Add(company); } } catch (Exception ex) { Debug.WriteLine(ex); } finally { IsServicesDisplayBusy = false; } }
private async void OnCheckButtonCommand(object param) { DisableControls(); if (isCancelled) { Companies.Clear(); isCancelled = false; } if (!isPaused) { if (_asxRadioButtonChecked) { ProgressMessage = "Downloading spreadsheet"; ProgressBarIsIndeterminate = true; var filename = "ASXListedCompanies.csv"; var url = string.Concat("https://www.asx.com.au/asx/research/", filename); var excel = await Task.Run(() => DownloadExcel(url, filename)); var firstUsedRow = 4; var firstUsedColumn = 1; var range = await Task.Run(() => GetRange(excel, firstUsedRow, firstUsedColumn)); ProgressBarIsIndeterminate = false; ProgressBarMax = range.Rows.Count; ProgressMessage = "Getting ASX companies"; _companies = new ObservableCollection <Company>(await Task.Run(() => GetAsxCompanies(excel, range, firstUsedRow, StockCodeTextBox))); } else if (_nyseRadioButtonChecked || _nasdaqRadioButtonChecked) { var nasdaqScreenerPath = GetNasdaqScreenerPath(); if (File.Exists(nasdaqScreenerPath)) { ProgressMessage = "Importing spreadsheet"; ProgressBarIsIndeterminate = true; var excel = await Task.Run(() => OpenExcel(nasdaqScreenerPath)); var firstUsedRow = 2; var firstUsedColumn = 1; var range = await Task.Run(() => GetRange(excel, firstUsedRow, firstUsedColumn)); ProgressBarIsIndeterminate = false; ProgressBarMax = range.Rows.Count; ProgressMessage = string.Concat("Getting ", GetUsStockExchangeText(), " companies"); _companies = new ObservableCollection <Company>(await Task.Run(() => GetUsCompanies(excel, range, firstUsedRow, StockCodeTextBox))); } else { ProgressMessage = string.Concat("Spreadsheet does not exist. You can download it from 'https://www.nasdaq.com/screening/companies-by-industry.aspx?exchange=", GetUsStockExchangeText(), "'"); } } } else { isPaused = false; } if (_companies != null && _companies.Any()) { PauseButtonEnabled = true; CancelButtonEnabled = true; ResetProgressBar(); ProgressBarMax = _companies.Count(); ProgressMessage = "Valuating stock prices"; foreach (var company in _companies) { if (!isCancelled && !isPaused) { var stock = company.Stock; ProgressMessage = string.Concat("Valuating ", company.Name); if (string.IsNullOrEmpty(stock.Decision)) { await Task.Run(() => GetYahooFinanceResponse(stock)); if (stock.HasPrice && stock.HasTtmEps && stock.SecondEps.HasValue) { await Task.Run(() => GetWallStreetJournalResponse(stock)); if (stock.FirstEps.HasValue) { stock.GetEps(); await Task.Run(() => GetMsnMoneyResponse(stock)); if (stock.SecondPeRatio.HasValue) { stock.GetPeRatio(); } } } await Task.Run(() => GetStockValuation(stock)); if (IsDisplayingCompany(stock)) { Companies.Add(company); } } ProgressBarValue++; } else { EnableControls(); } } var actionText = GetActionText(isCancelled, isPaused); ProgressMessage = string.Concat(actionText, " valuations"); ResetProgressBar(); EnableControls(); PauseButtonEnabled = false; CancelButtonEnabled = false; } }
public void SetCompanies(IEnumerable <Company> companies) { Companies.Clear(); companies.ToList().ForEach(Companies.Add); }