private async void ClickButtonAsync() { try { ImageProcessing.ImageProcessing ip = new ImageProcessing.ImageProcessing(); ip.ImageOpen(_OldImage); Stopwatch Timer = new Stopwatch(); Timer.Start(); await ip.ToMainColorsAsync(); Timer.Stop(); TimeShow(Timer.ElapsedMilliseconds); LoadFromMemory(ip.bitMap); } catch (ArgumentNullException) { MessageBox.Show("You must load a image first"); } catch { MessageBox.Show("There was a problem with render picture"); } }