public CollectionService(
     ISqlService sqlService,
     ISqlService bgSqlService,
     IAppSettingsHelper appSettingsHelper,
     IDispatcherHelper dispatcher,
     IBitmapFactory bitmapFactory,
     IBitmapImage missingArtwork,
     string localFilePrefix,
     string artworkFilePath,
     string artistArtworkFilePath)
 {
     _bgSqlService          = bgSqlService;
     _sqlService            = sqlService;
     _dispatcher            = dispatcher;
     _appSettingsHelper     = appSettingsHelper;
     _bitmapFactory         = bitmapFactory;
     _missingArtwork        = missingArtwork;
     _localFilePrefix       = localFilePrefix;
     _artworkFilePath       = artworkFilePath;
     _artistArtworkFilePath = artistArtworkFilePath;
     Songs                = new OptimizedObservableCollection <Song>();
     Artists              = new OptimizedObservableCollection <Artist>();
     Albums               = new OptimizedObservableCollection <Album>();
     Playlists            = new OptimizedObservableCollection <Playlist>();
     PlaybackQueue        = new OptimizedObservableCollection <QueueSong>();
     ShufflePlaybackQueue = new OptimizedObservableCollection <QueueSong>();
 }
        /// <summary>Constructs the <see cref="ImagesServiceBase"/>.</summary>
        public ImagesServiceBase(IBitmapFactory bitmapFactory,
                                 IUIService ui)
        {
            BitmapFactory = bitmapFactory;
            UI            = ui;

            UI.Invoke(() => {
                // Load file type icons with a different method
                FileCollection = LoadFileIcon(nameof(FileCollection));
                FreeSpace      = LoadFileIcon(nameof(FreeSpace));
                UnknownSpace   = LoadFileIcon(nameof(UnknownSpace));
                Missing        = LoadFileIcon(nameof(Missing));

                // Load all unassigned icons with reflection
                foreach (PropertyInfo propInfo in typeof(ImagesServiceBase).GetProperties())
                {
                    if (propInfo.PropertyType == typeof(IImage) && propInfo.CanWrite)
                    {
                        IImage value = (IImage)propInfo.GetValue(this);
                        if (value != null)
                        {
                            continue;
                        }
                        value = LoadIcon(propInfo.Name);
                        propInfo.SetValue(this, value);
                    }
                }
            });
        }
Exemple #3
0
        public TrackRenderer(ITrackParameters parameters, IBitmapFactory bitmapFactory, ITrackPathBuilder trackPathBuilder)
        {
            _parameters    = parameters;
            _bitmapFactory = bitmapFactory;

            _cornerTrackPath       = trackPathBuilder.BuildCornerTrackPath();
            _cornerPlankPath       = trackPathBuilder.BuildCornerPlankPath();
            _cornerSinglePlankPath = trackPathBuilder.BuildCornerPlankPath(1);
            _horizontalTrackPath   = trackPathBuilder.BuildHorizontalTrackPath();
            _horizontalPlankPath   = trackPathBuilder.BuildHorizontalPlankPath();

            _plankPaint = new PaintBrush
            {
                Color       = Colors.Black,
                Style       = PaintStyle.Stroke,
                StrokeWidth = _parameters.PlankWidth,
                IsAntialias = true
            };
            _trackClear = new PaintBrush
            {
                Color       = Colors.White,
                Style       = PaintStyle.Stroke,
                StrokeWidth = _parameters.RailTopWidth,
                IsAntialias = true
            };
            _trackEdge = new PaintBrush
            {
                Color       = Colors.Black,
                Style       = PaintStyle.Stroke,
                StrokeWidth = _parameters.RailWidth,
                IsAntialias = true
            };
        }
 public CollectionService(
     ISqlService sqlService,
     ISqlService bgSqlService,
     IAppSettingsHelper appSettingsHelper,
     IDispatcherHelper dispatcher,
     IBitmapFactory bitmapFactory,
     IBitmapImage missingArtwork,
     string localFilePrefix,
     string artworkFilePath,
     string artistArtworkFilePath)
 {
     _bgSqlService = bgSqlService;
     _sqlService = sqlService;
     _dispatcher = dispatcher;
     _appSettingsHelper = appSettingsHelper;
     _bitmapFactory = bitmapFactory;
     _missingArtwork = missingArtwork;
     _localFilePrefix = localFilePrefix;
     _artworkFilePath = artworkFilePath;
     _artistArtworkFilePath = artistArtworkFilePath;
     Songs = new OptimizedObservableCollection<Song>();
     Artists = new OptimizedObservableCollection<Artist>();
     Albums = new OptimizedObservableCollection<Album>();
     Playlists = new OptimizedObservableCollection<Playlist>();
     PlaybackQueue = new OptimizedObservableCollection<QueueSong>();
     ShufflePlaybackQueue = new OptimizedObservableCollection<QueueSong>();
 }
