コード例 #1
0
        static void Main(string[] args)
        {
            // Get my dirty XML config
            string cameraAddress  = ConfigurationManager.AppSettings["CameraAddress"];
            string cameraUsername = ConfigurationManager.AppSettings["CameraUsername"];
            string cameraPassword = ConfigurationManager.AppSettings["CameraPassword"];
            string snapshotFolder = ConfigurationManager.AppSettings["SnapshotFolder"];
            // FTP Option
            string ftpAddress  = ConfigurationManager.AppSettings["FTPAddress"];
            string ftpUsername = ConfigurationManager.AppSettings["FTPUsername"];
            string ftpPassword = ConfigurationManager.AppSettings["FTPPassword"];

            // Setup
            camera = new Camera(new Uri(cameraAddress));
            if (!string.IsNullOrEmpty(cameraPassword))
            {
                camera.Credentials = new NetworkCredential(cameraUsername, cameraPassword);
            }

            saver = new FileImageSaver(snapshotFolder);
            //saver = new FTPImageSaver(new Uri(ftpAddress), ftpUsername, ftpPassword);
            retriever = new ImageRetriever();

            int seconds;

            if (args.Length > 0 && int.TryParse(args[0], out seconds))
            {
                Timer timer = new Timer(TimerTick, null, TimeSpan.Zero, TimeSpan.FromSeconds(seconds));
                System.Console.ReadLine();                 // Chillout and wait for the timer mo'fo
            }
            else
            {
                TimerTick(null);                 // Force it once
            }
        }
コード例 #2
0
        public MainWindowViewModel(IImageSaver imageSaver)
        {
            _imageSaver = imageSaver ?? throw new ArgumentNullException(nameof(imageSaver));

            WebImageProvider       = new WebImageProvider();
            HardDriveImageProvider = new HardDriveImageProvider();
        }
コード例 #3
0
 public UserPostService(IRepositoryWrapper repository, IMapper mapper,
                        IImageSaver imageSaver)
 {
     _repository = repository;
     _mapper     = mapper;
     _imageSaver = imageSaver;
 }
コード例 #4
0
 public TagCloud(ITagDrawer drawer, ITextReader textReader, IWordsAnalyzer wordsAnalyzer, IImageSaver imageSaver)
 {
     this.drawer        = drawer;
     this.textReader    = textReader;
     this.wordsAnalyzer = wordsAnalyzer;
     this.imageSaver    = imageSaver;
 }
コード例 #5
0
ファイル: Program.cs プロジェクト: cargowire/IPCameraSnapper
        static void Main(string[] args)
        {
            // Get my dirty XML config
            string cameraAddress = ConfigurationManager.AppSettings["CameraAddress"];
            string cameraUsername = ConfigurationManager.AppSettings["CameraUsername"];
            string cameraPassword = ConfigurationManager.AppSettings["CameraPassword"];
            string snapshotFolder = ConfigurationManager.AppSettings["SnapshotFolder"];
            // FTP Option
            string ftpAddress = ConfigurationManager.AppSettings["FTPAddress"];
            string ftpUsername = ConfigurationManager.AppSettings["FTPUsername"];
            string ftpPassword = ConfigurationManager.AppSettings["FTPPassword"];

            // Setup
            camera = new Camera(new Uri(cameraAddress));
            if(!string.IsNullOrEmpty(cameraPassword))
                camera.Credentials = new NetworkCredential(cameraUsername, cameraPassword);

            saver = new FileImageSaver(snapshotFolder);
            //saver = new FTPImageSaver(new Uri(ftpAddress), ftpUsername, ftpPassword);
            retriever = new ImageRetriever();

            int seconds;
            if (args.Length > 0 && int.TryParse(args[0], out seconds))
            {
                Timer timer = new Timer(TimerTick, null, TimeSpan.Zero, TimeSpan.FromSeconds(seconds));
                System.Console.ReadLine(); // Chillout and wait for the timer mo'fo
            }
            else
            {
                TimerTick(null); // Force it once
            }
        }
