public Program() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); timer = new Timer(); timer.Tick += new EventHandler(timer_Tick); timer.Interval = 100; m_KeyboardListener = new KeyboardListener(Keys.MediaPlayPause, Keys.MediaStop, Keys.MediaPreviousTrack, Keys.MediaNextTrack); m_KeyboardListener.KeyDown += m_KeyboardListener_KeyDown; mpc = new MPC(Properties.Settings.Default.Server1); lcd = new LCD("MPCdotNet", false); lcd.SetPlaybackState(PlaybackState.Stopped); lcd.Artist = ""; lcd.Title = ""; lcd.Album = ""; lcd.TrackTime = 0; lcd.TrackLength = 0; window = new MainWindow(mpc); mpc.OnConnectionStateChanged += window.mpc_onConnectionStateChange; if (Properties.Settings.Default.AutoConnect) { mpc.Open(); } timer.Start(); Application.Run(window); mpc.Close(); }