Пример #1
0
        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
        }