Exemplo n.º 1
0
 public void PopulatePalette(IColorGenerator colorGenerator)
 {
     for (var i = 0; i < _palette.Length; i++)
     {
         _palette[i] = colorGenerator.getNextColor();
     }
 }
Exemplo n.º 2
0
        private Border GetSubjectNameLabel(string subjectName, IColorGenerator c, bool truncate = true)
        {
            var textblock = new TextBlock {
                Text              = subjectName,
                Margin            = new Thickness(2),
                TextAlignment     = TextAlignment.Center,
                FontWeight        = FontWeights.DemiBold,
                VerticalAlignment = VerticalAlignment.Center
            };

            if (truncate)
            {
                textblock.Text = subjectName.TruncateRight(30);
            }
            var border = new Border {
                BorderThickness = new Thickness(1),
                BorderBrush     = Brushes.Black,
                Child           = textblock,
                Background      = c.GetCurrentBrush(),
                ToolTip         = subjectName
            };
            var originalColor = c.GetCurrentColor();
            var originalBrush = c.GetCurrentBrush();

            border.MouseEnter += (sender, args) => {
                border.Background = new SolidColorBrush(originalColor.Darker());
            };
            border.MouseLeave += (sender, args) => {
                border.Background = originalBrush;
            };

            return(border);
        }
Exemplo n.º 3
0
        private Border GenerateBox(Slot s, IColorGenerator c)
        {
            var textblock = new TextBlock
            {
                Margin            = new Thickness(2),
                TextAlignment     = TextAlignment.Center,
                FontWeight        = FontWeights.DemiBold,
                VerticalAlignment = VerticalAlignment.Center
            };

            textblock.Text = GetInfo(s);
            var border = new Border
            {
                BorderThickness = new Thickness(0.75),
                BorderBrush     = Brushes.Black,
                Child           = textblock,
                Background      = c.GetCurrentBrush(),
                CornerRadius    = new CornerRadius(2),
                Height          = 50,
                ForceCursor     = true,
                ToolTip         = GetTooltip(s) // s.SubjectName ,
            };
            var originalColor = c.GetCurrentColor();
            var originalBrush = c.GetCurrentBrush();

            border.MouseEnter += (sender, args) => { border.Background = new SolidColorBrush(originalColor.Darker()); };
            border.MouseLeave += (sender, args) => { border.Background = originalBrush; };
            return(border);
        }
Exemplo n.º 4
0
 public EditTimeProfileAnalysisChartPresenter(
     IEditTimeProfileAnalysisChartView view,
     ITimeProfileChartPresenter timeProfileChartPresenter,
     ITimeProfileChartDataCreator timeProfileChartDataCreator,
     IPopulationSimulationAnalysisStarter populationSimulationAnalysisStarter,
     IPopulationAnalysisTask populationAnalysisTask,
     IColorGenerator colorGenerator,
     IObservedDataTask observedDataTask,
     IPopulationPKAnalysisPresenter pkAnalysisPresenter,
     IDimensionRepository dimensionRepository,
     IPresentationSettingsTask presentationSettingsTask)
     : base(view, timeProfileChartPresenter, timeProfileChartDataCreator, populationSimulationAnalysisStarter, populationAnalysisTask, ApplicationIcons.TimeProfileAnalysis)
 {
     _colorGenerator                     = colorGenerator;
     _observedDataTask                   = observedDataTask;
     _pkAnalysisPresenter                = pkAnalysisPresenter;
     _dimensionRepository                = dimensionRepository;
     _presentationSettingsTask           = presentationSettingsTask;
     _timeProfileAnalysisChartView       = view;
     timeProfileChartPresenter.DragDrop += OnDragDrop;
     timeProfileChartPresenter.DragOver += OnDragOver;
     timeProfileChartPresenter.ObservedDataSettingsChanged += RefreshData;
     _chartDisplayMode           = ChartDisplayMode.Chart;
     _observedDataDragDropBinder = new ObservedDataDragDropBinder();
     _timeProfileAnalysisChartView.SetChartView(_populationAnalysisChartPresenter.BaseView);
     _timeProfileAnalysisChartView.SetPKAnalysisView(_pkAnalysisPresenter.BaseView);
 }
        public StatisticsViewModel(IColorGenerator generator)
        {
            Ensure.NotNull(generator, "generator");
            this.generator = generator;

            Applications = new ObservableCollection<StatisticsItemViewModel>();
            Files = new ObservableCollection<StatisticsItemViewModel>();
        }
