private void button1_Click_1(object sender, EventArgs e) { var prepare = new Preparing(); double num; string sumOFNum = richTextBox1.Text; string slavnum = ""; richTextBox2.Clear(); richTextBox3.Clear(); richTextBox4.Clear(); try { num = prepare.Calculating(sumOFNum); } catch (Exception ex) { richTextBox4.Text = ex.Message; richTextBox4.BackColor = Color.Red; return; } slavnum = prepare.ToSlav((int)num); richTextBox2.Text = slavnum; richTextBox3.Text = (num.ToString()); richTextBox4.BackColor = Color.Green; richTextBox4.Text = "Everything went well!"; }
private void UpdateSyncModes(SyncMode newModes) { if (_logger.IsTrace) { if (newModes != Current) { string message = $"Changing state to {newModes}"; if (_logger.IsTrace) { _logger.Trace(message); } } } SyncMode previous = Current; SyncModeChangedEventArgs args = new SyncModeChangedEventArgs(previous, Current); // Changing is invoked here so we can block until all the subsystems are ready to switch // for example when switching to Full sync we need to ensure that we safely transition // the beam sync DB and beam processor Preparing?.Invoke(this, args); Changing?.Invoke(this, args); Current = newModes; Changed?.Invoke(this, args); }
private async Task SeedSingleSeed(int seedingStep, ServiceProvider serviceProvider, SeedInfo seedInfo) { Assert(seedingStep > 0); Assert(serviceProvider != null); Assert(seedInfo != null); Preparing?.Invoke(this, new SeedingEventArgs(seedingStep, seedInfo)); var seed = (ISeed)ActivatorUtilities.GetServiceOrCreateInstance(serviceProvider, seedInfo.SeedType); foreach (var seedOutputProperty in seedInfo.SeedOutputProperties) { // We always want to create a new instance of a seed output class. // Why? Because in a general case seed output classes will have dependency constructors // that can potentially have transient dependencies. var propertyValue = ActivatorUtilities.GetServiceOrCreateInstance(serviceProvider, seedOutputProperty.PropertyType); seedOutputProperty.SetValue(seed, propertyValue); } if (await seed.OutputAlreadyExists()) { Skipping?.Invoke(this, new SeedingEventArgs(seedingStep, seedInfo)); return; } Seeding?.Invoke(this, new SeedingEventArgs(seedingStep, seedInfo)); await seed.Seed(); SeedingEnded?.Invoke(this, new SeedingEventArgs(seedingStep, seedInfo)); }
private void SyncModeSelectorOnPreparing(object sender, SyncModeChangedEventArgs e) { Preparing?.Invoke(this, e); }
protected virtual void OnPreparing(TimeSpan time) { Preparing?.Invoke(time); }