private void trashButton_Click(object sender, EventArgs e) { if (watchlistOLV.SelectedItems.Count > 0) { WatchlistController.getInstance().Delete((ArrayList)watchlistOLV.SelectedObjects); } }
private bool SaveFile(bool aSaveAs = false) { try { if (this.watchlistOLV.Items.Count <= 0) { MessageBox.Show("Nothing to save!"); return(false); } if (String.IsNullOrEmpty(this.Filename) || aSaveAs) { DialogResult nResult = this.saveFileDialog.ShowDialog(); if (nResult == DialogResult.OK) { this.Filename = this.saveFileDialog.FileName; } else { return(false); } } Serializer.SaveListToFile <StockProfile>(WatchlistController.getInstance().GetModel().GetList(), this.Filename); return(true); } catch (IOException) { return(false); } }
private void updateButton_Click(object sender, EventArgs e) { if (WatchlistController.getInstance().GetModel().Size() > 0) { updateWorker.RunWorkerAsync(WatchlistController.getInstance().GetModel().GetList()); } }
public ValueInvestingForm() { InitializeComponent(); InitializeSearchEngine(); WatchlistController.getInstance().Init(); WatchlistObserver nObserver = new WatchlistObserver(this.watchlistOLV); WatchlistController.getInstance().Subscribe(nObserver); this.ActiveControl = this.tickTxtbox; }
private void SearchOLV_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == Convert.ToChar(Keys.Return) && this.SearchOLV.SelectedItems.Count == 1) { Stock nStockObj = (Stock)this.SearchOLV.SelectedObject; this.SearchOLV.Hide(); if (WatchlistController.getInstance().isExist(nStockObj.Sym)) { this.StockQuery(WatchlistController.getInstance().GetStock(nStockObj.Sym), true); } else { StockProfile nStock = new StockProfile(nStockObj.Sym); nStock.Market = nStockObj.Market; this.StockQuery(nStock, true); } } }
private void SearchOLV_Click(object sender, EventArgs e) { if (this.SearchOLV.SelectedItems.Count == 1) { Stock nStockObj = (Stock)this.SearchOLV.SelectedObject; this.SearchOLV.Hide(); if (WatchlistController.getInstance().isExist(nStockObj.Sym)) { this.StockQuery(WatchlistController.getInstance().GetStock(nStockObj.Sym), true); } else { StockProfile nStock = new StockProfile(nStockObj.Sym); nStock.Market = nStockObj.Market; this.StockQuery(nStock, true); } } }
private bool OpenFile(String aFilename = "") { try { if (String.IsNullOrEmpty(aFilename)) { DialogResult nResult = this.openFileDialog.ShowDialog(); if (nResult == DialogResult.OK) { WatchlistController.getInstance().Clear(); WatchlistController.getInstance().Add(Serializer.GetListFromFile <StockProfile>(openFileDialog.FileName)); this.Filename = openFileDialog.FileName; return(true); } } return(false); } catch (IOException) { return(false); } }
private async void StockQuery(StockProfile aStock, Boolean Editable = false, Boolean Save = false) { QueryController nController = new QueryController(); bool nResult = await nController.QueryStock(aStock); if (!nResult) { return; } StockData nStockData = new StockData(); nStockData.Name = aStock.Name; nStockData.Sym = aStock.Sym; nStockData.Mkt = aStock.Mkt; nStockData.Market = aStock.Market; nResult = nController.QueryStockData(ref nStockData); TAController nTACont = new TAController(nStockData); nTACont.Compute(); aStock.ShortStrength = nTACont.BearStrength; aStock.LongStrength = nTACont.BullStrength; aStock.BullIndicators = nTACont.UptrendDescriptions; aStock.BearIndicators = nTACont.DowntrendDescriptions; if (Editable) { StockProfilingForm nForm = new StockProfilingForm(aStock); nForm.Show(); } if (Save) { WatchlistController.getInstance().Add(aStock); } }
private void New() { WatchlistController.getInstance().Clear(); this.Filename = ""; }
public WatchlistControllerTests() { watchlistMockRepo = Substitute.For <IRepository <Watchlist> >(); testController = new WatchlistController(watchlistMockRepo); }
private void delButton_Click(object sender, EventArgs e) { WatchlistController.getInstance().Delete(this.mStock); this.Close(); }