Exemplo n.º 6
0
        public StatisticsViewModel(IColorGenerator generator)
        {
            Ensure.NotNull(generator, "generator");
            this.generator = generator;

            Applications = new ObservableCollection <StatisticsItemViewModel>();
            Files        = new ObservableCollection <StatisticsItemViewModel>();
        }
Exemplo n.º 7
0
 public WordsForCloudGenerator(string fontName, int maxFontSize, ITagCloudLayouter tagCloudLayouter,
                               IColorGenerator colorGenerator)
 {
     this.tagCloudLayouter = tagCloudLayouter;
     this.fontName         = fontName;
     this.maxFontSize      = maxFontSize;
     this.colorGenerator   = colorGenerator;
 }
Exemplo n.º 8
0
 private GameEngine(IColorGenerator colorGenerator, IShapesGenerator generator)
 {
     this.ShapesGenerator = generator;
     this.random          = new Random();
     this.colorGenerator  = colorGenerator;
     this.players         = new Dictionary <string, Player>();
     generator.GenerateShapes();
 }
 public PopulationAnalysisFieldFactory(IEntityPathResolver entityPathResolver, IFullPathDisplayResolver fullPathDisplayResolver,
                                       IGenderRepository genderRepository, IColorGenerator colorGenerator, IPKParameterRepository pkParameterRepository)
 {
     _entityPathResolver      = entityPathResolver;
     _fullPathDisplayResolver = fullPathDisplayResolver;
     _genderRepository        = genderRepository;
     _colorGenerator          = colorGenerator;
     _pkParameterRepository   = pkParameterRepository;
 }
Exemplo n.º 10
0
        public static void SeedDatabase(BudgetDbContext context, IColorGenerator colorGenerator)
        {
            context.Database.EnsureCreated();
            if (!context.Categories.Any())
            {
                context.Categories.AddRange(GetCategoriesToSeed(colorGenerator));

                context.SaveChanges();
            }
        }
Exemplo n.º 11
0
        protected override void Context()
        {
            _view            = A.Fake <IValueMappingGroupingView>();
            _colorGenerator  = A.Fake <IColorGenerator>();
            _symbolGenerator = A.Fake <ISymbolGenerator>();
            sut = new ValueMappingGroupingPresenter(_view, _colorGenerator, _symbolGenerator);
            _populationDataCollector = A.Fake <IPopulationDataCollector>();

            _covariateField = A.Fake <PopulationAnalysisCovariateField>();
            A.CallTo(() => _covariateField.GetValues(_populationDataCollector)).Returns(new[] { "Male", "Male", "Female", "Female" });

            A.CallTo(() => _view.BindTo(A <IEnumerable <GroupingLabelDTO> > ._))
            .Invokes(x => _allLabels = x.GetArgument <IEnumerable <GroupingLabelDTO> >(0).ToList());
        }
