public MainWindow() { //Set up the icon first notify = new NotifyIcon { Text = "DrawingRecorder", Icon = Properties.Resources.notify_norm, Visible = true }; //startup initializing InitializeComponent(); //objects needed appmani = new AppManager(false, notify); ffmpeg = new FFmpeg(); graph = new Graph((bool)DC_box.IsChecked); recorder = new Recorder(appmani, ffmpeg, graph, CaptureButton, RecordButton, notify); recorder.Start(); //windows initializing area_window = new AreaWind(); displayer = new Displayer(); //setup the mouseclick event of the icon notify.MouseClick += (s, e) => { if (e.Button == MouseButtons.Left) { Show(); ShowInTaskbar = true; Activate(); if (displayer.IsVisible) { displayer.Show(); displayer.Activate(); } } else if (e.Button == MouseButtons.Right) { if (recorder.Recording()) { recorder.StopRecording(); } else { recorder.StartRecording(); } } }; //initialize the UI thread and start it UI_thread = new Thread(UIthread); UI_thread.Start(); Drag_thread = new Thread(NewDragMove); Drag_thread.Start(); loadSettings(); }