private void InitialData() { var cmd = new ColorService(); DataSouce = cmd.GetALL(); gridColor.DataSource = DataSouce; gridColor.DataBind(); }
public WledDiscovery(ColorService cs) : base(cs) { var controlService = cs.ControlService; _mDns = controlService.MulticastService; _sd = controlService.ServiceDiscovery; _ids = new List <string>(); }
public void set_optional_property_for_a_child_object() { var theService = new ColorService("red"); instance.SetterDependency(x => x.Service).Is(theService); TheTarget.Service.ShouldBeTheSameAs(theService); }
public static void ChangeColors() { ColorService service = new ColorService(); service.DeleteColors(); service.InsertRandomColors(); }
public void ReadColorById_NegativeId_ThrowsNullReferenceException() { Mock <IColorRepository> colorRepository = new Mock <IColorRepository>(); ColorService colorService = new ColorService(colorRepository.Object); Action actual = () => colorService.ReadById(-1); Assert.Throws <InvalidDataException>(actual); }
public void DeleteColor_NonExistingId_ThrowsNullReferenceException() { Mock <IColorRepository> colorRepository = new Mock <IColorRepository>(); ColorService colorService = new ColorService(colorRepository.Object); Action actual = () => colorService.Delete(1); Assert.Throws <NullReferenceException>(actual); }
public ActionResult OnDelete(int id) { var result = ColorService.Delete(id); SetFlashMessage(result == Result.Ok ? "Xóa mà u sắc sản phẩm thà nh công." : "Mà u sắc sản phẩm không tồn tại trên hệ thống."); return(RedirectToAction("Index")); }
public RegularExpressionTransfromTesterWindow() { InitializeComponent(); ViewModel = new RegularExpressionHideTesterViewModel(this); Model = new Value(); fctbDocument.CurrentLineColor = Color.Red; ColorService.Setup(this); }
public async Task <int> AddColor(string colorName) { IColorService manager = new ColorService(); return(await manager.AddAsync(new Color() { ColorName = colorName })); }
public OpenRgbDevice(OpenRgbData data, ColorService cs) : base(cs) { Id = data.Id; _data = data; _colorService = cs; _client = cs.ControlService.GetAgent("OpenRgbAgent"); LoadData(); _colorService.ColorSendEventAsync += SetColors; }
private static void UpdateColor(ColorService colorService) { var toUpdateColor = new Color { Id = 2, Name = "Purple" }; var result = colorService.Update(toUpdateColor); Console.WriteLine(result.Message); }
private static void DeleteColor(ColorService colorService) { var toDeleteColor = new Color { Id = 2 }; var result = colorService.Delete(toDeleteColor); Console.WriteLine(result.Message); }
private static void AddNewColor(ColorService colorService) { var addColor = new Color { Id = 2, Name = "Red" }; var result = colorService.Add(addColor); Console.WriteLine(result.Message); }
private void UpdateSmartLightUI(SmartLight sl) { if (sl.Name == gameObject.name) { Renderer rend = gameObject.GetComponent <Renderer>(); Vector4 ledColor = ColorService.GetColorByHue(sl.State.Hue); rend.material.color = ledColor; } }
public ActionResult Index(ColorVM vm) { ColorService colorService = new ColorService(); vm.Count = colorService.Count; vm.Colors = colorService.Colors; return(View(vm)); }
// GET: Color public ActionResult Index() { ColorService colorService = new ColorService(); ColorVM colorVM = new ColorVM { Count = colorService.Count, Colors = colorService.Colors }; return(View(colorVM)); }
public void when_retrieving_by_try_get_instance_for_instance_that_does_exist() { var session = new BuildSession(); var theService = new ColorService("red"); session.RegisterDefault(typeof(IService), theService); session.TryGetInstance <IService>().ShouldBeTheSameAs(theService); }
// creates smart light game objects and sets color of prefab void InstantiateLights() { lightPrefab = (GameObject)Resources.Load("Prefabs/SmartBulb"); holoLightContPrefab = (GameObject)Resources.Load("Prefabs/HoloLightContainer"); // Vector3 camPos = Camera.main.transform.position; // where to spawn unassigned SmartBulb GameObjects in relation to the user's current position Vector3 pos = new Vector3(-1, 0, 2); // Quaternion rotation = Quaternion.FromToRotation(Vector3.forward, camPos); foreach (SmartLight light in lights) { var lightObject = Instantiate(lightPrefab, pos, Quaternion.identity); lightObject.name = light.Name; // gets newly instantiated GameObject and sets to child of Parent GameObject GameObject currentLight = GameObject.Find(light.Name); currentLight.transform.parent = gameObject.transform; Vector3 lightContainerPos = new Vector3(pos.x, lightContainerOffset * currentLight.transform.localScale.y, pos.z); var lightContObject = Instantiate(holoLightContPrefab, lightContainerPos, Quaternion.identity); // assigns light ID to tag for easier interating downstream. var lightIDOffset = light.ID - 1; currentLight.tag = lightIDOffset.ToString(); lightContObject.tag = lightIDOffset.ToString(); lightContObject.transform.parent = currentLight.transform; // sets color of light prefab based on current light hue state Renderer rend = currentLight.GetComponent <Renderer>(); Vector4 ledColor = ColorService.GetColorByHue(light.State.Hue); rend.material.color = ledColor; if (!StateManager.Instance.Configuring && !StateManager.Instance.SetupMode) { rend.enabled = false; } // increments x value to space out spawned prefabs that have no Anchor Store entry. pos += new Vector3(0.5f, 0, 0); // TODO see if this call is needed. Real lights should already be these values //hueAPI.UpdateLight(light); } EventManager.TriggerEvent("SmartLightManagerReady"); if (StateManager.Instance.SetupMode) { configureLights(); } else { StateManager.Instance.CurrentState = StateManager.HueAppState.Ready; } }
private List <SelectListItem> BuildListColor(string[] listColorSelected = null) { return(ColorService.GetAll().AsEnumerable() .Select(c => new SelectListItem { Value = c.Code, Text = c.Name, Selected = (listColorSelected != null && listColorSelected.Length > 0 && listColorSelected.Contains(c.Code)) }).ToList()); }
public void CreateColor_NullName_ThrowsInvalidDataException() { Mock <IColorRepository> colorRepository = new Mock <IColorRepository>(); ColorService colorService = new ColorService(colorRepository.Object); Color color = new Color(); Action actual = () => colorService.Create(color); Assert.Throws <InvalidDataException>(actual); }
public ColorsController( ICallContext callContext, AppConfig appConfig, ITelemetryLogger logger, ColorService colorService ) : base(callContext, appConfig, logger) { this.ColorService = colorService; }
public void when_retrieving_with_try_get_instance_with_nongeneric_type_that_does_exist() { var theService = new ColorService("red"); var registry = new Registry(); registry.For <IService>().Use(theService); var session = BuildSession.ForPluginGraph(registry.Build()); session.TryGetInstance(typeof(IService)).ShouldBeTheSameAs(theService); }
public FileSelectionView() { InitializeComponent(); AcceptButton = btnOk; CancelButton = btnCancel; CRUDUIService.RenderEnumList <FileTreeViewGroupEnum>(cbGrouping, FileTreeViewGroupEnum.Customer); ColorService.Setup(this); }
public HueDiscovery(ColorService colorService) : base(colorService) { _bridgeLocatorHttp = new HttpBridgeLocator(); _bridgeLocatorMdns = new MdnsBridgeLocator(); _bridgeLocatorSsdp = new SsdpBridgeLocator(); _bridgeLocatorHttp.BridgeFound += DeviceFound; _bridgeLocatorMdns.BridgeFound += DeviceFound; _bridgeLocatorSsdp.BridgeFound += DeviceFound; _controlService = colorService.ControlService; }
public async Task AddAsyncShouldThrowNullException(string name) { var options = new DbContextOptionsBuilder <ApplicationDbContext>() .UseInMemoryDatabase(databaseName: "AddAsync").Options; var dbContext = new ApplicationDbContext(options); var repository = new EfDeletableEntityRepository <Color>(dbContext); var service = new ColorService(repository); await Assert.ThrowsAsync <ArgumentNullException>(() => service.AddAsync(name)); }
public FormImportProductFormExcel() { InitializeComponent(); _suppliersService = new SuppliersService(); _productGroupService = new ProductGroupService(); _productService = new ProductService(); _stockService = new StockService(); _unitService = new UnitService(); _colorService = new ColorService(); }
public void GivenColorNotFoundThenNullColor() { // Arrange var service = new ColorService(_fakeRepository); // Act var actualColor = service.Get(-1); // Assert Assert.Null(actualColor); }
private void MonitorScriptIDE_VisibleChanged(object sender, EventArgs e) { if (!_shown) { _shown = true; if (!DesignMode) { ColorService.Setup(this); } } }
// GET: Color public ActionResult Index() { ColorService colorservice = new ColorService(); ColorVm vm = new ColorVm(); vm.ColorList = colorservice.ColorList; vm.ColorCount = colorservice.ColorCount; return(View(vm)); }
private void UpdateGlowColor() { var glowColor = ColorService.GetColor(_item?.AccumulatedState ?? LogItem.State.Information); if (glowColor != ActiveGlowColor) { FormBorderEffect = FormBorderEffect.None; ActiveGlowColor = InactiveGlowColor = glowColor; FormBorderEffect = FormBorderEffect.Glow; } }