Exemplo n.º 12
0
 private Label GetLabel(IColorGenerator c, string content = "")
 {
     return(new Label {
         Content = content,
         FontWeight = FontWeights.Bold,
         VerticalContentAlignment = VerticalAlignment.Center,
         HorizontalContentAlignment = HorizontalAlignment.Center,
         FontFamily = new FontFamily("Consolas"),
         FontSize = 13.5,
         BorderBrush = Brushes.Black,
         BorderThickness = new Thickness(1),
         Background = c.GetCurrentBrush()
     });
 }
        protected override void Context()
        {
            _view = A.Fake <IEditTimeProfileAnalysisChartView>();
            _timeProfilerChartPresenter          = A.Fake <ITimeProfileChartPresenter>();
            _timeProfileChartDataCreator         = A.Fake <ITimeProfileChartDataCreator>();
            _populationSimulationAnalysisStarter = A.Fake <IPopulationSimulationAnalysisStarter>();
            _populationAnalysisTask = A.Fake <IPopulationAnalysisTask>();
            _colorGenerator         = A.Fake <IColorGenerator>();
            _observedDataTask       = A.Fake <IObservedDataTask>();
            _pkAnalysisPresenter    = A.Fake <IPopulationPKAnalysisPresenter>();
            _dimensionRepository    = A.Fake <IDimensionRepository>();

            _presenterSettingsTask = A.Fake <IPresentationSettingsTask>();
            sut = new EditTimeProfileAnalysisChartPresenter(_view, _timeProfilerChartPresenter, _timeProfileChartDataCreator,
                                                            _populationSimulationAnalysisStarter, _populationAnalysisTask, _colorGenerator, _observedDataTask, _pkAnalysisPresenter, _dimensionRepository, _presenterSettingsTask);

            _timeProfileAnalysisChart      = new TimeProfileAnalysisChart();
            _populationStatisticalAnalysis = new PopulationStatisticalAnalysis();
            _timeProfileAnalysisChart.PopulationAnalysis = _populationStatisticalAnalysis;
            _populationDataCollector = A.Fake <IPopulationDataCollector>();
            sut.InitializeAnalysis(_timeProfileAnalysisChart, _populationDataCollector);

            _observedDataRepository = DomainHelperForSpecs.ObservedData();
            var data = new DragDropInfo(
                new List <ITreeNode> {
                new ObservedDataNode(new ClassifiableObservedData {
                    Subject = _observedDataRepository
                })
            }
                );

            _dragEventArgs = new DragEventArgs(new DataObject(data), 0, 0, 0, DragDropEffects.All, DragDropEffects.All);

            _chartData = new ChartData <TimeProfileXValue, TimeProfileYValue>(null, null);
            var concentrationDimension = DomainHelperForSpecs.ConcentrationDimensionForSpecs();
            var yAxis = new AxisData(concentrationDimension, concentrationDimension.DefaultUnit, Scalings.Linear);

            _paneData = new PaneData <TimeProfileXValue, TimeProfileYValue>(yAxis);
            _chartData.AddPane(_paneData);
            A.CallTo(_timeProfileChartDataCreator).WithReturnType <ChartData <TimeProfileXValue, TimeProfileYValue> >().Returns(_chartData);

            var outputField = new PopulationAnalysisOutputField {
                Dimension = DomainHelperForSpecs.MassConcentrationDimensionForSpecs()
            };

            _populationStatisticalAnalysis.Add(outputField);

            A.CallTo(() => _dimensionRepository.MergedDimensionFor(A <NumericFieldContext> ._)).Returns(concentrationDimension);
        }
 protected override void Context()
 {
     _entityPathResolver      = A.Fake <IEntityPathResolver>();
     _fullPathDisplayResolver = A.Fake <IFullPathDisplayResolver>();
     _parameter        = A.Fake <IParameter>();
     _genderRepository = A.Fake <IGenderRepository>();
     _male             = new Gender {
         DisplayName = "Male"
     };
     _female = new Gender {
         DisplayName = "Female"
     };
     A.CallTo(() => _genderRepository.Male).Returns(_male);
     A.CallTo(() => _genderRepository.Female).Returns(_female);
     _colorGenerator        = A.Fake <IColorGenerator>();
     _pkParameterRepository = A.Fake <IPKParameterRepository>();
     sut = new PopulationAnalysisFieldFactory(_entityPathResolver, _fullPathDisplayResolver, _genderRepository, _colorGenerator, _pkParameterRepository);
 }
