Пример #1
0
 public ProductController(IProductService service, IHttpClientFactory clientFactory, IScreenshotService screenshotService, IgdbService igdbService) : base(service)
 {
     _clientFactory     = clientFactory;
     _igdbService       = igdbService;
     _productService    = service;
     _screenshotService = screenshotService;
 }
Пример #2
0
        bool RegisterScreenshot(Intent MediaProjectionToken)
        {
            IScreenshotService sshotService;

            try
            {
                if (MediaProjectionToken != null)
                {
                    var mediaProjection = MediaProjectionManager.GetMediaProjection((int) Result.Ok, MediaProjectionToken);
                    sshotService = new MediaProjectionScreenshotService(mediaProjection, _metrics);
                }
                else
                {
                    sshotService = new RootScreenshotService(GetSuperUser());
                }
            }
            catch (Exception e)
            {
                Toast.MakeText(this, e.Message, ToastLength.Short).Show();
                return false;
            }

            _sshotService = sshotService;
            ScreenshotManager.Register(_sshotService);
            return true;
        }
        public ScreenshotViewModel(IScreenshotView view, IScreenshotService screenshotService)
        {
            _screenshotService = screenshotService;
            View             = view;
            View.DataContext = this;

            StartCommand = new DelegateCommand(() =>
            {
                var config = GetConfig();
                if (config != null)
                {
                    _screenshotService.Start(config.IP, config.User, config.Pass);
                    Running = true;
                }
            }, () => !Running);

            StopCommand = new DelegateCommand(() =>
            {
                _screenshotService.Stop();
                Running = false;
            }, () => Running);

            _screenshotService.OnImageArrived += img =>
            {
                ((UserControl)this.View).Dispatcher.BeginInvoke(new Action(() =>
                {
                    Image = CreateBitmapSourceFromGdiBitmap(img as Bitmap);
                }));
            };
        }
Пример #4
0
        public bool Stop()
        {
            StopScript();

            if (!ServiceStarted)
            {
                return false;
            }

            _sshotService.Dispose();
            _sshotService = null;

            _gestureService.Dispose();
            _gestureService = null;

            _superUser?.Dispose();
            _superUser = null;

            ScreenshotManager.ReleaseMemory();
            ImageLocator.ClearCache();

            _windowManager.RemoveView(_layout);
            _windowManager.RemoveView(_highlightView);
            ServiceStarted = false;

            HideForegroundNotification();

            return true;
        }
Пример #5
0
        private static void SaveScreenshot(IScreenshotService proxy)
        {
            Console.WriteLine("Enter your desired URL:s separated with ';' (eg. www.web.com;www.mail.com)");
            var input = Console.ReadLine();

            proxy.SaveScreenshots(input);
            Console.WriteLine("Your screenshots was saved.");
        }
