/// <summary> /// Code that runs after the Form is created but before the Form is Displayed. /// </summary> private void ScreenSaverForm_Load(object sender, EventArgs e) { // Scot, this runs immediately after the constructor (well, almost. There are events which can come in // between constructor and Load - resize events, etc). Here we prep and initialize everything before we show the Form. // After that, it's all a matter of reacting to events (clicks, keypresses, timers, etc). // set debug output controls bool fDebugOutput = true; bool fDebugoutputTraceLevel = false; bool fDebugTrace = fDebugOutput && fDebugoutputTraceLevel; Logging.LogLineIf(fDebugTrace, "ScreenSaverForm_Load(): entered."); // set state flags fFormLoadIsRunning = true; // create the slideshow object, set its properties ourSlideshow = new Slideshow(this); ourSlideshow.IntervalInMilliSeconds = SettingsInfo.SlideshowIntervalInSecs * 1000; ourSlideshow.DeferralTimeWindowInMilliseconds = 1500; ourSlideshow.DeferralIntervalInMilliseconds = ourSlideshow.IntervalInMilliSeconds; // set the style of our window (maximized, topmost, etc) appropriately Logging.LogLineIf(fDebugTrace, " ScreenSaverForm_Load(): entering or exiting ScreenSaverWindowStyle, as appropriate."); if (EntryPoint.fOpenInScreenSaverMode) { EnterScreenSaverWindowStyle(); } else { ExitScreenSaverWindowStyle(true); // restore us to "normal" using the size/position data from Settings } // point a public field to our picturebox, so that through this field the pb can be addressed by other forms (settings, for example) refto_pbMainPhoto = pbMain; // create a public font dialog that we can access from this and other forms fontdlg = new FontDialog(); // set the base font dialog properties fontdlg.ShowColor = true; fontdlg.ShowEffects = true; fontdlg.ShowApply = true; fontdlg.FontMustExist = true; // set the specific font dialog properties to match the current font data in metaFontData FormatFontDialogFromFontData(metaFontData); // bind the event raised by the Font Dialog Apply Button to our handler fontdlg.Apply += new System.EventHandler(FontDialog_Apply); // Create the Color Picker Dialog - removed for bugs. Will restore later. // colordlg = new ColorDialog(); // bind the MouseWheel event (can't be done from VS Designer UI) MouseWheel += ScreenSaverForm_MouseWheel; // add the context menu to our form this.ContextMenuStrip = contextMenuMain; // set title of window this.Text = ProductName; // show a picture immediately; // create the MainFiles object - this leaves the index pointed at -1 Logging.LogLineIf(fDebugTrace, " ScreenSaverForm_Load(): creating MainFiles, should kick off disk scan."); MainFiles = new MainFileInfoSource( (List<DirectoryInfo>)SettingsInfo.GetListOfDirectoryInfo(), this.GraphicFileExtensions, SettingsInfo.GetBlacklistedFullFilenames(), SettingsInfo.UseRecursion, SettingsInfo.ShuffleMode); // advance one file; this leaves the index pointed at zero Logging.LogLineIf(fDebugTrace, " ScreenSaverForm_Load(): calling DoPreviousOrNext(false)."); DoPreviousOrNext(false); // if we opened in screen saver mode, start the slideshow if (EntryPoint.fOpenInScreenSaverMode) ourSlideshow.Start(); // set state flags fFormLoadIsRunning = false; fFormLoadHasCompleted = true; Logging.LogLineIf(fDebugTrace, "ScreenSaverForm_Load(): exiting."); }
private void OnSlideshow(object sender, System.EventArgs e) { if (_slideshow != null) { // stop slideshow _slideshow.Stop(); _slideshow = null; paneImage.Box.UseTransition = false; } else { // start slideshow paneImage.Box.UseTransition = true; _slideshow = new Slideshow(_msSlideshowInterval, _nav); _slideshow.Start(); } }
void BuildMainLoadUI() { m_slidesTarget = GameObject.Find("SlidesTarget").GetComponent <RawImage>(); m_slideshow = new Slideshow(m_slidesTarget, TextureManager.GetBackgrounds()); m_slideshow.Start(); }