コード例 #6
0
 public ConsoleTagsCloudCreator(ITagsCloudCreator creator, IImageSaver saver, IWordReader reader,
                                IWordProcessor processor)
 {
     this.creator   = creator;
     this.saver     = saver;
     this.reader    = reader;
     this.processor = processor;
 }
コード例 #7
0
 public ProfilePhotoSaver(IImageSaver imageSaver,
                          CurrentUserCredentialsGetter userCredentialsGetter,
                          IRepository <int, ProfilePhoto> profileRepo)
 {
     _imageSaver            = imageSaver;
     _userCredentialsGetter = userCredentialsGetter;
     _profileRepo           = profileRepo;
 }
コード例 #8
0
ファイル: GUI.cs プロジェクト: TGladysheva/di
 public Gui(CloudCreator cloudCreator, IReader reader, ITextParser parser, TagCloudVisualizer visualizer, IImageSaver saver)
 {
     this.cloudCreator = cloudCreator;
     this.reader       = reader;
     this.saver        = saver;
     this.visualizer   = visualizer;
     this.parser       = parser;
 }
コード例 #9
0
 public CloudDrawer(ICloudLayouter cloudLayouter, IColorProvider colorProvider, IImageSaver imageSaver)
 {
     this.cloudLayouter = cloudLayouter;
     ChangeImageSize(300);
     cloudLayouter.ChangeCenter(new Point(ImageSize / 2, ImageSize / 2));
     ImageSaver    = imageSaver;
     ColorProvider = colorProvider;
 }
コード例 #10
0
ファイル: TagCloudHelper.cs プロジェクト: Wexxion/TagsCloud
 public TagCloudHelper(ITextReader textReader, TagCloudTextAnalyzer textAnalyzer, TagCloudDrawer drawer,
                       IImageSaver imageSaver)
 {
     this.textReader   = textReader;
     this.textAnalyzer = textAnalyzer;
     this.drawer       = drawer;
     this.imageSaver   = imageSaver;
     Settings          = new TagCloudSettings();
 }
コード例 #11
0
        public void Init()
        {
            _offerRepositoryMock = Substitute.For <IOfferRepository>();
            _geoCodeProviderMock = Substitute.For <IGeoCodeProvider>();
            _imagePathBuilder    = Substitute.For <IImagePathBuilder>();
            _imageSaver          = Substitute.For <IImageSaver>();

            _offerService = new OfferService(_offerRepositoryMock, _geoCodeProviderMock, _imagePathBuilder, _imageSaver);
        }
コード例 #12
0
 public TagCloudMaker(IWordProcessor wordProcessor, ICloudLayouter cloudLayouter,
                      ITagCloudDrawer tagCloudDrawer, IImageSaver imageSaver, DrawingSettings settings)
 {
     this.wordProcessor  = wordProcessor;
     this.cloudLayouter  = cloudLayouter;
     this.tagCloudDrawer = tagCloudDrawer;
     this.imageSaver     = imageSaver;
     this.settings       = settings;
 }
コード例 #13
0
 public OfferService(IOfferRepository offerRepository,
                     IGeoCodeProvider geoCodeProvider,
                     IImagePathBuilder imageUrlBuilder,
                     IImageSaver imageSaver)
 {
     _offerRepository = offerRepository;
     _geoCodeProvider = geoCodeProvider;
     _imageUrlBuilder = imageUrlBuilder;
     _imageSaver      = imageSaver;
 }
コード例 #14
0
        public MainWindow()
        {
            InitializeComponent();

            this.currentShape      = Enums.Shape.Line;
            this.shapeDrawer       = new ShapeDrawer();
            this.solidColorBrushes = typeof(Brushes).GetProperties().Select((x) => (x.GetValue(null) as SolidColorBrush));
            this.imageSaver        = new SaveImageToFile();
            this.AddColorsToMenus();
        }
コード例 #15
0
 public ObjectPhotoService(IImageSaver imageSaver,
                           IRepository <int, OfferedObject> objectsRepo,
                           IRepository <int, ObjectPhoto> photoRepo,
                           IOwnershipAuthorization <int, OfferedObject> authorizer)
 {
     _imageSaver  = imageSaver;
     _objectsRepo = objectsRepo;
     _photoRepo   = photoRepo;
     _authorizer  = authorizer;
 }
