2.0.8
This commit is contained in:
@@ -34,13 +34,15 @@ public static class Extensions
|
||||
return priorityAttribute?.Priority ?? 0;
|
||||
}
|
||||
|
||||
private static List<Type> _initializedModules = new List<Type>();
|
||||
static Dictionary<IKernel,List<Type>> _initializedModules = new Dictionary<IKernel, List<Type>>();
|
||||
|
||||
|
||||
public static void InitializeModules(this IKernel self)
|
||||
{
|
||||
if (!_initializedModules.ContainsKey(self)) _initializedModules[self] = new List<Type>();
|
||||
|
||||
var serviceTypes = self.GetAll(typeof(IVisionBuilderModule)).Select(x => (IVisionBuilderModule)x)
|
||||
.Where(x => !_initializedModules.Contains(x.GetType()))
|
||||
.Where(x => !_initializedModules[self].Contains(x.GetType()))
|
||||
.OrderByDescending(GetModulePriority)
|
||||
.ToList();
|
||||
foreach (var service in serviceTypes)
|
||||
@@ -58,7 +60,7 @@ public static class Extensions
|
||||
Log.Error($"Error initializing module {service.GetType().Name}: {e}", e);
|
||||
}
|
||||
|
||||
_initializedModules.Add(service.GetType());
|
||||
_initializedModules[self].Add(service.GetType());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,9 @@ public class ErrorsVM:IEventHandler<ImageProcessedEvent>, IEventHandler<SessionS
|
||||
private readonly ILearningTool _learningTool;
|
||||
private readonly IPasswordInputService _passwordInputService;
|
||||
|
||||
private const string DATE_FORMAT = "dd.MM.yyyy";
|
||||
private const string TIME_FORMAT = "HH:mm:ss";
|
||||
|
||||
public ErrorsVM(UIConfiguration uiConfiguration, IImagePreviewService imagePreviewService, ILearningTool learningTool, IPasswordInputService passwordInputService)
|
||||
{
|
||||
_uiConfiguration = uiConfiguration;
|
||||
@@ -56,7 +59,7 @@ public class ErrorsVM:IEventHandler<ImageProcessedEvent>, IEventHandler<SessionS
|
||||
RecipeName = @event.RecipeName,
|
||||
ImageOriginal = @event.ImageOriginal,
|
||||
ImageAnalysis = @event.ImageAnalysis,
|
||||
Title =DateTime.Now.ToString("G")+ additionalInfo
|
||||
Title =DateTime.Now.ToString(DATE_FORMAT)+" "+ DateTime.Now.ToString(TIME_FORMAT) + additionalInfo
|
||||
};
|
||||
|
||||
if (Errors.Count >= _uiConfiguration.MaxErrorCount)
|
||||
|
||||
@@ -46,6 +46,14 @@ public partial class MainWindowVM:ObservableObject
|
||||
|
||||
public void OnProgramClosed()
|
||||
{
|
||||
foreach (var singleCameraVm in SingleCameraVms)
|
||||
{
|
||||
if (singleCameraVm.IsRunning)
|
||||
{
|
||||
singleCameraVm.StopCommand.Execute(null);
|
||||
|
||||
}
|
||||
}
|
||||
ProgramClosed?.Invoke();
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,19 @@ namespace VisionBuilder.UI.Common;
|
||||
|
||||
public static class VisionBuilder
|
||||
{
|
||||
private static Mutex? _mutex;
|
||||
const string mutexName = "VisionBuilder.UI.SingleInstance";
|
||||
public static bool IsAlreadyRunning()
|
||||
{
|
||||
_mutex = new Mutex(true, mutexName, out bool createdNew);
|
||||
|
||||
if (!createdNew)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
public static IKernel CreateMainKernel(InspectronSettings settings)
|
||||
{
|
||||
TypeDescriptor.AddAttributes(typeof(List<ErrorShortName>), new TypeConverterAttribute(typeof(ErrorShortNameConverter)));
|
||||
|
||||
Reference in New Issue
Block a user