public Form1() { InitializeComponent(); lbHistory.SelectedIndexChanged -= new EventHandler(lbHistory_SelectedIndexChanged); lbHistory.DataSource = CalculationHistory.FetchEntireHistory(); lbHistory.SelectedIndexChanged += new EventHandler(lbHistory_SelectedIndexChanged); }
private void btnEquals_Click(object sender, EventArgs e) { lblResult.Text = Calculation.NetStandard.Calculator.Calculate(lblResult.Text).ToString(); lbHistory.SelectedIndexChanged -= new EventHandler(lbHistory_SelectedIndexChanged); lbHistory.DataSource = CalculationHistory.FetchEntireHistory(); lbHistory.SelectedIndexChanged += new EventHandler(lbHistory_SelectedIndexChanged); }
/// <summary> /// Do some amazing calculations. Store calculation and result in SQL. /// </summary> private async void EqualsButton_Click(object sender, RoutedEventArgs e) { if (MyInkCanvas.InkPresenter.StrokeContainer.GetStrokes().Any()) { var inkRecognizerContainer = new InkRecognizerContainer(); var results = await inkRecognizerContainer.RecognizeAsync(MyInkCanvas.InkPresenter.StrokeContainer, InkRecognitionTarget.All); var recognizedText = string.Concat(results.Select(i => i.GetTextCandidates()[0])); ResultsTextBlock.Text = Calculation.NetStandard.Calculator.Calculate(recognizedText).ToString(); MyInkCanvas.InkPresenter.StrokeContainer.Clear(); } else { ResultsTextBlock.Text = Calculation.NetStandard.Calculator.Calculate(ResultsTextBlock.Text).ToString(); } HistoryCollection = new ObservableCollection <string>(CalculationHistory.FetchEntireHistory()); }
public MainPage() { this.InitializeComponent(); HistoryCollection = new ObservableCollection <string>(CalculationHistory.FetchEntireHistory()); }
/// <summary> /// Clears the screen. /// </summary> private void CButton_Click(object sender, RoutedEventArgs e) { HistoryCollection = new ObservableCollection <string>(CalculationHistory.FetchEntireHistory()); }
private void ClearDatabase_Click(object sender, EventArgs e) { CalculationHistory.ClearHistory(); lbHistory.DataSource = CalculationHistory.FetchEntireHistory(); }