コード例 #16
0
 public Application(IFileReader reader, IToSizeConverter wordConverter,
                    IWordFilter filter, ICloudLayouter layouter,
                    IVisualisator visualisator, IImageSaver saver)
 {
     this.reader        = reader;
     this.wordConverter = wordConverter;
     this.filter        = filter;
     this.layouter      = layouter;
     this.saver         = saver;
     this.visualisator  = visualisator;
     this.saver         = saver;
 }
コード例 #17
0
ファイル: ImageModel.cs プロジェクト: FlipDD/TheMediaEditor
        /// <summary>
        /// Constructor for objects of type ImageModel
        /// </summary>
        /// <param name="currentImage">The image associated with this model</param>
        /// <param name="imageEditor">The ImageEditor used to edit the image (Resize, Flip, Rotate)</param>
        /// <param name="imageSaver">The ImageSaver used to save the image to a specific path/filename</param>
        public void Initialise(Image currentImage, IImageEditor imageEditor, IImageSaver imageSaver)
        {
            // SET the parameters
            _image       = currentImage;
            _imageEditor = imageEditor;
            _imageSaver  = imageSaver;

            // Initialize the List:
            _currentEditFuncs = new List <Func <Image, Image> >();

            // Instantiate imageData:
        }
コード例 #18
0
ファイル: TagCloudWindow.xaml.cs プロジェクト: TGladysheva/di
 public TagCloudWindow(CloudCreator cloudCreator, IReader reader, ITextParser parser,
                       TagCloudVisualizer visualizer, IImageSaver saver)
 {
     this.cloudCreator = cloudCreator;
     this.reader       = reader;
     this.saver        = saver;
     this.visualizer   = visualizer;
     this.parser       = parser;
     InitializeComponent();
     DataContext = this;
     this.Show();
 }
コード例 #19
0
 public void SetSettings(IFileReader reader,
                         ICloudLayouter layouter,
                         IPreprocessor preprocessor,
                         IImageSaver saver,
                         ICloudBuilder builder)
 {
     this.reader       = reader;
     this.layouter     = layouter;
     this.preprocessor = preprocessor;
     this.saver        = saver;
     this.cloudBuilder = builder;
 }
コード例 #20
0
ファイル: ConsoleUI.cs プロジェクト: lgnv/di
 public ConsoleUi(IReader[] readers,
                  IImageBuilder tagCloudImageCreator, ILayoutAlgorithm layoutAlgorithm,
                  IImageSaver imageSaver,
                  Filter filter, WordConverter wordConverter)
 {
     this.filter               = filter;
     this.wordConverter        = wordConverter;
     this.readers              = readers;
     this.tagCloudImageCreator = tagCloudImageCreator;
     this.imageSaver           = imageSaver;
     this.layoutAlgorithm      = layoutAlgorithm;
 }
コード例 #21
0
ファイル: ApplicationCore.cs プロジェクト: lgnv/fp
 public ApplicationCore(ReaderFinder readerFinder,
                        IImageBuilder tagCloudImageBuilder, ILayoutAlgorithm layoutAlgorithm,
                        IImageSaver imageSaver,
                        Filter filter, WordConverter wordConverter)
 {
     this.filter               = filter;
     this.wordConverter        = wordConverter;
     this.readerFinder         = readerFinder;
     this.tagCloudImageBuilder = tagCloudImageBuilder;
     this.imageSaver           = imageSaver;
     this.layoutAlgorithm      = layoutAlgorithm;
 }
コード例 #22
0
 public PhotoAdder(IImageSaver imageSaver,
                   CurrentUserCredentialsGetter credentialsGetter,
                   IRepository <int, OfferedObject> objectsRepo,
                   IRepository <int, ObjectPhoto> photoRepo,
                   OwnershipAuthorization <int, OfferedObject> authorizer)
 {
     _imageSaver        = imageSaver;
     _credentialsGetter = credentialsGetter;
     _objectsRepo       = objectsRepo;
     _photoRepo         = photoRepo;
     _authorizer        = authorizer;
 }
