private void OptionsForm_Load(object sender, EventArgs e) { this.numericUpDownUnitDuration.Minimum = 1; this.numericUpDownUnitDuration.Maximum = 10000; this.numericUpDownUnitDuration.Value = configurationFile.GetSetting("unitDuration", 250); this.numericUpDownDotDuration.Value = configurationFile.GetSetting("dotDuration", 1); this.numericUpDownDashDuration.Value = configurationFile.GetSetting("dashDuration", 3); this.numericUpDownGapDuration.Value = configurationFile.GetSetting("gapDuration", 1); this.numericUpDownLetterSpacing.Value = configurationFile.GetSetting("letterSpacing", 3); this.numericUpDownWordSpacing.Value = configurationFile.GetSetting("wordSpacing", 7); SetFont(configurationFile.GetSetting("font", "Courier New", 10)); }
private void MainForm_Load(object sender, EventArgs e) { configurationFile = new ConfigurationFile(); this.Text = String.Format("{0} {1}", Application.ProductName, Application.ProductVersion); #if OFFLINE this.Text += " (OFFLINE)"; #endif this.textBoxText.Font = configurationFile.GetSetting("font", "Courier New", 10); this.toolStripButtonCancel.Enabled = false; EmbeddedResources embeddedResources = new EmbeddedResources(); for (int i = 0; i < Enum.GetValues(typeof(MessengerContactAvailability)).Length; i++) { String resourceName = String.Format("Resources.availability{0}.png", i); availabilityBitmaps.Add(embeddedResources.GetBitmap(resourceName)); } backgroundWorker.WorkerSupportsCancellation = true; backgroundWorker.DoWork += new DoWorkEventHandler(backgroundWorker_DoWork); backgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(backgroundWorker_RunWorkerCompleted); generator = new MorseGenerator(); generator.TextStarted += new MorseGenerator.MorseGeneratorTextStartedEventHandler(MorseGenerator_TextStarted); generator.TextFinished += new MorseGenerator.MorseGeneratorTextFinishedEventHandler(MorseGenerator_TextFinished); generator.LetterStarted += new MorseGenerator.MorseGeneratorLetterStartedEventHandler(MorseGenerator_LetterStarted); generator.LetterFinished += new MorseGenerator.MorseGeneratorLetterFinishedEventHandler(MorseGenerator_LetterFinished); generator.StateChanged += new MorseGenerator.MorseGeneratorStateChangedEventHandler(MorseGenerator_StateChanged); #if OFFLINE toolStripStatusLabelFriendlyName.Text = "Vurdalakov"; #else toolStripStatusLabelFriendlyName.Text = contact.FriendlyName; contact = new MessengerContact(); OnContactAvailabilityChanged(contact, new EventArgs()); contact.AvailabilityChanged += new MessengerContact.AvailabilityChangedEventHandler(OnContactAvailabilityChanged); #endif }
private void Generate(bool forever) { if (!CheckText()) { return; } generator.UnitDuration = configurationFile.GetSetting("unitDuration", 250); generator.DotDuration = configurationFile.GetSetting("dotDuration", 1); generator.DashDuration = configurationFile.GetSetting("dashDuration", 3); generator.GapDuration = configurationFile.GetSetting("gapDuration", 1); generator.LetterSpacing = configurationFile.GetSetting("letterSpacing", 3); generator.WordSpacing = configurationFile.GetSetting("wordSpacing", 7); GeneratorEventArgs generatorEventArgs = new GeneratorEventArgs(this.textBoxText.Text, forever); backgroundWorker.RunWorkerAsync(generatorEventArgs); }