Пример #1
0
        public MainForm(bool ScreenSaver, GoogleImageSearch.SearchSettings Settings)
        {
            InitializeComponent();
            this._GoogleImageSearch = new GoogleImageSearch();
            this._GoogleImageSearch.Settings = Settings;

            this._AsyncImageSource = new AsyncImageSource();
            this._AsyncImageSource.Source = this._GoogleImageSearch;
            this._AsyncImageSource.MaxQueueSize = 5;
            this._AsyncImageSource.ThreadAmount = 3;

            RepeatImageSource ris = new RepeatImageSource();
            this._FinalImageSource = ris;
            ris.Source = this._AsyncImageSource;
            ris.Reserve = 40;

            Cursor.Hide();

            Timer mtimer = new Timer();
            mtimer.Interval = 250;
            mtimer.Tick += new EventHandler(delegate
            {
                Image next = this._FinalImageSource.Next();
                if (next != null)
                {
                    this.ShownImage = next;
                }
            });
            this._ScreenSaver = ScreenSaver;
            this._Start = DateTime.Now;
            mtimer.Start();
        }