private void loadShader(string fileName) { errorLog.Visible = false; //try load new try { shaderFileName = fileName; Text = shaderFileName; fileSystemWatcher.Filter = Path.GetFileName(fileName); fileSystemWatcher.Path = Path.GetDirectoryName(fileName); fileSystemWatcher.EnableRaisingEvents = true; visual.loadShader(fileName); } catch (Exception e) { errorLog.Text = e.Message; errorLog.Visible = true; //load default shader visual.loadShader(""); } sw.Reset(); frames = 0; lastTime = 0; sw.Start(); Application_Idle(null, null); glControl.Invalidate(); }