protected async void OnBoardChangedComet(int x, int y, Type type, Color side) { await SendMessage( "{\"success\": true, \"actions\": [" + "{\"action\": \"update-board\", \"param\":" + String.Format("[{{\"type\": \"{0}\", \"side\": \"{1}\", \"x\": {2}, \"y\": {3}}}]", type.ToString(), side.ToString(), x, y) + "}" + "]}"); }
public void Color_Premultiply() { Color c = new Color(128,128,128,true); Assert.AreEqual(c.R, 128); Assert.AreEqual(c.G, 128); Assert.AreEqual(c.B, 128); Assert.AreEqual(c.A, 255); Assert.IsTrue(c.Premultiplied); Assert.AreEqual(c.ToString(), "rgb(128,128,128)"); }
public void WeCanParseTheOutputOfToString() { Color c = new Color(0.5f, 0.5f, 0.5f); Color c1 = Color.Parse(c.ToString()); Assert.That(c1.R, Is.EqualTo(c.R)); Assert.That(c1.G, Is.EqualTo(c.G)); Assert.That(c1.B, Is.EqualTo(c.B)); Assert.That(c1.A, Is.EqualTo(c.A)); }
public MyRemotePlayer(string dllName, Color color) { process = new Process(); process.StartInfo.FileName = "Checkers.Runner.exe"; process.StartInfo.Arguments = dllName + " " + color.ToString(); process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardInput = true; process.StartInfo.RedirectStandardOutput = true; process.StartInfo.CreateNoWindow = false; process.Start(); }
public void Color_FromRGBAPercent() { Color c = new Color("rgba(100%,0%,0%,1)"); Assert.AreEqual(c.R, 255); Assert.AreEqual(c.G, 0); Assert.AreEqual(c.B, 0); Assert.AreEqual(c.A, 255); Assert.AreEqual(c.Hex(), "#ff0000"); Assert.IsFalse(c.Premultiplied); Assert.AreEqual(c.ToString(), "rgb(255,0,0)"); }
public void Color_FromText() { Color c = new Color("red"); Assert.AreEqual(c.R, 255); Assert.AreEqual(c.G, 0); Assert.AreEqual(c.B, 0); Assert.AreEqual(c.A, 255); Assert.IsFalse(c.Premultiplied); Assert.AreEqual(c.Hex(), "#ff0000"); Assert.AreEqual(c.ToString(), "rgb(255,0,0)"); }
public string color;//Цвет //Конструктор по умолчанию - цена, производитель и цвет public Auto(int price, Manufacturer manuf, Color col) { this.price = price; this.manufacturer = manuf.ToString(); this.color = col.ToString(); }
private string GetImagePath(Color color) { return @"/Content/imgs/" + color.ToString() + "Ninja.png"; }
/// <summary> /// Gets the pixel color and verifies /// </summary> /// <returns></returns> protected MFTestResults VerifyingPixelColor(Point[] pts, Color _color) { for (int i = 0; i < pts.Length; i++) { Color c = Master_Presentation.mainWindow._pBitmap.GetPixel(pts[i].x, pts[i].y); if (c != _color) { Thread.Sleep(1000); c = Master_Presentation.mainWindow._pBitmap.GetPixel(pts[i].x, pts[i].y); if(_color != c) { Master_Presentation.mainWindow._pBitmap.DrawEllipse(c == Colors.Red ? Colors.Green : Colors.Red, 1, pts[i].x, pts[i].y, 3, 3, (Color)0, 0, 0, (Color)0, 0, 0, Bitmap.OpacityTransparent); Master_Presentation.mainWindow._pBitmap.Flush(); Log.Comment("Failure : Expected color '" + _color.ToString() + "' but got '" + c.ToString() + "' at (" + pts[i].x.ToString() + ", " + pts[i].y.ToString() + ")"); return MFTestResults.Fail; } } } return MFTestResults.Pass; }
public void Color_ToString_Test() { var color = new Color(0.0f, 0.1f, 0.22f, 0.333f); Assert.AreEqual("Color(0, 0.1, 0.22, 0.333)", color.ToString()); }
private void Display(Mode m, Color c, State s, Types t) { string mstr = m.ToString(); string cstr = c.ToString(); string sstr = s.ToString(); string tstr = t.ToString(); }
////////////////////////////////////////////////////////////////////////////////////////////////////////// /* CONDITION MANAGEMENT */ ////////////////////////////////////////////////////////////////////////////////////////////////////////// void SetCondition(string _condition) { condition = _condition; StoreExternalConfigData(); Debug("New Condition: [" + _condition + "]"); Debug("Switching Lights: " + lights.Count); Color lcdBGColor = new Color(0, 0, 0); Color fontColor = new Color(255, 255, 255); Color lightColor = new Color(255, 255, 255); Debug("Switch to condition: " + _condition); switch (_condition) { case "green": lcdBGColor = panelDefaultBG; fontColor = panelDefaultFC; for (int i = 0; i < lights.Count; i++) { string _name = lights[i].CustomName; Color color = LIGHT_CONFIGURATION[lights[i]]; lights[i].SetValue("Color", color); Debug("OLD COLOR WAS:" + color.ToString()); } VALUE_CONDITION = "green"; break; case "orange": lcdBGColor = conditionOrangeBG; fontColor = conditionOrangeFC; lightColor = conditionOrangeLight; for (int i = 0; i < lights.Count; i++) { lights[i].SetValue("Color", lightColor); } VALUE_CONDITION = "orange"; break; case "red": Debug("Switching Lights to condition red"); lcdBGColor = conditionRedBG; fontColor = conditionRedFC; lightColor = conditionRedLight; Debug("Switching Lights:" + lightColor.ToString()); for (int i = 0; i < lights.Count; i++) { lights[i].SetValue("Color", lightColor); } VALUE_CONDITION = "red"; break; default: lcdBGColor = panelDefaultBG; fontColor = panelDefaultFC; break; } Debug("SETTING COLOR"); for (int i = 0; i < panels.Count; i++) { panels[i].SetValue("BackgroundColor", lcdBGColor); panels[i].SetValue("FontColor", fontColor); } RUNNING_CONFIGURATION[KEY_CONDITION] = VALUE_CONDITION; StoreExternalConfigData(); }
/// <summary> /// Gets the pixel color and verifies /// </summary> /// <returns></returns> protected MFTestResults VerifyingPixelColor(Point[] pts, Color _color) { MFTestResults tResult = MFTestResults.Pass; for (int i = 0; i < pts.Length; i++) { if ((pts[i].x >= Master_Media._panel._pBitmap.Width) || (pts[i].y >= Master_Media._panel._pBitmap.Height)) { continue; } Color c = Master_Media._panel._pBitmap.GetPixel(pts[i].x, pts[i].y); if (c != _color) { // this method could fail because of a race condition between renderign and this thread // wait a bit Thread.Sleep(2000); // get the color again c = Master_Media._panel._pBitmap.GetPixel(pts[i].x, pts[i].y); if (c != _color) { Master_Media._panel._pBitmap.DrawEllipse(Colors.Red, 1, pts[i].x, pts[i].y, 3, 3, Colors.White, 0, 0, Color.White, 3, 3, Bitmap.OpacityOpaque); Master_Media._panel._pBitmap.Flush(); Log.Comment("Failure : Expected color '" + _color.ToString() + "' but got '" + c.ToString() + "' at (" + pts[i].x.ToString() + ", " + pts[i].y.ToString() + ")"); tResult = MFTestResults.Fail; } } } return tResult; }
public void TestToString () { var color = new Color (1, 1, 1, 0.5); Assert.AreEqual ("[Color: A=0.5, R=1, G=1, B=1, Hue=0, Saturation=0, Luminosity=1]", color.ToString ()); }
protected async void OnTurnChangedComet(Color side) { await SendMessage( "{\"success\": true, \"actions\": [" + "{\"action\": \"update-turn\", \"param\": \"" + side.ToString() + "\"}" + "]}"); }
public void TestColorModel() { var c1 = new Color(); Assert.AreEqual(c1, default(Color)); Assert.IsTrue(c1 == default(Color)); Assert.IsFalse(c1 != default(Color)); Assert.IsTrue(((object)c1).Equals((object)default(Color))); Assert.AreEqual("00000000", c1.ToString()); var c2 = new Color(255, 0, 0, 0); Assert.AreEqual(c2.R, 255); Assert.AreEqual(c2.G, 0); Assert.AreEqual(c2.B, 0); Assert.AreEqual(c2.A, 0); Assert.AreEqual(Color.Red.ToString(), c2.ToString()); Assert.AreEqual(Color.Red.GetHashCode(), c2.GetHashCode()); }
/// <summary> /// Gets the pixel color and verifies /// </summary> /// <returns></returns> protected MFTestResults VerifyingPixelColor(Point[] pts, Color _color) { for (int i = 0; i < pts.Length; i++) { Color c = Master_Shapes._panel._pBitmap.GetPixel(pts[i].x, pts[i].y); if (c != _color) { Thread.Sleep(1000); c = Master_Shapes._panel._pBitmap.GetPixel(pts[i].x, pts[i].y); if (c != _color) { Master_Shapes._panel._pBitmap.DrawEllipse(Colors.Purple, 1, pts[0].x, pts[0].y, 3, 3, Color.White, 0, 0, Colors.White, 0, 0, Bitmap.OpacityTransparent); Master_Shapes._panel._pBitmap.DrawEllipse(Colors.Purple, 1, pts[1].x, pts[1].y, 3, 3, Color.White, 0, 0, Colors.White, 0, 0, Bitmap.OpacityTransparent); Master_Shapes._panel._pBitmap.DrawEllipse(Colors.Purple, 1, pts[2].x, pts[2].y, 3, 3, Color.White, 0, 0, Colors.White, 0, 0, Bitmap.OpacityTransparent); Master_Shapes._panel._pBitmap.DrawEllipse(Colors.Purple, 1, pts[3].x, pts[3].y, 3, 3, Color.White, 0, 0, Colors.White, 0, 0, Bitmap.OpacityTransparent); Master_Shapes._panel._pBitmap.DrawEllipse(Colors.Red, 1, pts[i].x, pts[i].y, 3, 3, (Color)0, 0, 0, (Color)0, 0, 0, Bitmap.OpacityTransparent); Master_Shapes._panel._pBitmap.Flush(); Log.Comment("Failure : Expected color '" + _color.ToString() + "' but got '" + c.ToString() + "' at (" + pts[i].x.ToString() + ", " + pts[i].y.ToString() + ")"); return MFTestResults.Fail; } } } return MFTestResults.Pass; }
public void Color_Parse_Test() { var expected = new Color(0.0f, 0.1f, 0.22f, 0.333f); var actual = Color.Parse(expected.ToString()); Assert.AreEqual(expected, actual); }
/// <summary> /// Gets the pixel color and verifies /// </summary> /// <returns></returns> protected MFTestResults VerifyingPixelColor(Point[] pts, Color refColor) { MFTestResults tResult = MFTestResults.Pass; for (int i = 0; i < pts.Length; i++) { Color c = Master_Controls.mainWindow._pBitmap.GetPixel(pts[i].x, pts[i].y); if (c != refColor) { Debug.Assert(pts[i].x < Master_Controls.mainWindow._pBitmap.Width); Debug.Assert(pts[i].y < Master_Controls.mainWindow._pBitmap.Height); Thread.Sleep(1000); c = Master_Controls.mainWindow._pBitmap.GetPixel(pts[i].x, pts[i].y); if(refColor != c) { Master_Controls.mainWindow._pBitmap.DrawEllipse(Colors.Purple, 1, pts[0].x, pts[0].y, 3, 3, Color.White, 0, 0, Colors.White, 0, 0, Bitmap.OpacityTransparent); Master_Controls.mainWindow._pBitmap.DrawEllipse(Colors.Purple, 1, pts[1].x, pts[1].y, 3, 3, Color.White, 0, 0, Colors.White, 0, 0, Bitmap.OpacityTransparent); Master_Controls.mainWindow._pBitmap.DrawEllipse(Colors.Purple, 1, pts[2].x, pts[2].y, 3, 3, Color.White, 0, 0, Colors.White, 0, 0, Bitmap.OpacityTransparent); Master_Controls.mainWindow._pBitmap.DrawEllipse(Colors.Purple, 1, pts[3].x, pts[3].y, 3, 3, Color.White, 0, 0, Colors.White, 0, 0, Bitmap.OpacityTransparent); Master_Controls.mainWindow._pBitmap.DrawEllipse(Colors.Red, 1, pts[i].x, pts[i].y, 3, 3, Color.White, 0, 0, Colors.White, 0, 0, Bitmap.OpacityTransparent); Master_Controls.mainWindow._pBitmap.Flush(); Log.Comment("Failure : Expected color '" + refColor.ToString() + "' but got '" + c.ToString() + "' at (" + pts[i].x.ToString() + ", " + pts[i].y.ToString() + ")"); return MFTestResults.Fail; } } } return tResult; }
public DelcomLight(DelcomDeviceController deviceManager, Color lightColor) { this.deviceManager = deviceManager; this.ledPin = this.deviceManager.LightColors[lightColor.ToString()]; }