Exemplo n.º 15
0
 public AccountController(
     UserManager <User> userManager,
     SignInManager <User> signInManager,
     IIdentityServerInteractionService interaction,
     IClientStore clientStore,
     IEventService events,
     INameGeneratorService nameGenerator,
     IColorGenerator colorGenerator,
     IPasswordGeneratorService passwordGenerator)
 {
     _userManager       = userManager;
     _signInManager     = signInManager;
     _interaction       = interaction;
     _clientStore       = clientStore;
     _events            = events;
     _nameGenerator     = nameGenerator;
     _colorGenerator    = colorGenerator;
     _passwordGenerator = passwordGenerator;
 }
Exemplo n.º 16
0
        public static Bitmap Generate(DataContainer data, IColorGenerator generator)
        {
            if (data == null)
            {
                throw new ArgumentNullException("data");
            }

            if (generator == null)
            {
                throw new ArgumentNullException("generator");
            }

            var bitmap = new Bitmap(data.Width, data.Height, PixelFormat.Format24bppRgb);

            var lockedData = bitmap.LockBits(new Rectangle(0, 0, bitmap.Width, bitmap.Height),
                                             ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);

            var managedBytes = new byte[Math.Abs(lockedData.Stride) * lockedData.Height];

            // Copy locked data into managed array.
            Marshal.Copy(lockedData.Scan0, managedBytes, 0, managedBytes.Length);

            var dataIndex = 0;

            for (var i = 0; i < managedBytes.Length; i += 3)
            {
                var color = generator.Generate(data[dataIndex]);

                managedBytes[i + 0] = color.Red;
                managedBytes[i + 1] = color.Green;
                managedBytes[i + 2] = color.Blue;

                dataIndex += 1;
            }

            // Copy managed array back into locked data.
            Marshal.Copy(managedBytes, 0, lockedData.Scan0, managedBytes.Length);

            bitmap.UnlockBits(lockedData);

            return(bitmap);
        }
        protected override void Context()
        {
            _view = A.Fake <IFixedLimitsGroupingView>();
            _populationDataCollector = A.Fake <IPopulationDataCollector>();
            _field           = A.Fake <PopulationAnalysisParameterField>();
            _colorGenerator  = A.Fake <IColorGenerator>();
            _symbolGenerator = A.Fake <ISymbolGenerator>();
            sut = new FixedLimitsGroupingPresenter(_view, _colorGenerator, _symbolGenerator);

            //standard action for all tests
            _dimension         = A.Fake <IDimension>();
            _unit              = A.Fake <Unit>();
            _field.Dimension   = _dimension;
            _field.DisplayUnit = _unit;
            A.CallTo(() => _view.BindTo(A <IEnumerable <FixedLimitGroupingDTO> > ._, A <Unit> ._))
            .Invokes(x => _allDTOs = x.GetArgument <NotifyList <FixedLimitGroupingDTO> >(0).DowncastTo <IEnumerable <FixedLimitGroupingDTO> >());

            A.CallTo(() => _field.CanBeUsedForGroupingIn(_populationDataCollector)).Returns(true);
            A.CallTo(() => _field.GetValues(_populationDataCollector)).Returns(_values);
        }
Exemplo n.º 18
0
 public AvatarGenerator(IColorGenerator colorGenerator)
 {
     _colorGenerator = colorGenerator;
     ImageFormat = ImageFormat.Jpeg;
 }
 public ValueMappingGroupingPresenter(IValueMappingGroupingView view, IColorGenerator colorGenerator, ISymbolGenerator symbolGenerator) : base(view)
 {
     _colorGenerator  = colorGenerator;
     _symbolGenerator = symbolGenerator;
     _mapping         = new NotifyList <GroupingLabelDTO>();
 }
Exemplo n.º 20
0
 public FixedLimitsGroupingPresenter(IFixedLimitsGroupingView view, IColorGenerator colorGenerator, ISymbolGenerator symbolGenerator) : base(view)
 {
     _colorGenerator  = colorGenerator;
     _symbolGenerator = symbolGenerator;
     _fixedLimitDTOs  = new NotifyList <FixedLimitGroupingDTO>();
 }
Exemplo n.º 21
0
 public void fadeTogether()
 {
     this.manualMode     = false;
     this.colorGenerator = new FadeGenerator(true, TimeSpan.FromSeconds(30), numLeds);
 }
