CmisSync.Spinner.Spinner C# (CSharp) Method

Spinner() public method

public Spinner ( int size ) : System
size int
return System
        public Spinner(int size) : base()
        {
            this.Size = size;

            this.CycleDuration = 600;
            this.CurrentStep = 0;

            Gdk.Pixbuf spinner_gallery = UIHelpers.GetIcon("process-working", this.Size);

            int frames_in_width  = spinner_gallery.Width  / this.Size;
            int frames_in_height = spinner_gallery.Height / this.Size;

            this.NumSteps = frames_in_width * frames_in_height;
            this.Images   = new Gdk.Pixbuf[this.NumSteps - 1];

            int i = 0;

            for (int y = 0; y < frames_in_height; y++) {
                for (int x = 0; x < frames_in_width; x++) {
                    if (!(y == 0 && x == 0)) {
                        this.Images[i] = new Gdk.Pixbuf(spinner_gallery, x * this.Size, y * this.Size, this.Size, this.Size);
                        i++;
                    }
                }
            }

            this.Timer = new Timer() {
                Interval = (double)this.CycleDuration / this.NumSteps
            };

            this.Timer.Elapsed += delegate {
                this.NextImage();
            };

            this.Start();
        }