Inheritance: ObservableObject
Ejemplo n.º 1
0
        private SelectServiceButton CreateSelectServiceButton(string code, string name, string color, float fontSize, EventHandler onSelected)
        {
            var model = new ServiceButtonViewModel()
            {
                Code = code,
                Name = name,
                FontSize = fontSize == 0 ? 1 : fontSize,
                ServiceBrush = color.GetBrushForColor()
            };
            model.OnServiceSelected += onSelected;

            var result = new SelectServiceButton();
            result.DataContext = model;
            return result;
        }
        private SelectServiceButton CreateServiceButton(Service service, EventHandler onSelected)
        {
            var model = new ServiceButtonViewModel()
            {
                Code = service.Code,
                Name = service.Name,
                FontSize = service.FontSize == 0 ? 1 : service.FontSize,
                ServiceBrush = service.GetColor().GetBrushForColor()
            };
            model.OnServiceSelected += onSelected;

            return new SelectServiceButton()
            {
                DataContext = model
            };
        }