Exemple #5
0
 public BitmapDataSource(IImagePointerDataSource dataSource, IBitmapFactory imageFactory)
     : base(dataSource)
 {
     this.CurrentValue = new Bitmap(dataSource.Width, dataSource.Height, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
     this.size         = new IntSize(this.CurrentValue.Width, this.CurrentValue.Height);
     this.imageFactory = imageFactory;
 }
Exemple #6
0
 /// <summary>Constructs the <see cref="SettingsService"/>.</summary>
 public SettingsServiceBase(IUIService ui,
                            IBitmapFactory bitmapFactory,
                            TreemapRenderer2Factory treemapFactory)
 {
     this.ui            = ui;
     this.bitmapFactory = bitmapFactory;
     treemap            = treemapFactory.Create();
     Reset();
 }
Exemple #7
0
 public Game(IGameBoard gameBoard, OrderedList <ILayerRenderer> boardRenderers, IPixelMapper pixelMapper, IBitmapFactory bitmapFactory)
 {
     _gameBoard                    = gameBoard;
     _boardRenderers               = boardRenderers;
     _pixelMapper                  = pixelMapper;
     _bitmapFactory                = bitmapFactory;
     _renderLayerDrawTimes         = _boardRenderers.ToDictionary(x => x, x => InstrumentationBag.Add <ElapsedMillisecondsTimedStat>(x.Name.Replace(" ", "") + "DrawTime"));
     _pixelMapper.ViewPortChanged += (s, e) => _needsBufferReset = true;
 }
        public Label()
        {
            _text = "AAAABBBBBCCCCCC";

            _bitmapFactory = new BitmapFactory();
            _charFactory = new CharFactory();
            _styleFactory = new StyleFactory();

            Update();
        }
Exemple #9
0
        public Label()
        {
            _text = "AAAABBBBBCCCCCC";

            _bitmapFactory = new BitmapFactory();
            _charFactory   = new CharFactory();
            _styleFactory  = new StyleFactory();

            Update();
        }
Exemple #10
0
 public DatabaseHelper(
     IDispatcherHelper dispatcher,
     IAppSettingsHelper appSettingsHelper,
     IBitmapFactory bitmapFactory)
 {
     _dispatcher        = dispatcher;
     _appSettingsHelper = appSettingsHelper;
     _bitmapFactory     = bitmapFactory;
     folderPath         = Windows.Storage.ApplicationData.Current.LocalFolder.Path;
 }
Exemple #11
0
        /// <summary>Constructs the <see cref="IconCacheService"/>.</summary>
        public WindowsIconCacheService(IUIService ui,
                                       IBitmapFactory bitmapFactory)
        {
            this.ui            = ui;
            this.bitmapFactory = bitmapFactory;

            cachedIcons          = new Dictionary <int, IBitmap>();
            cachedSpecialFolders = new Dictionary <Environment.SpecialFolder, IIconAndName>();
            cachedFileTypes      = new Dictionary <string, IIconAndName>();
            cachedIconList       = new ObservableCollection <IBitmap>();
        }
        /// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        public MainViewModel(SettingsService settings,
                             ScanningService scanning,
                             IIconCacheService iconCache,
                             IUIService ui,
                             IBitmapFactory bitmapFactory,
                             ImagesServiceBase images,
                             IClipboardService clipboard,
                             IOSService os,
                             IWindowDialogService dialogs,
                             TreemapRendererFactory treemapFactory,
                             IShortcutsService shortcuts,
                             RelayCommandService relayFactory)
        {
            Settings      = settings;
            Scanning      = scanning;
            IconCache     = iconCache;
            UI            = ui;
            BitmapFactory = bitmapFactory;
            Images        = images;
            Clipboard     = clipboard;
            OS            = os;
            Dialogs       = dialogs;
            Shortcuts     = shortcuts;
            Treemap       = treemapFactory.Create();

            Settings.PropertyChanged += OnSettingsPropertyChanged;
            Scanning.PropertyChanged += OnScanningPropertyChanged;

            Extensions = new ExtensionItemViewModelCollection(this);

            SelectedFiles = new ObservableCollection <FileItemViewModel>();
            SelectedFiles.CollectionChanged += OnSelectedFilesChanged;

            FileComparer      = new FileComparer();
            ExtensionComparer = new ExtensionComparer();
            UpdateEmptyRecycleBin();

            GCRAMUsage = GC.GetTotalMemory(false);
            if (IsInDesignMode)
            {
                // Code runs in Blend --> create design time data.
            }
            else
            {
                // Code runs "for real"
                ramTimer    = UI.StartTimer(Settings.RAMInterval, true, OnRAMUsageTick);
                statusTimer = UI.CreateTimer(Settings.StatusInterval, true, OnStatusTick);
            }
        }
        public AudioticaFactory(
            IDispatcherHelper dispatcher, 
            IAppSettingsHelper appSettingsHelper, 
            IBitmapFactory bitmapFactory)
        {
            this.dispatcher = dispatcher;
            this.appSettingsHelper = appSettingsHelper;
            this.bitmapFactory = bitmapFactory;

#if __ANDROID__
            folderPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
#elif WINRT
            this.folderPath = Windows.Storage.ApplicationData.Current.LocalFolder.Path;
#endif
        }
        public AudioticaFactory(
            IDispatcherHelper dispatcher,
            IAppSettingsHelper appSettingsHelper,
            IBitmapFactory bitmapFactory)
        {
            this.dispatcher        = dispatcher;
            this.appSettingsHelper = appSettingsHelper;
            this.bitmapFactory     = bitmapFactory;

#if __ANDROID__
            folderPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
#elif WINRT
            this.folderPath = Windows.Storage.ApplicationData.Current.LocalFolder.Path;
#endif
        }