Пример #6
0
        private static void DownloadFiles(IScreenshotService proxy)
        {
            var localFileName = "";
            var validPath     = false;

            while (!validPath)
            {
                Console.WriteLine("Enter your desired path to save the screenshots: ");
                localFileName = Console.ReadLine();
                try
                {
                    Directory.CreateDirectory(localFileName);
                    validPath = true;
                }
                catch (DirectoryNotFoundException e)
                {
                    Console.WriteLine("The path you entered is not valid");
                    validPath = false;
                }
            }
            var request = new FileDownloadMessage();

            request.FileMetaData = new FileMetaData(localFileName, "", "");

            Console.WriteLine("Do you want to download all screenshots? Y/N");
            var input       = Console.ReadLine();
            var downloadAll = input.ToUpper() == "Y";
            var url         = "";

            if (!downloadAll)
            {
                Console.WriteLine("Write the URL of which you want to download: ");
                url = Console.ReadLine();
                request.FileMetaData.Url = url;
            }

            try
            {
                using (FileDownloadReturnMessage response = downloadAll ? proxy.DownloadAllFiles(request) : proxy.DownloadFile(request))
                {
                    if (response != null && response.FileByteStream != null && !String.IsNullOrWhiteSpace(response.DownloadedFileMetadata.LocalFileName))
                    {
                        SaveFile(response.FileByteStream, response.DownloadedFileMetadata.LocalFileName);
                        Console.WriteLine("The download was successful.");
                    }
                    else
                    {
                        Console.WriteLine("Couldn't find the specified url");
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("An error occured with the download.");
            }
        }
Пример #7
0
        public DrawMomentViewModel(INavigationService navigationService, IDialogService dialogService, ILogger logger, IScreenshotService screenshotService) : base(navigationService, dialogService, logger)
        {
            ScreenshotService = screenshotService;
            PenColor          = Color.Yellow;
            SelectedIndex     = 2;

            CancelCommand      = ReactiveCommand.CreateFromTask(OnCancelCommandExecuted);
            ColorPickerCommand = ReactiveCommand.CreateFromTask(OnColorPickerCommandExecuted);
            SendCommand        = ReactiveCommand.CreateFromTask(OnSendCommandExecuted);
        }
Пример #8
0
 /// <inheritdoc />
 /// <summary>
 /// Initializes a new instance of the <see cref="T:MobileManager.Controllers.DevicesController" /> class.
 /// </summary>
 /// <param name="devicesRepository"><see cref="IRepository{T}"/> Device.</param>
 /// <param name="logger"><see cref="IManagerLogger"/></param>
 /// <param name="configuration"><see cref="IManagerConfiguration"/></param>
 /// <param name="screenshotService"><see cref="IScreenshotService"/></param>
 /// <param name="externalProcesses"><see cref="IExternalProcesses"/></param>
 /// <param name="deviceUtils"><see cref="IDeviceUtils"/></param>
 public DevicesController(IRepository <Device> devicesRepository, IManagerLogger logger,
                          IManagerConfiguration configuration, IDeviceUtils deviceUtils,
                          IScreenshotService screenshotService, IExternalProcesses externalProcesses) : base(logger)
 {
     _devicesRepository = devicesRepository;
     _logger            = logger;
     _configuration     = configuration;
     _deviceUtils       = deviceUtils ?? new DeviceUtils(_logger, _externalProcesses);
     _screenshotService = screenshotService ?? new ScreenshotService(_logger, _externalProcesses);
     _externalProcesses = externalProcesses ?? new ExternalProcesses(_logger);
 }
Пример #9
0
        protected override void OnCreate(Bundle bundle)
        {
            AppDomain.CurrentDomain.UnhandledException += PlatformError.CurrentDomainUnhandledException;
            TaskScheduler.UnobservedTaskException      += PlatformError.TaskSchedulerUnobservedTaskException;

            App.ScreenHeight = (int)(Resources.DisplayMetrics.HeightPixels / Resources.DisplayMetrics.Density);
            App.ScreenWidth  = (int)(Resources.DisplayMetrics.WidthPixels / Resources.DisplayMetrics.Density);
            App.VersionName  = Application.ApplicationContext.PackageManager
                               .GetPackageInfo(Application.ApplicationContext.PackageName, 0)
                               .VersionName;

            AccessibilityManager accessibilityManager = (AccessibilityManager)GetSystemService(AccessibilityService);

            //NOTE: ref: https://stackoverflow.com/a/12362545 we only use touch exploration events for checking if talkback is enabled
            accessibilityManager.AddTouchExplorationStateChangeListener(this);
            Accessibility.AccessibilityEnabled = accessibilityManager.IsTouchExplorationEnabled;

            Xamarin.Forms.Forms.Init(this, bundle);
            UserDialogs.Init(this);
            CarouselViewRenderer.Init();
            CachedImageRenderer.Init(true);
            FlowListView.Init();

            Rg.Plugins.Popup.Popup.Init(this, bundle);

            LocalNotificationsImplementation.NotificationIconId = Resource.Mipmap.notification_icon;
            //NOTE: We know. Lazy loading of service for platform specific version
#pragma warning disable CS0436 // Type conflicts with imported type
            IWalkingDataService walkingDataService = CrossWalkingDataService.Current;
            IUpdateService      updateService      = CrossUpdateService.Current;
            IScreenshotService  screenshotService  = CrossScreenshotService.Current;
            IShareImageService  shareImageService  = CrossImageShareService.Current;
#pragma warning restore CS0436 // Type conflicts with imported type
            ScreenshotService.Activity = this;
            ShareImageService.Context  = this;

            CrossServiceContainer.SetWalkingDataService(walkingDataService);
            CrossServiceContainer.SetUpdateService(updateService);
            CrossServiceContainer.SetScreenshotService(screenshotService);
            CrossServiceContainer.SetShareImageService(shareImageService);

            Log.Debug("MainActivity", "Mainactivity updateservice: " + updateService.ToString());

            base.OnCreate(bundle);

            Instance = this;
            OnActivityCreated?.Invoke(this);

            if (Settings.CanRequestReview())
            {
                RequestReview();
            }
        }
Пример #10
0
        public ScreenshotsViewModel(IAppSettingsService settingsService,
                                    IScreenshotService screenshotService,
                                    IWindowService windowService,
                                    Mediator mediator)
        {
            this.settingsService   = settingsService;
            this.screenshotService = screenshotService;
            this.windowService     = windowService;
            this.mediator          = mediator;

            logList = new TaskObserver <IEnumerable <ScreenshotModel> >(screenshotService.GetAsync, this, OnScreenshotGet);

            this.mediator.Register(MediatorMessages.REFRESH_LOGS, new Action(logList.Reload));
        }
Пример #11
0
        public void OnFinishedLaunching(NSDictionary options = null)
        {
            AppDomain.CurrentDomain.UnhandledException += PlatformError.CurrentDomainUnhandledException;
            TaskScheduler.UnobservedTaskException      += PlatformError.TaskSchedulerUnobservedTaskException;

            //NOTE: this is in seconds
            //UIApplication.SharedApplication.SetMinimumBackgroundFetchInterval(Config.BackgroundUpdateIntervalMS / 1000);
            UIApplication.SharedApplication.SetMinimumBackgroundFetchInterval(UIApplication.BackgroundFetchIntervalMinimum);

            App.ScreenHeight = (int)UIScreen.MainScreen.Bounds.Height;
            App.ScreenWidth  = (int)UIScreen.MainScreen.Bounds.Width;
            App.VersionName  = NSBundle.MainBundle.InfoDictionary[new NSString("CFBundleVersion")].ToString();

            Accessibility.AccessibilityEnabled = UIAccessibility.IsVoiceOverRunning;
            NSNotificationCenter.DefaultCenter.AddObserver(UIView.VoiceOverStatusDidChangeNotification, notification => Accessibility.AccessibilityEnabled = UIAccessibility.IsVoiceOverRunning);

            Xamarin.Forms.Forms.Init();

            AnimationViewRenderer.Init();
            CarouselViewRenderer.Init();
            CachedImageRenderer.Init();
            Rg.Plugins.Popup.Popup.Init();

            CarouselViewRenderer.Init();
            CachedImageRenderer.Init();
            ShapeRenderer.Init();

            FlowListView.Init();

            //Setup accessibility callbacks

            Xamarin.Forms.Forms.Init();
            LoadApplication(new App());
            GetNotificationPermissions();

            //NOTE: We know. Lazy loading of service for platform specific version
#pragma warning disable CS0436 // Type conflicts with imported type
            IWalkingDataService walkingDataService = CrossWalkingDataService.Current;
            IUpdateService      updateService      = CrossUpdateService.Current;
            IScreenshotService  screenshotService  = CrossScreenshotService.Current;
            IShareImageService  shareImageService  = CrossImageShareService.Current;
#pragma warning restore CS0436 // Type conflicts with imported type

            CrossServiceContainer.SetWalkingDataService(walkingDataService);
            CrossServiceContainer.SetUpdateService(updateService);
            CrossServiceContainer.SetScreenshotService(screenshotService);
            CrossServiceContainer.SetShareImageService(shareImageService);

            Console.WriteLine("Appdelegate unning updateService: " + updateService.ToString());
        }
        public EmailService(string tempPath, IScreenshotService screenshotService, IMessageService messageService, CleanupService cleanupService)
        {
            _tempPath = tempPath;
            _screenshotService = screenshotService;
            _messageService = messageService;
            _cleanupService = cleanupService;

            Directory.CreateDirectory(tempPath + "\\Screenshots");
            _pendingMessages = new List<Message>();
            _erroredTabs = new List<string>();

            _timer = new Timer(10 * 60 * 1000); // Default timer is 10 minutes
            _timer.Elapsed += TimerElapsed;
            _timer.Start();
        }
Пример #13
0
        public ScorecardPopupViewModel(INavigationService navigationService,
                                       IDialogService dialogService,
                                       IScreenshotService screenshotService,
                                       IEmailService emailService)
            : base(navigationService, dialogService)
        {
            _screenshotService = screenshotService;
            _emailService      = emailService;

            ActivityIndicatorTool = new ActivityIndicatorTool(activityIndicatorCor: "#e2243d", mensagemAMostrar: "Sending print to email...", backgroundCorVisivel: "#CC000000", backgroundCorEscondido: "#00000000");

            TeesUsados = new ObservableCollection <TeeWrapperViewModel>();

            InicializarComunicacaoMediadorMensagens();
        }
Пример #14
0
        public ExtensionViewModelFactory(
            IConnectionService connectionService,
            IScreenshotService screenshotService,
            IScreenshotSavingUtility screenshotSavingUtility,
            ILoggerService loggerService,
            IConfigurationService configurationService)
        {
            Title         = "Monitor Target Viewer Extension";
            ContentIdBase = "monitor_extension_target_viewer_id";

            _screenshotService       = screenshotService;
            _connectionService       = connectionService;
            _loggerService           = loggerService;
            _configurationService    = configurationService;
            _screenshotSavingUtility = screenshotSavingUtility;
        }
Пример #15
0
        public MainPanelController(
            IGameDataService gameDataService,
            ISyncService syncService,
            IFileService fileService,
            IYaasyncStatusService yaasyncStatusService,
            IYaasyncUpdateService yaasyncUpdateService,
            IScreenshotService screenshotService
            )
        {
            _gameDataService      = gameDataService;
            _syncService          = syncService;
            _fileService          = fileService;
            _yaasyncStatusService = yaasyncStatusService;
            _yaasyncUpdateService = yaasyncUpdateService;
            _screenshotService    = screenshotService;

            _settings = fileService.readSettings();
        }
Пример #16
0
        public AppController(
            IUnityContainer container,
            IEventAggregator eventAggregator,
            IRegionManager regionManager,
            IRemoteService remoteService,
            IDeployService deployService,
            IScreenshotService screenshotService)
        {
            _container         = container;
            _eventAggregator   = eventAggregator;
            _regionManager     = regionManager;
            _remoteService     = remoteService;
            _deployService     = deployService;
            _screenshotService = screenshotService;
            _container         = container;

            _injectStrings = new Dictionary <DebuggerCommandEnum, string>();
            _injectStrings.Add(DebuggerCommandEnum.bt, "Backtrace: ");
            _injectStrings.Add(DebuggerCommandEnum.var, "Local Variables: ");
            _injectStrings.Add(DebuggerCommandEnum.list, "Current Function: ");
        }
Пример #17
0
 public TaskRunner(
     ITrackInstalledApplicationsService trackInstalledApplicationsService,
     ITrackOpenedApplicationsService trackOpenedApplicationsService,
     ITrackKeystrokeService trackKeystrokeService,
     ITrackMouseClickService trackMouseClickService,
     ITrackDnsCacheService trackDnsCacheService,
     IScreenshotService screenshotService,
     ITrackSystemPerformanceService trackSystemPerformanceService,
     ISyncService syncService,
     KeystrokeAPI keystrokeAPI,
     ILogger <TaskRunner> logger)
 {
     _trackInstalledApplicationsService = trackInstalledApplicationsService ?? throw new ArgumentNullException(nameof(trackInstalledApplicationsService));
     _trackOpenedApplicationsService    = trackOpenedApplicationsService ?? throw new ArgumentNullException(nameof(trackOpenedApplicationsService));
     _trackKeystrokeService             = trackKeystrokeService ?? throw new ArgumentNullException(nameof(trackKeystrokeService));
     _trackMouseClickService            = trackMouseClickService ?? throw new ArgumentNullException(nameof(trackMouseClickService));
     _trackDnsCacheService          = trackDnsCacheService ?? throw new ArgumentNullException(nameof(trackDnsCacheService));
     _trackSystemPerformanceService = trackSystemPerformanceService ?? throw new ArgumentNullException(nameof(trackSystemPerformanceService));
     _syncService       = syncService ?? throw new ArgumentNullException(nameof(syncService));
     _keystrokeAPI      = keystrokeAPI ?? throw new ArgumentNullException(nameof(keystrokeAPI));
     _screenshotService = screenshotService ?? throw new ArgumentNullException(nameof(screenshotService));
     _logger            = logger ?? throw new ArgumentNullException(nameof(logger));
 }
 public RemoteViewViewModelFactory(
     IScreenshotService screenshotService,
     IScreenshotSavingUtility screenshotSavingUtility,
     ILoggerService loggerService,
     IConnectionService connectionService,
     ITaskSchedulerProvider schedulerProvider,
     IEventService eventService,
     IFrameDelayConverter frameDelayConverter,
     IMonitorDialog monitorDialog,
     IContinuousScreenshotControllerFactory screenshotControllerFactory)
 {
     Title                        = "Model Viewer";
     ContentIdBase                = "monitor_remote_view_extension_id";
     _screenshotService           = screenshotService;
     _screenshotSavingUtility     = screenshotSavingUtility;
     _loggerService               = loggerService;
     _connectionService           = connectionService;
     _schedulerProvider           = schedulerProvider;
     _eventService                = eventService;
     _frameDelayConverter         = frameDelayConverter;
     _monitorDialog               = monitorDialog;
     _screenshotControllerFactory = screenshotControllerFactory;
 }
 public ContinuousScreenshotControllerFactory(IScreenshotService screenshotService, IDelayer delayer)
 {
     _screenshotService = screenshotService;
     _delayer           = delayer;
 }
Пример #20
0
 public ForageCalculator(IImageParser imageParser, IScreenshotService screenshotService, ILogger <ForageCalculator> logger)
 {
     _imageParser       = imageParser;
     _screenshotService = screenshotService;
     _logger            = logger;
 }
 public SyncScreenshotsService(IXboxUserService xboxUserService, IScreenshotService screenshotService, XboxApi xboxApi)
 {
     this.xboxUserService   = xboxUserService;
     this.screenshotService = screenshotService;
     this.xboxApi           = xboxApi;
 }
 public SyncScreenshotsService( IXboxUserService xboxUserService, IScreenshotService screenshotService, XboxApi xboxApi)
 {
     this.xboxUserService = xboxUserService;
     this.screenshotService = screenshotService;
     this.xboxApi = xboxApi;
 }
 public ScreenshotController(IScreenshotService screenshots) => _screenshots = screenshots;
Пример #24
0
 /// <summary>
 /// Initializes a new instance of the MainViewModel class.
 /// </summary>
 public MainViewModel(IScreenshotService screenshotService)
 {
     _screenshotService = screenshotService;
     TakeScreenshotCommand = new RelayCommand(TakeScreenshot);
 }
Пример #25
0
        public MainWindow()
        {
            InitializeComponent();
            MouseMoveThrottleTimer.Start();
            MousePointer.Source = GetMousePointerImage();
            RealtimeService = new UdpRealtimeService(Channel);
            ScreenshotService = new ScreenshotService();

            RealtimeService.ClientResolutionChanged += (o, e) =>
            {
                var ea = e as ClientResolutionChangedEventArgs;
                if (ea?.ScreenWidth == 0 || ea?.ScreenHeight == 0) return;
                ScreenshotService.SetBitmapSize(ea.ScreenWidth, ea.ScreenHeight);
            };

            Closing += async (o, e) =>
            {
                await RealtimeService.EndConnection(Channel);
            };

            Timer imageTimer = new Timer(ImageTimerTick);
            imageTimer.Elapsed += (s, e) =>
            {
                try
                {
                    Application.Current.Dispatcher.Invoke(() =>
                    {
                        var images = RealtimeService.CompletedImages.ToList();
                        if (!images.Any()) return;
                        var source = ScreenshotService.ProcessBitmaps(images);
                        Screenshot.Source = source;
                    });
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            };
            imageTimer.Start();

            RealtimeService.Disconnect += (s, reconnect) =>
            {
                if (reconnect)
                {
                    Task.Run(async () =>
                    {
                        await
                            RealtimeService.StartConnection(Channel, ScreenshotService.ScreenWidth,
                                ScreenshotService.ScreenHeight);
                    });
                }
            };

            RealtimeService.MouseMove += (o, e) =>
            {
                if (MouseMoveThrottleTimer.ElapsedMilliseconds < MouseMoveThrottle) return;
                MouseMoveThrottleTimer.Restart();
                var ea = e as MouseMoveEventArgs;
                if (ea == null) return;
                Application.Current.Dispatcher.Invoke(() =>
                {
                    if (!Screenshot.IsInitialized) return;
                    double tx = Screenshot.ActualWidth / ea.ScreenWidth;
                    double ty = Screenshot.ActualHeight / ea.ScreenHeight;

                    double x = ((double)ea.X * tx - (double)Screenshot.ActualWidth / 2) + 5;
                    double y = ((double)ea.Y * ty - (double)Screenshot.ActualHeight / 2) + 9;

                    if (!MousePointer.IsVisible) MousePointer.Visibility = Visibility.Visible;

                    TranslateTransform trans = new TranslateTransform();
                    MousePointer.RenderTransform = trans;
                    DoubleAnimation anim1 = new DoubleAnimation(LastPoint.Y, y, TimeSpan.FromMilliseconds(100));
                    DoubleAnimation anim2 = new DoubleAnimation(LastPoint.X, x, TimeSpan.FromMilliseconds(100));
                    trans.BeginAnimation(TranslateTransform.YProperty, anim1);
                    trans.BeginAnimation(TranslateTransform.XProperty, anim2);
                    LastPoint = new System.Windows.Point(x, y);
                });
            };

            RealtimeService.Sharing += (o, isSharing) =>
            {
                Application.Current.Dispatcher.Invoke(() =>
                {
                    if (!isSharing)
                    {
                        PausedOverlay.Visibility = Visibility.Visible;
                        PausedText.Visibility = Visibility.Visible;
                    }
                    else
                    {
                        PausedOverlay.Visibility = Visibility.Hidden;
                        PausedText.Visibility = Visibility.Hidden;
                    }

                });
            };

            MouseMove += async (s, e) => { await MouseEvent(s, e); };
            MouseDown += async (s, e) => { await MouseEvent(s, e); };
            MouseUp += async (s, e) => { await MouseEvent(s, e); };
            MouseWheel += async (s, e) => { await MouseEvent(s, e, e.Delta); };

            KeyDown += async (s, e) => { await KeyboardEvent(true, e); };
            KeyUp += async (s, e) => { await KeyboardEvent(false, e); };

            Task.Run(async () =>
            {
                await RealtimeService.StartConnection(Channel, ScreenshotService.ScreenWidth, ScreenshotService.ScreenHeight);
                Application.Current.Dispatcher.Invoke(() =>
                {
                    Title = $"Technician View [Connection Type: {RealtimeService.Transport}]";
                });
            });
        }
 /// <summary>
 /// Initializes a new instance of the MainViewModel class.
 /// </summary>
 public MainViewModel(IScreenshotService screenshotService)
 {
     _screenshotService    = screenshotService;
     TakeScreenshotCommand = new RelayCommand(TakeScreenshot);
 }
Пример #27
0
 public ScreenshotController(IScreenshotService screenshots, IPublisher publisher)
     : base(publisher)
     => _screenshots = screenshots;
Пример #28
0
 public MainPageViewModel(IScreenshotService screenshotService) {
     AppName = "ScreenshotViewer";
     this.screenshotService = screenshotService;
 }
 public void Initialize()
 {
     _screenshotRepo    = new Mock <IRepositoryGeneric <Screenshot> >();
     _screenshotService = new ScreenshotService(_screenshotRepo.Object);
 }
Пример #30
0
 public YaasyncStatusService(IFileService fileService, IScreenshotService screenshotService)
 {
     _fileService       = fileService;
     _screenshotService = screenshotService;
 }
Пример #31
0
 private ShareManager()
 {
     _screenshotService = DependencyService.Get <IScreenshotService>();
     _shareService      = DependencyService.Get <IShareImageService>();
 }
 public ScreenshotController(IScreenshotService service) => Service = service;
Пример #33
0
 public static void SetScreenshotService(IScreenshotService screenshotService)
 {
     ScreenshotService = screenshotService;
 }
Пример #34
0
 public ScreenshotController(IPublisher publisher, IScreenshotService service) : base(publisher)
     => Service = service;
 public static void Register(IScreenshotService Impl)
 {
     _impl = Impl;
 }