コード例 #23
0
 public ImageCreator(ITextReader reader, IWordProcessor wordProcessor,
                     IWordFrequenciesToSizesConverter converter, ILayouter layouter, IImageSizeCalculator imageSizeCalculator,
                     IRectanglesTransformer rectanglesTransformer, IVisualizer visualizer, IImageSaver saver)
 {
     this.reader                = reader;
     this.wordProcessor         = wordProcessor;
     this.converter             = converter;
     this.layouter              = layouter;
     this.imageSizeCalculator   = imageSizeCalculator;
     this.rectanglesTransformer = rectanglesTransformer;
     this.visualizer            = visualizer;
     this.saver = saver;
 }
コード例 #24
0
        public MotionSensorStartup(MotionSensorSetup setup)
        {
            //setup the extractor
            imageExtractor = new ImageExtractor(setup.camera);
            imageExtractor.framerateBroadcast += new ImageExtractor.FramerateBroadcastEvent(FramerateBroadcastEventHandler);
            imageExtractor.asyncrohous = true;

            //set up the save file object
            imageSaver = new ImageSaver(setup.imageSaveLocation, "movement", setup.camera.cameraId);
            imageSaver.saveToFileServer = true; //setup.saveImagesToFileServer;
            imageSaver.saveToDatabase = setup.saveImagesToDatabase;
            imageSaver.ParentDirectory = setup.imageSaveLocation;
            captureId = imageSaver.captureId;

            //set up the database object
            if(setup.saveImagesToDatabase)
            {
                database = new CaptureDb(ConfigurationManager.ConnectionStrings["LOCALDB"].ConnectionString);
                database.CreateCaptureSession(captureId, imageSaver.SaveDirectory);
                detectionId = database.CreateDetectionSession(captureId);
                imageSaver.detectionId = detectionId;
            }

            //setup the motion sensor
            motionSensor = new MotionSensor_2a();
            motionSensor.settings = new MotionSensorSettings();
            motionSensor.settings.LoadDefaults();

            motionSensor.motionDetected += new MotionSensor_2.MotionDetected(imageSaver.ImageCreatedAsync);

            //create the validator 
            imageValidator = new ImageValidator();
            imageValidator.ListenForImages(imageExtractor);
            imageValidator.imageValidated += new ImageValidator.ImageValidatedEvent(motionSensor.ImageCreatedAsync);//subscribe to events from the validator

            //setup the alarms
            alarms = new List<IAlarm>();
            if (setup.emailAlarm != null)
            {
                alarms.Add(setup.emailAlarm as EmailAlarm);
                imageSaver.imageCreated += new ImageSaver.ImageSavedEvent(setup.emailAlarm.ImageExtracted);
            }

            imageExtractor.Run();

        }
コード例 #25
0
        public MotionSensorStartup(MotionSensorSetup setup)
        {
            //setup the extractor
            imageExtractor = new ImageExtractor(setup.camera);
            imageExtractor.framerateBroadcast += new ImageExtractor.FramerateBroadcastEvent(FramerateBroadcastEventHandler);
            imageExtractor.asyncrohous         = true;

            //set up the save file object
            imageSaver = new ImageSaver(setup.imageSaveLocation, "movement", setup.camera.cameraId);
            imageSaver.saveToFileServer = true; //setup.saveImagesToFileServer;
            imageSaver.saveToDatabase   = setup.saveImagesToDatabase;
            imageSaver.ParentDirectory  = setup.imageSaveLocation;
            captureId = imageSaver.captureId;

            //set up the database object
            if (setup.saveImagesToDatabase)
            {
                database = new CaptureDb(ConfigurationManager.ConnectionStrings["LOCALDB"].ConnectionString);
                database.CreateCaptureSession(captureId, imageSaver.SaveDirectory);
                detectionId            = database.CreateDetectionSession(captureId);
                imageSaver.detectionId = detectionId;
            }

            //setup the motion sensor
            motionSensor          = new MotionSensor_2a();
            motionSensor.settings = new MotionSensorSettings();
            motionSensor.settings.LoadDefaults();

            motionSensor.motionDetected += new MotionSensor_2.MotionDetected(imageSaver.ImageCreatedAsync);

            //create the validator
            imageValidator = new ImageValidator();
            imageValidator.ListenForImages(imageExtractor);
            imageValidator.imageValidated += new ImageValidator.ImageValidatedEvent(motionSensor.ImageCreatedAsync);//subscribe to events from the validator

            //setup the alarms
            alarms = new List <IAlarm>();
            if (setup.emailAlarm != null)
            {
                alarms.Add(setup.emailAlarm as EmailAlarm);
                imageSaver.imageCreated += new ImageSaver.ImageSavedEvent(setup.emailAlarm.ImageExtracted);
            }

            imageExtractor.Run();
        }
