Lecco
✅ [ASP.NET CORE] Error when trying to run docker image i pushed to dockerhub
I think if you add static Main method in your code you can fix error
like:
public partial class Program
{
public static void Main(string[] args)
{
// Entry point of the program
}
}
135 replies
WPF custom click event
In WPF, you can achieve this by handling the PreviewMouseLeftButtonDown or PreviewMouseRightButtonDown event at the container level and then determining which control, if any, is at the specific coordinates you are interested in.
2 replies
Out of memory error
private void VideoSource_NewFrame(object sender, NewFrameEventArgs eventArgs)
{
try
{
using (Bitmap bitmap = (Bitmap)eventArgs.Frame.Clone())
{
Application.Current.Dispatcher.Invoke(() =>
{
cameraImage.Source = BitmapToImageSource(bitmap);
});
BarcodeReader barcodeReader = new BarcodeReader(); Result result = barcodeReader.Decode(bitmap);
if (result != null) { string downloadsPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); string initialDirectory = Path.Combine(downloadsPath, "QR Codes");
if (!Directory.Exists(initialDirectory)) { Directory.CreateDirectory(initialDirectory); }
DateTime currentDateTime = DateTime.Now; string fdt = currentDateTime.ToString("yyyy-MM-dd HH_mm_ss"); string fileName = "QRCode " + fdt + ".png";
fileName = CleanFileName(fileName);
string path = Path.Combine(initialDirectory, fileName); bitmap.Save(path, System.Drawing.Imaging.ImageFormat.Png); videoSource.NewFrame -= VideoSource_NewFrame; videoSource.SignalToStop();
System.Threading.Tasks.Task.Run(() => { Application.Current.Dispatcher.Invoke(() => { cameraImage.Source = null; videoSource = null; videoDevices = null; myframe.frame.Content = new Scanned(bitmap, path, false, false); }); }); } } } catch (Exception ex) { MessageBox.Show($"Error: {ex.Message}", "An Exception occured"); } }
BarcodeReader barcodeReader = new BarcodeReader(); Result result = barcodeReader.Decode(bitmap);
if (result != null) { string downloadsPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); string initialDirectory = Path.Combine(downloadsPath, "QR Codes");
if (!Directory.Exists(initialDirectory)) { Directory.CreateDirectory(initialDirectory); }
DateTime currentDateTime = DateTime.Now; string fdt = currentDateTime.ToString("yyyy-MM-dd HH_mm_ss"); string fileName = "QRCode " + fdt + ".png";
fileName = CleanFileName(fileName);
string path = Path.Combine(initialDirectory, fileName); bitmap.Save(path, System.Drawing.Imaging.ImageFormat.Png); videoSource.NewFrame -= VideoSource_NewFrame; videoSource.SignalToStop();
System.Threading.Tasks.Task.Run(() => { Application.Current.Dispatcher.Invoke(() => { cameraImage.Source = null; videoSource = null; videoDevices = null; myframe.frame.Content = new Scanned(bitmap, path, false, false); }); }); } } } catch (Exception ex) { MessageBox.Show($"Error: {ex.Message}", "An Exception occured"); } }
19 replies