Exemple #15
0
 public TreeRenderer(IBitmapFactory bitmapFactory, ITrackParameters trackParameters)
 {
     _cellSize      = trackParameters.CellSize;
     _centerOffset  = _cellSize / 2.0f;
     _baseRadius    = _cellSize / 4.0f;
     _minTreeSize   = _baseRadius;
     _maxTreeSize   = _baseRadius * 1.25f;
     _baseTreeBrush = new PaintBrush
     {
         Color = new Color("#1B633A"),
         Style = PaintStyle.Fill
     };
     _topTreeBrush = new PaintBrush
     {
         Color       = new Color("#236A42"),
         Style       = PaintStyle.Fill,
         IsAntialias = true
     };
     _bitmapFactory = bitmapFactory;
 }
Exemple #16
0
        public IBitmapImage Encode(string contents, int width, int height,
                                   string background = "#FFFBFEFF", string foreground = "#FF2D6178")
        {
            Color         backgroundColor = FromHex(background);
            Color         foregroundColor = FromHex(foreground);
            BarcodeWriter writer          = new BarcodeWriter()
            {
                Renderer = new ZXing.Rendering.BitmapRenderer()
                {
                    Background = backgroundColor,
                    Foreground = foregroundColor
                }
            };

            writer.Format  = BarcodeFormat.QR_CODE;
            writer.Options = new EncodingOptions {
                Margin = 0, Width = width, Height = height, PureBarcode = true
            };
            Bitmap         bmp  = writer.Write(contents);
            IBitmapFactory fact = Pici.Services.Get <IBitmapFactory>();

            return(fact.FromBitmap(bmp));
        }
Exemple #17
0
        /// <summary>
        /// Create a new OffScreen Chromium Browser
        /// </summary>
        /// <param name="address">Initial address (url) to load</param>
        /// <param name="browserSettings">The browser settings to use. If null, the default settings are used.</param>
        /// <param name="requestcontext">See <see cref="RequestContext"/> for more details. Defaults to null</param>
        /// <param name="automaticallyCreateBrowser">automatically create the underlying Browser</param>
        public ChromiumWebBrowser(string address = "", BrowserSettings browserSettings = null,
                                  RequestContext requestcontext = null, bool automaticallyCreateBrowser = true)
        {
            if (!Cef.IsInitialized && !Cef.Initialize())
            {
                throw new InvalidOperationException("Cef::Initialize() failed");
            }

            BitmapFactory = new BitmapFactory(BitmapLock);

            ResourceHandlerFactory = new DefaultResourceHandlerFactory();
            BrowserSettings        = browserSettings ?? new BrowserSettings();
            RequestContext         = requestcontext;

            Cef.AddDisposable(this);
            Address = address;

            managedCefBrowserAdapter = new ManagedCefBrowserAdapter(this, true);

            if (automaticallyCreateBrowser)
            {
                CreateBrowser(IntPtr.Zero);
            }
        }
 public DesignCollectionService(IBitmapFactory bitmapFactory)
 {
     _bitmapFactory = bitmapFactory;
     LoadLibrary();
 }
 public void Display(Point point, IStyle style, IBitmapFactory factory)
 {
     DrawBitmap(factory.GetImage(Char, style), point);
 }
 /// <summary>Constructs the <see cref="ResourceImagesService"/>.</summary>
 public ResourceImagesService(IBitmapFactory bitmapFactory,
                              IUIService ui)
     : base(bitmapFactory,
            ui)
 {
 }
 public ImageService(IMemoryCache memoryCache, IHttpClientFactoryWrapper httpClientFactory, IBitmapFactory bitmapFactory)
 {
     this.memoryCache   = memoryCache;
     this.httpClient    = httpClientFactory.CreateClient();
     this.bitmapFactory = bitmapFactory;
 }
Exemple #22
0
 public TestableImageSource(IImagePointerDataSource dataSource, IBitmapFactory imageFactory)
     : base(dataSource, imageFactory)
 { }
Exemple #23
0
 public void Display(Point point, IStyle style, IBitmapFactory factory)
 {
     DrawBitmap(factory.GetImage(Char, style), point);
 }
Exemple #24
0
 public TestableImageSource(IImagePointerDataSource dataSource, IBitmapFactory imageFactory)
     : base(dataSource, imageFactory)
 {
 }
 public DesignCollectionService(IBitmapFactory bitmapFactory)
 {
     _bitmapFactory = bitmapFactory;
     LoadLibrary();
 }