コード例 #26
0
ファイル: Application.cs プロジェクト: lamanoff/fp
 public Application(
     ICloudLayouter layouter,
     IVisualizer visualizer,
     IFileReader fileReader,
     IImageSaver imageSaver,
     IStatisticsCollector statisticsCollector,
     IWordFilter wordFilter,
     ISizeScheme sizeScheme,
     IWordProcessor wordProcessor)
 {
     this.layouter            = layouter;
     this.visualizer          = visualizer;
     this.fileReader          = fileReader;
     this.imageSaver          = imageSaver;
     this.statisticsCollector = statisticsCollector;
     this.wordFilter          = wordFilter;
     this.sizeScheme          = sizeScheme;
     this.wordProcessor       = wordProcessor;
 }
コード例 #27
0
ファイル: WallrApplication.cs プロジェクト: TomPeters/wallr
 public WallrApplication(ISetup setup, ILogger logger,
                         IEnumerable <IQuickUseOption> quickUseOptions,
                         IObservableImageQueue imageQueue, IImageRepository imageRepository,
                         IImageSourceConfigurations imageSourceConfigurations,
                         IImageSaver saver, IImageSources imageSources,
                         IWallpaperUpdater wallpaperUpdater,
                         TestingSources testingSources)
 {
     _setup                     = setup;
     _logger                    = logger;
     _quickUseOptions           = quickUseOptions;
     _imageQueue                = imageQueue;
     _imageRepository           = imageRepository;
     _imageSourceConfigurations = imageSourceConfigurations;
     _saver                     = saver;
     _imageSources              = imageSources;
     _wallpaperUpdater          = wallpaperUpdater;
     _testingSources            = testingSources;
 }
コード例 #28
0
        public ChatTests()
        {
            var mockClientProxy = new Mock <IClientProxy>();
            var mockClients     = new Mock <IHubClients>();

            mockClients.Setup(clients => clients.All).Returns(mockClientProxy.Object);
            var dialogHubMock = new Mock <IHubContext <DialogHub> >();

            dialogHubMock.Setup(x => x.Clients).Returns(() => mockClients.Object);


            var provider = new ServiceCollection()
                           .AddSingleton <IRepositoryWrapper, RepositoryWrapper>()
                           .AddSingleton <IImageSaver, ImageSaver>()
                           .AddSingleton <IDialogNotifier, DialogNotifier>()
                           .BuildServiceProvider();

            _imageSaver = provider.GetService <ImageSaver>();
        }
コード例 #29
0
 public ImageService(IImageSaver saver, IFileChecker checker)
 {
     this._saver   = saver;
     this._checker = checker;
 }
コード例 #30
0
 public PhotoService(IRepositoryWrapper repository, IImageSaver
                     imageSaver)
 {
     _repository = repository;
     _imageSaver = imageSaver;
 }
コード例 #31
0
 public static void SaveImage(this Bitmap bitmap, IImageSaver saver, string filename)
 {
     saver.SaveImage(bitmap, filename);
 }
コード例 #32
0
 public EventPostController(IImageSaver imageSaver, IMediator mediator)
 {
     _imageSaver = imageSaver;
     _mediator   = mediator;
 }