private static IEmulatorWindow SetupWindow(ISettings settings, ILoggerFactory loggerFactory, ITextRecognition recognition) { IEmulatorWindow window = settings.EmulatorType switch { EmulatorType.NoxPlayer => new NoxWindow(settings.WindowName), EmulatorType.BlueStacks => new BluestacksWindow(loggerFactory.CreateLogger <BluestacksWindow>(), recognition, settings.WindowName), _ => throw new Exception("Invalid emulator type") }; try { window.Initialize(); } catch (FailedToFindWindowException) { var setup = new SetupWindow(); var vm = new SetupViewModel(loggerFactory.CreateLogger <SetupViewModel>(), recognition, settings); setup.DataContext = vm; vm.Saved += () => { setup.DialogResult = true; //setup.Hide(); }; if (setup.ShowDialog() != true) { Current.Shutdown(); } window = SetupWindow(settings, loggerFactory, recognition); } return(window); }
public BluestacksWindow(ILogger logger, ITextRecognition recognition, string settingsWindowName) { _logger = logger; _recognition = recognition; _settingsWindowName = settingsWindowName; _blueStacksMain = IntPtr.Zero; _blueStacksGameArea = IntPtr.Zero; }
public GameImpl(IEmulatorWindow window, IVideoProvider videoProvider, IUiRepository repository, ILoggerFactory loggerFactory, ITextRecognition recognition, ISettings settings) { _window = window; _videoProvider = videoProvider; _repository = repository; _loggerFactory = loggerFactory; _recognition = recognition; _settings = settings; _logger = _loggerFactory.CreateLogger(GetType()); }
public ImageRecognitionScanbot(Activity activity) { // Initialize all the components needed for the SDK this.activity = activity; // Set recognition languages ocrLanguages.Add(Language.Lit); //ocrLanguages.Add(Language.Eng); var scanbotSDK = new Net.Doo.Snap.ScanbotSDK(activity); pageFactory = scanbotSDK.PageFactory(); textRecognition = scanbotSDK.TextRecognition(); blobManager = scanbotSDK.BlobManager(); blobFactory = scanbotSDK.BlobFactory(); FetchOcrBlobFiles(); }