void vendorAnalysisButton_Click(object sender, EventArgs e) { BackgroundWorker bw = new BackgroundWorker { WorkerReportsProgress = true }; bw.DoWork += delegate(object o, DoWorkEventArgs args) { SetUiEnabled(false); BackgroundWorker worker = o as BackgroundWorker; if (worker != null) { worker.ReportProgress(0, "Analyzing vendors"); } UpdateResults(BudgetAnalyzer.AnalyzeVendors(StatementManager.AllStatements)); SetUiEnabled(true); }; bw.ProgressChanged += delegate(object o, ProgressChangedEventArgs args) { UpdateStatus((string)args.UserState); }; bw.RunWorkerCompleted += delegate { UpdateStatus("Done"); }; bw.RunWorkerAsync(); }
void DrawGraph(string graphType) { void doGraph() { mainPlot.Series = new SeriesCollection(); Dictionary <string, LineSeries> plots = BudgetAnalyzer.GeneratePlots(StatementManager.AllStatements, mStartDate); foreach (string account in plots.Keys) { if (account.Equals("Net") || graphType.Equals("All")) { mainPlot.Series.Add(plots[account]); } } mainPlot.LegendLocation = LegendLocation.Right; } if (mainPlot.InvokeRequired) { mainPlot.Invoke((MethodInvoker)doGraph); } else { doGraph(); } }
void Awake() { _currentBudget = _budgetParameters.StartBudget; UpdateMaxBudget(_currentBudget); _minLimit = _budgetParameters.LowestBudget; _periodsData = new List <BudgetPeriodData>(); _analyzer = new BudgetAnalyzer(_budgetParameters.DebtsLastCount); _calculator = new BudgetCalculator(_budgetParameters); _allocator.BudgetAllocated += OnBudgetAllocated; _collector.DebtCountBorder = _budgetParameters.DebtsLastCount; _allPeriods = 0; _processedPeriods = 0; CheckNewForecast(true); }
public void LoadDirectory() { BackgroundWorker bw = new BackgroundWorker { WorkerReportsProgress = true }; bw.DoWork += delegate(object o, DoWorkEventArgs args) { SetUiEnabled(false); BackgroundWorker worker = o as BackgroundWorker; worker?.ReportProgress(0, "Loading data"); mLoadWarnings = StatementManager.Load(mDirectory); worker?.ReportProgress(0, "Unifying transactions"); mUnifiedTransactions = BudgetAnalyzer.UnifyTransactions(StatementManager.AllStatements, StatementManager.AmazonStatements); mStartDate = mUnifiedTransactions[0].Date; ShowSummary(); SetUiEnabled(true); }; bw.ProgressChanged += delegate(object o, ProgressChangedEventArgs args) { UpdateStatus((string)args.UserState); }; bw.RunWorkerCompleted += delegate { UpdateStatus("Done"); }; bw.RunWorkerAsync(); }