Example #1
0
        /// <summary>
        /// <para>Loads the specified embedded <see cref="System.Drawing.Bitmap"/> from the assembly.</para>
        /// <para>See <c>Remarks</c> and <c>Exceptions</c> in <see cref="GetResource"/> for more information.</para>
        /// </summary>
        /// <param name="resourceName">The case-sensitive name of the embedded resource being requested.</param>
        /// <param name="assembly">Assembly to load embedded resources from. If <c>null</c>, then currently executing assembly is used.</param>
        /// <returns>A <c>Bitmap</c> representing the embedded resource; <c>null</c> if no resources were specified during compilation, or if the resource is not visible to the caller.</returns>
        public static Bitmap GetBitmap(String resourceName, Assembly assembly)
        {
            EmbeddedResources embeddedResources = new EmbeddedResources(assembly);

            return(embeddedResources.GetBitmap(resourceName));
        }
Example #2
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
        }
Example #3
0
        /// <summary>
        /// <para>Loads the specified embedded <see cref="System.Drawing.Icon"/> of the specified size from the assembly.</para>
        /// <para>See <c>Remarks</c> and <c>Exceptions</c> in <see cref="GetResource"/> for more information.</para>
        /// </summary>
        /// <param name="resourceName">The case-sensitive name of the embedded resource being requested.</param>
        /// <param name="size">The desired size of the icon.</param>
        /// <param name="assembly">Assembly to load embedded resources from. If <c>null</c>, then currently executing assembly is used.</param>
        /// <returns>A <c>Icon</c> representing the embedded resource; <c>null</c> if no resources were specified during compilation, or if the resource is not visible to the caller.</returns>
        /// <example>
        /// <code>The following code example demonstrates using the NotifyIcon class to display an icon for an application in the notification area.
        /// NotifyIcon notifyIcon = new NotifyIcon();
        /// notifyIcon.icon = EmbeddedResources.GetIcon("Resources.application.ico", SystemInformation.SmallIconSize);
        /// notifyIcon.Text = Application.ProductName;
        /// notifyIcon.Visible = true;
        /// </code>
        /// </example>
        public static Icon GetIcon(String resourceName, Size size, Assembly assembly)
        {
            EmbeddedResources embeddedResources = new EmbeddedResources(assembly);

            return(embeddedResources.GetIcon(resourceName, size));
        }
Example #4
0
        /// <summary>
        /// <para>Loads the specified embedded <see cref="System.Drawing.Bitmap"/> from the assembly as a <see cref="System.Windows.Forms.ImageList"/>.</para>
        /// <para>Loaded <c>ImageList</c> can be used e.g. as a <see cref="System.Windows.Forms.ListView.SmallImageList"/> of a <see cref="System.Windows.Forms.ListView"/>.</para>
        /// <para>See <c>Remarks</c> and <c>Exceptions</c> in <see cref="GetResource"/> for more information.</para>
        /// </summary>
        /// <param name="resourceName">The case-sensitive name of the embedded resource being requested.</param>
        /// <param name="assembly">Assembly to load embedded resources from. If <c>null</c>, then currently executing assembly is used.</param>
        /// <returns>A <c>ImageList</c> representing the embedded resource; <c>null</c> if no resources were specified during compilation, or if the resource is not visible to the caller.</returns>
        public static ImageList GetImageList(String resourceName, Assembly assembly)
        {
            EmbeddedResources embeddedResources = new EmbeddedResources(assembly);

            return(embeddedResources.GetImageList(resourceName));
        }
        /// <summary>
        /// <para>Loads the specified embedded <see cref="System.Drawing.Bitmap"/> from the assembly as a <see cref="System.Windows.Forms.ImageList"/>.</para>
        /// <para>Loaded <c>ImageList</c> can be used e.g. as a <see cref="System.Windows.Forms.ListView.SmallImageList"/> of a <see cref="System.Windows.Forms.ListView"/>.</para>
        /// <para>See <c>Remarks</c> and <c>Exceptions</c> in <see cref="GetResource"/> for more information.</para>
        /// </summary>
        /// <param name="resourceName">The case-sensitive name of the embedded resource being requested.</param>
        /// <param name="assembly">Assembly to load embedded resources from. If <c>null</c>, then currently executing assembly is used.</param>
        /// <returns>A <c>ImageList</c> representing the embedded resource; <c>null</c> if no resources were specified during compilation, or if the resource is not visible to the caller.</returns>
        public static ImageList GetImageList(String resourceName, Assembly assembly)
        {
            EmbeddedResources embeddedResources = new EmbeddedResources(assembly);

            return embeddedResources.GetImageList(resourceName);
        }
        /// <summary>
        /// <para>Loads the specified embedded <see cref="System.Drawing.Icon"/> of the specified size from the assembly.</para>
        /// <para>See <c>Remarks</c> and <c>Exceptions</c> in <see cref="GetResource"/> for more information.</para>
        /// </summary>
        /// <param name="resourceName">The case-sensitive name of the embedded resource being requested.</param>
        /// <param name="size">The desired size of the icon.</param>
        /// <param name="assembly">Assembly to load embedded resources from. If <c>null</c>, then currently executing assembly is used.</param>
        /// <returns>A <c>Icon</c> representing the embedded resource; <c>null</c> if no resources were specified during compilation, or if the resource is not visible to the caller.</returns>
        /// <example>
        /// <code>The following code example demonstrates using the NotifyIcon class to display an icon for an application in the notification area.
        /// NotifyIcon notifyIcon = new NotifyIcon();
        /// notifyIcon.icon = EmbeddedResources.GetIcon("Resources.application.ico", SystemInformation.SmallIconSize);
        /// notifyIcon.Text = Application.ProductName;
        /// notifyIcon.Visible = true;
        /// </code>
        /// </example>
        public static Icon GetIcon(String resourceName, Size size, Assembly assembly)
        {
            EmbeddedResources embeddedResources = new EmbeddedResources(assembly);

            return embeddedResources.GetIcon(resourceName, size);
        }
        /// <summary>
        /// <para>Loads the specified embedded <see cref="System.Drawing.Bitmap"/> from the assembly.</para>
        /// <para>See <c>Remarks</c> and <c>Exceptions</c> in <see cref="GetResource"/> for more information.</para>
        /// </summary>
        /// <param name="resourceName">The case-sensitive name of the embedded resource being requested.</param>
        /// <param name="assembly">Assembly to load embedded resources from. If <c>null</c>, then currently executing assembly is used.</param>
        /// <returns>A <c>Bitmap</c> representing the embedded resource; <c>null</c> if no resources were specified during compilation, or if the resource is not visible to the caller.</returns>
        public static Bitmap GetBitmap(String resourceName, Assembly assembly)
        {
            EmbeddedResources embeddedResources = new EmbeddedResources(assembly);

            return embeddedResources.GetBitmap(resourceName);
        }