Exemplo n.º 22
0
 public AvatarGenerator(IColorGenerator colorGenerator)
 {
     _colorGenerator = colorGenerator;
     ImageFormat     = ImageFormat.Jpeg;
 }
Exemplo n.º 23
0
 public IWordsForCloudGenerator Get(string fontName, int maxFontSize, ITagCloudLayouter tagCloudLayouter,
                                    IColorGenerator colorGenerator)
 {
     return(new WordsForCloudGenerator(fontName, maxFontSize, tagCloudLayouter, colorGenerator));
 }
Exemplo n.º 24
0
 public void turnOffLED()
 {
     this.manualMode     = false;
     this.colorGenerator = new TurnOffLED(true, TimeSpan.FromSeconds(1), numLeds);
 }
Exemplo n.º 25
0
        private static IEnumerable <Category> GetCategoriesToSeed(IColorGenerator colorGenerator)
        {
            var categories = new List <Category>
            {
                new Category
                {
                    Name            = "Salary",
                    TransactionType = TransactionType.Income,
                    IsPrimary       = true,
                    RgbColorValue   = colorGenerator.GetColor()
                },
                new Category
                {
                    Name            = "Deposit",
                    TransactionType = TransactionType.Income,
                    IsPrimary       = true,
                    RgbColorValue   = colorGenerator.GetColor()
                },
                new Category
                {
                    Name            = "Savings",
                    TransactionType = TransactionType.Income,
                    IsPrimary       = true,
                    RgbColorValue   = colorGenerator.GetColor()
                },
                new Category
                {
                    Name            = "Bills",
                    TransactionType = TransactionType.Expense,
                    IsPrimary       = true,
                    RgbColorValue   = colorGenerator.GetColor()
                },
                new Category
                {
                    Name            = "Car",
                    TransactionType = TransactionType.Expense,
                    IsPrimary       = true,
                    RgbColorValue   = colorGenerator.GetColor()
                },
                new Category
                {
                    Name            = "Transport",
                    TransactionType = TransactionType.Expense,
                    IsPrimary       = true,
                    RgbColorValue   = colorGenerator.GetColor()
                },
                new Category
                {
                    Name            = "Education",
                    TransactionType = TransactionType.Expense,
                    IsPrimary       = true,
                    RgbColorValue   = colorGenerator.GetColor()
                },
                new Category
                {
                    Name            = "Sports",
                    TransactionType = TransactionType.Expense,
                    IsPrimary       = true,
                    RgbColorValue   = colorGenerator.GetColor()
                },
                new Category
                {
                    Name            = "Food",
                    TransactionType = TransactionType.Expense,
                    IsPrimary       = true,
                    RgbColorValue   = colorGenerator.GetColor()
                },
                new Category
                {
                    Name            = "Home",
                    TransactionType = TransactionType.Expense,
                    IsPrimary       = true,
                    RgbColorValue   = colorGenerator.GetColor()
                },
                new Category
                {
                    Name            = "Eating out",
                    TransactionType = TransactionType.Expense,
                    IsPrimary       = true,
                    RgbColorValue   = colorGenerator.GetColor()
                },
                new Category
                {
                    Name            = "Personal",
                    TransactionType = TransactionType.Expense,
                    IsPrimary       = true,
                    RgbColorValue   = colorGenerator.GetColor()
                },
                new Category
                {
                    Name            = "Health",
                    TransactionType = TransactionType.Expense,
                    IsPrimary       = true,
                    RgbColorValue   = colorGenerator.GetColor()
                }
            };

            return(categories);
        }
Exemplo n.º 26
0
 public void alertPulseLED()
 {
     this.manualMode     = false;
     this.colorGenerator = new AlertPulseGenerator(true, TimeSpan.FromSeconds(2), numLeds);
 }
Exemplo n.º 27
0
 public StaticShapesGenerator(IColorGenerator colorGenerator)
 {
     this.colorGenerator = colorGenerator;
     this.random         = new Random();
     this.staticShapes   = new Dictionary <int, StaticShape>();
 }