public ActionResult DeletePartial(ColorCode color) { color.Status = "InActive"; color.modifiedOn = DateTime.Now; _ColorCodeService.Update(color); return(RedirectToAction("Details/" + color.colorId, "ColorCode")); }
public async Task <IActionResult> PutColorCode(int Id, ColorCode colorCode) { if (Id != colorCode.Id) { return(BadRequest()); } try { var updatedColorCode = new ColorCode(id: Id, code: colorCode.Code, createdDate: colorCode.CreatedDate, isActive: colorCode.IsActive, createdBy: colorCode.CreatedBy); await _colorCodeRepository.UpdateAsync(updatedColorCode); } catch (DbUpdateConcurrencyException) { if (!await(ColorCodeExists(colorCode))) { return(NotFound()); } else { throw; } } return(NoContent()); }
public void SetUpUI() { var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); SetActionBar(toolbar); toolbar.SetBackgroundColor(ColorCode.TeamColor(GameModel.Player.Team.ID)); drawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); navigationView = FindViewById <NavigationView>(Resource.Id.nav_view); ActionBar.SetHomeAsUpIndicator(Resource.Mipmap.ic_dehaze_white_24dp); ActionBar.SetDisplayHomeAsUpEnabled(true); drawerLayout.DrawerStateChanged += DrawerLayout_DrawerStateChanged; Button changeUsernameBtn = FindViewById <Button>(Resource.Id.changeUsernameButton); Button changePasswordBtn = FindViewById <Button>(Resource.Id.changePasswordButton); Button switchTeamBtn = FindViewById <Button>(Resource.Id.switchTeamButton); Button switchMapBtn = FindViewById <Button>(Resource.Id.switchMapStyleButton); changeUsernameBtn.Click += ChangeUsernameBtn_Click; changePasswordBtn.Click += ChangePasswordBtn_Click; switchTeamBtn.Click += SwitchTeamBtn_Click; switchMapBtn.Click += SwitchMapBtn_Click; }
public Form1() { InitializeComponent(); List <ColorMap> colorMaps = new List <ColorMap>() { new ColorMap(-999, -1, "FF0000"), new ColorMap(-0.99, -0.75, "FF3333") /* and so on*/ }; foreach (DataGridViewRow row in dataGridView1.Rows) { foreach (DataGridViewCell cell in row.Cells) { double cellValue; if (!double.TryParse(cell.Value.ToString(), out cellValue)) { continue; //or whatever logic you want } ColorMap colorMap = colorMaps.SingleOrDefault(x => x.From <= cellValue && x.To >= cellValue); if (colorMap == null) { continue; //or whatever logic you want } ColorCode colorCode = new ColorCode(colorMap.Value); cell.Style.BackColor = Color.FromArgb(colorCode.Red, colorCode.Green, colorCode.Blue); } } }
private void Awake() { m_cTransform = GetComponent <Transform>(); m_ColorCode = GetComponent <ColorCode>(); GlobalData.PlayModeToggled += OnPlayModeToggled; }
public override Int32 GetHashCode() { return(ShopCode.GetHashCode() ^ ArticleCode.GetHashCode() ^ ColorCode.GetHashCode() ^ SizeCode.GetHashCode()); }
/// <summary> /// ビットマップファイルのバイトデータを返します。 /// </summary> /// <param name="moduleSize">モジュールサイズ(px)</param> /// <param name="monochrome">1bitカラーはtrue、24bitカラーはfalseを設定します。</param> /// <param name="foreRgb">前景色</param> /// <param name="backRgb">背景色</param> public byte[] GetBitmap(int moduleSize = DEFAULT_MODULE_SIZE, bool monochrome = false, string foreRgb = ColorCode.BLACK, string backRgb = ColorCode.WHITE) { if (_dataBitCounter == 0) { throw new InvalidOperationException(); } if (moduleSize < MIN_MODULE_SIZE) { throw new ArgumentOutOfRangeException(nameof(moduleSize)); } if (ColorCode.IsWebColor(foreRgb) == false) { throw new FormatException(nameof(foreRgb)); } if (ColorCode.IsWebColor(backRgb) == false) { throw new FormatException(nameof(backRgb)); } if (monochrome) { return(GetBitmap1bpp(moduleSize, foreRgb, backRgb)); } else { return(GetBitmap24bpp(moduleSize, foreRgb, backRgb)); } }
private void SetChart() { cellClicked.HoldStrength = GameModel.CellsInView[cellClicked.ID].HoldStrength; List <Entry> entries = new List <Entry> { new Entry(GameModel.maxHoldStrength - cellClicked.HoldStrength) { Color = SKColor.Parse("#ffffff"), Label = "Remaining", ValueLabel = (GameModel.maxHoldStrength - cellClicked.HoldStrength).ToString() }, new Entry(cellClicked.HoldStrength) { Color = SKColor.Parse(ColorCode.BrightHexColorCode(cellClicked.TeamID)), Label = "Hold Strength", ValueLabel = cellClicked.HoldStrength.ToString() }, }; DonutChart chart = new DonutChart() { Entries = entries, HoleRadius = 0.6f, BackgroundColor = SKColor.Parse("#202020") }; donutChart.Chart = chart; }
public PlayerFieldArea(int identifier, ColorCode colorCode, int fieldId) { Identifier = identifier; ColorCode = colorCode; FieldId = fieldId; GeneratePlayerFieldArea(fieldId); }
/// <summary> /// シンボルをSVG形式でファイルに保存します。 /// </summary> /// <param name="fileName">ファイル名</param> /// <param name="moduleSize">モジュールサイズ(px)</param> /// <param name="foreRgb">前景色</param> public void SaveSvg(string fileName, int moduleSize = DEFAULT_MODULE_SIZE, string foreRgb = ColorCode.BLACK) { if (_dataBitCounter == 0) { throw new InvalidOperationException(); } if (string.IsNullOrEmpty(fileName)) { throw new ArgumentNullException(nameof(fileName)); } if (moduleSize < MIN_MODULE_SIZE) { throw new ArgumentOutOfRangeException(nameof(moduleSize)); } if (ColorCode.IsWebColor(foreRgb) == false) { throw new FormatException(nameof(foreRgb)); } string newLine = Environment.NewLine; string svg = GetSvg(moduleSize, foreRgb) + newLine; File.WriteAllText(fileName, svg); }
public Int64 CalculateOhmValue(string bandAColor, string bandBColor, string bandCColor, string bandDColor) { Int64 maxresistance = 0; try { // Validate ColorCodes ValidateInput(bandAColor, bandBColor, bandCColor, bandDColor, resistorcolorCodes.ColorCodes); //Get Color Codes ColorCode bandAColorChar = GetColorCode(bandAColor, resistorcolorCodes.ColorCodes); ColorCode bandBColorChar = GetColorCode(bandBColor, resistorcolorCodes.ColorCodes); ColorCode bandCColorChar = GetColorCode(bandCColor, resistorcolorCodes.ColorCodes); ColorCode bandDColorChar = GetColorCode(bandDColor, resistorcolorCodes.ColorCodes); Int64 AverageResistance = Convert.ToInt64(bandAColorChar.SignificantFigues + bandBColorChar.SignificantFigues) * Convert.ToInt64(bandCColorChar.Multiplier); double TolernaceCalc = (Convert.ToDouble(bandDColorChar.Tolerance) / 100) * AverageResistance; maxresistance = AverageResistance + Convert.ToInt64(TolernaceCalc); } catch (Exception ex) { throw ex; } return(maxresistance); }
void Awake() { m_Transform = transform; m_ColorCode = GetComponent <ColorCode>(); GlobalData.PlayModeToggled += OnPlayModeToggled; }
private async void SetColorbar(int imageID) { if (_imageID != -1) { List <Model.ImageColorInfo> lst = await SqliteUtil.Current.QueryImageColorInfoByImageID(_imageID); foreach (ImageColorInfo color in lst) { BoxView box = new BoxView(); box.Color = Xamarin.Forms.Color.FromHex(color.HEXValue); box.CornerRadius = new CornerRadius(10); pickColorList.Children.Add(box); } if (lst.Count > 0) { ColorCode colorcd = new ColorCode(); string hex = lst[lst.Count - 1].HEXValue; btnColor.BackgroundColor = Xamarin.Forms.Color.FromHex(hex); lblSelected.Text = hex; lblHex.Text = hex; Rgb rgb = colorcd.getRgb(hex); lblRgb.Text = colorcd.getRgbString(rgb); lblHsl.Text = colorcd.getHslString(rgb); lblHsv.Text = colorcd.getHsvString(rgb); lblCmyk.Text = colorcd.getCmykString(rgb); lblLab.Text = colorcd.getLabString(rgb); lblMunsell.Text = colorcd.getMunsellString(rgb); lblPccs.Text = colorcd.getPCCSTone(rgb); lblJis.Text = JisUtil.getJisByMunsell(lblMunsell.Text); } } }
/// <summary> /// Recodes the given byte. /// </summary> internal override byte Recode(byte codedByte) { // Get key byte byte keyByte; switch (_colorTracker) { case ColorCode.Blue: // Set source information and next color keyByte = _currentColor.Blue; _colorTracker = ColorCode.Red; break; case ColorCode.Green: // Set source information and next color keyByte = _currentColor.Green; _colorTracker = ColorCode.Blue; break; case ColorCode.Red: // Color code red always sets the new color and updates the position information _currentColor = _imageData.GetNextColor(); // Set source information and next color keyByte = _currentColor.Red; _colorTracker = ColorCode.Green; break; default: throw new Exception("Bonk"); } // Return the recoded byte return (byte)(keyByte - codedByte); }
internal Parser(ColorCode.ILanguage lang) { _lang = lang; var repo = new ColorCode.Common.LanguageRepository(new Dictionary<string, ColorCode.ILanguage>()); var compiler = new ColorCode.Compilation.LanguageCompiler(new Dictionary<string, ColorCode.Compilation.CompiledLanguage>()); _internalParser = new ColorCode.Parsing.LanguageParser(compiler, repo); }
private void NotifyActualPlayer(User user, List <HandCard> handCards, int tableId) { GameTable actualGameTable = GameTableService.GetTable(Games, tableId); List <HandCard> validCards = actualGameTable.CardServiceData.ProveCards(handCards, actualGameTable, user); IHubContext context = GlobalHost.ConnectionManager.GetHubContext <ChatHub>(); if (validCards.Find(card => card.IsValid) != null) { Task firstTask = context.Clients.Group(tableId.ToString(), user.ConnectionIds.ToArray()).broadcastSystemMessage(ServerMessages.InformOtherPlayer.Replace("{0}", user.Nickname), tableId, DateTime.Now.Ticks + GetMessageCounter()); firstTask.Wait(); actualGameTable.ActualParticipation = ParticipationService.GetParticipation(actualGameTable, user.Nickname); user.ConnectionIds.ForEach(cId => { Task task = context.Clients.Client(cId).broadcastSystemMessage(ServerMessages.NofityActualPlayer, actualGameTable.Identifier, DateTime.Now.Ticks + GetMessageCounter()); task.Wait(); ColorCode colorCode = GameTableService.GetColorCodeForUser(Games, GameTableService.AreAllEndFieldsUsedForColorCode(actualGameTable, GameTableService.GetColorCodeForUser(Games, user.Nickname, tableId)) ? ParticipationService.GetPartner(user, actualGameTable.Participations).Nickname : user.Nickname, tableId); Clients.Client(cId).notifyActualPlayer(validCards, colorCode, tableId); }); } else { NotifyNextPlayer("", actualGameTable); } }
public string SaveColorCode(string name, ColorCode ColorCode) { string returndata; try { string DirectoryName = Path.Combine(DefaultSaveLocation, "ColorCodes"); if (!Directory.Exists(DirectoryName))//if the project doesnt exist create a directory for it { Directory.CreateDirectory(DirectoryName); } FileStream files = File.Create(Path.Combine(DirectoryName, FileSafe(name))); string data = ""; returndata = "Created File"; for (int x = 0; x < ColorCode.Count; x++) { data += ColorCode.Sectors[x] + "/"; data += ColorCode.GroupingColors[x] + "/"; data += ColorCode.IndividualColors[x] + "/"; data += ColorCode.Cores[x] + ""; data += "-"; } returndata = "Generated Text" + data; files.Write(Encoding.ASCII.GetBytes(data), 0, data.Length); returndata = "Wrote Text" + data; files.Close(); } catch (Exception ex) { return(_ = "Caught Exception:" + ex.ToString()); } return(returndata); }
public Player(int id, ColorCode colorCode) { this.id = id; playerColor = colorCode; gameObj = (GameObject)GameObject.Instantiate(spherePrefab); gameObj.name = "Player #" + id; //gameObj.renderer.material = (Material)Resources.Load("mat" + id, typeof(Material)); /* if(PlayerPrefs.GetString("Player0") == "Blue") playerColor = Color.blue * 0.5f; if(PlayerPrefs.GetString("Player1") == "Green") playerColor = Color.green * 0.5f; if(PlayerPrefs.GetString("Player2") == "Red") playerColor = Color.red * 0.5f; if(PlayerPrefs.GetString("Player3") == "Yellow") playerColor = Color.yellow * 0.5f; //*/ gameObj.renderer.material.color = toColor(playerColor) * 0.5f; /*switch (id) { case 0: gameObj.renderer.material.color = Color.blue * 0.5f; break; case 1: gameObj.renderer.material.color = Color.green * 0.5f; break; case 2: gameObj.renderer.material.color = Color.red * 0.5f; break; case 3: gameObj.renderer.material.color = Color.yellow * 0.5f; break; }*/ }
public async Task SwitchFaction(int newFactionID) { await Database.UpdateTeam(GameModel.Player, newFactionID); foreach (AntiMine am in AntiMines.Values) { if (GameModel.CellsInView.ContainsKey(am.CellID)) { am.Stop(); GameModel.CellsInView[am.CellID].MapOverlay.RemoveAntiMine(); } } foreach (Mine m in Mines.Values) { if (GameModel.CellsInView.ContainsKey(m.CellID)) { GameModel.CellsInView[m.CellID].MapOverlay.RemoveAntiMine(); } } AntiMines.Clear(); Mines.Clear(); Team = new Team(newFactionID, ColorCode.TeamName(newFactionID)); }
private void Awake() { m_ColorCode = GetComponent <ColorCode>(); m_TileGrid = FindObjectOfType <TileGrid>(); m_cTransform = transform; GlobalData.PlayModeToggled += OnPlayModeToggled; }
public static String Color(String str, ColorCode foreground) { if (foreground == ColorCode.None) { return(str); } return(String.Concat(ColorBarrierCode, (int)foreground, str, ColorBarrierCode)); }
// Use this for initialization void Start() { textMesh = gameObject.GetComponent <TextMesh>(); textMesh.fontSize = 30; textMesh.transform.position = new Vector3(154.7f, 39.4f, 92.4f); textMesh.transform.eulerAngles = new Vector3(-90f, -90f, 0f); colorCode = new ColorCode(); }
void Start() { adjColor = ColorCode.FromValue(color); //if (Locked) { transform.FindChild("DoorKnob").GetComponent<Renderer>().material.color = (Locked) ? ColorCode.FromValue( color ).Color : new Color(0.5f,0.25f,0.1f); } }
public ActionResult Details(int id) { ColorCode color = new ColorCode(); TempData["ColorList"] = _ColorCodeService.getAllColorCode(); color = _ColorCodeService.GetColorCodebyId(id); return(View(color)); }
/// <summary> /// Returns the properties for the given color code /// </summary> /// <param name="colorCode">The requested color code</param> /// <returns></returns> public static ColorCodeProperty GetColorCodeProperty(ColorCode colorCode) { MemberInfo[] memberInfo = colorCode.GetType().GetMember(colorCode.ToString()); ColorCodeProperty attributes = (ColorCodeProperty)memberInfo[0].GetCustomAttribute(typeof(ColorCodeProperty), false); return(attributes); }
/** * FUNCTION NAME: Start * DESCRIPTION : Caches components. * INPUTS : None * OUTPUTS : None **/ void Start() { m_cTransform = GetComponent <Transform>(); m_cColorCode = GetComponent <ColorCode>(); GlobalData.PlayModePreToggle += OnPlayModePreToggle; GlobalData.PlayModeToggled += OnPlayModeToggled; }
public int CalculateOhmValue(ColorCode band1, ColorCode band2, ColorCode band3, ColorCode band4) { band1.ThrowIfNullOrEmpty(nameof(band1)); band2.ThrowIfNullOrEmpty(nameof(band2)); band3.ThrowIfNullOrEmpty(nameof(band3)); band4.ThrowIfNullOrEmpty(nameof(band4)); return(CalculateOhmValue(band1.FourBand, band2.FourBand, band3.FourBand, band4.FourBand)); }
/** * FUNCTION NAME: Start * DESCRIPTION : Caches components. * INPUTS : None * OUTPUTS : None **/ void Start() { m_Transform = transform; m_ColorCode = GetComponent <ColorCode>(); m_ComponentColors = GetComponent <SetComponentColorsOnColorSet>(); GlobalData.PlayModePreToggle += OnPlayModePreToggle; GlobalData.PlayModeToggled += OnPlayModeToggled; }
public ColorPair(short pairId, ColorCode forground, ColorCode background) { this.pairId = pairId; Forground = forground; Background = background; InitPair(pairId, forground, background); Console.Error.WriteLine(pairId); }
internal static ColorCode GetOverridenColorCode(LogEventLevel level, ColorCode colorCode) { return(level switch { LogEventLevel.Warning => ColorCode.LvlTokenWrn, LogEventLevel.Fatal => ColorCode.LvlTokenFtl, LogEventLevel.Error => ColorCode.LvlTokenErr, _ => colorCode, });
public static String Color(String str, ColorCode foreground, ColorCode background) { if(foreground == ColorCode.None) return str; else if(foreground != ColorCode.None && background == ColorCode.None) return Color(str, foreground); else return String.Concat(ColorBarrierCode, (int)foreground, ',', (int)background, str, ColorBarrierCode); }
protected override void OnResume() { base.OnResume(); var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); SetActionBar(toolbar); toolbar.SetBackgroundColor(ColorCode.TeamColor(GameModel.Player.Team.ID)); }
protected async override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Map); var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); SetActionBar(toolbar); toolbar.SetBackgroundColor(ColorCode.TeamColor(GameModel.Player.Team.ID)); drawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); navigationView = FindViewById <NavigationView>(Resource.Id.nav_view); statusText = FindViewById <TextView>(Resource.Id.textBelowMap); tagButton = FindViewById <Button>(Resource.Id.claimButton); locationButton = FindViewById <Button>(Resource.Id.clientCameraLocationbtn); ActionBar.SetHomeAsUpIndicator(Resource.Mipmap.ic_dehaze_white_24dp); ActionBar.SetDisplayHomeAsUpEnabled(true); drawerLayout.DrawerStateChanged += DrawerLayout_DrawerStateChanged; tagButton.Click += TagButton_Click; locationButton.Click += LocationButton_Click; SetUpMap(); var cellHubSetupTask = SetUpCellHub(); if (CheckSelfPermission(Android.Manifest.Permission.AccessFineLocation) == Permission.Granted) { DisplayStatus("Finding location..."); GetLocation(); } else { RequestPermissions(LocationPermissions, RequestLocationID); } navigationView.NavigationItemSelected += (sender, e) => { e.MenuItem.SetChecked(true); switch (e.MenuItem.ItemId) { case Resource.Id.nav_logout: GameModel.Logout(); StartActivity(new Intent(this, typeof(LoginActivity))); break; default: break; } drawerLayout.CloseDrawers(); }; await cellHubSetupTask; }
public void YellowColorTest() { ColorCode colorCode = new ColorCode("Yellow", "YE", 4, 10000, 0.05); Assert.AreEqual(colorCode.Code, "YE"); Assert.AreEqual(colorCode.Name, "Yellow"); Assert.AreEqual(colorCode.SignificantFigures.Value, 4); Assert.AreEqual(colorCode.Multiplier.Value, 10000); Assert.AreEqual(colorCode.Tolerance, 0.05); }
public void GreenColorTest() { ColorCode colorCode = new ColorCode("Green", "GN", 5, 100000, 0.005); Assert.AreEqual(colorCode.Code, "GN"); Assert.AreEqual(colorCode.Name, "Green"); Assert.AreEqual(colorCode.SignificantFigures.Value, 5); Assert.AreEqual(colorCode.Multiplier.Value, 100000); Assert.AreEqual(colorCode.Tolerance, 0.005); }
/// <summary> /// Initializes a new instance of the <see cref="CoderFox"/> class. /// </summary> /// <param name="keyPath">A string containing the path to the image that serves as key.</param> internal CoderSeal(string keyPath) : base(keyPath) { // Get image data using (Bitmap keyFile = (Bitmap)Bitmap.FromFile(_keyPath)) _imageData = new ImageData(keyFile); // Set default field values _colorTracker = ColorCode.Red; }
// END CUT HERE // BEGIN CUT HERE public static void Main() { try { ColorCode ___test = new ColorCode(); ___test.run_test(-1); } catch(Exception e) { //Console.WriteLine(e.StackTrace); Console.WriteLine(e.ToString()); } }
public MainWindow() : base(Gtk.WindowType.Toplevel) { this.Build(); colorViewHandler = new ColorView(colorView, DEFAULT_COLOR_CODE); colorCodeHandler = new ColorCode(colorCode); alphaColorCodeHandler = new AColorCode(aColorCode); colorScalesHandler = new ColorScales(redScale, greenScale, blueScale, alphaScale); clickEventHandler = new ClickEventHandler(); base.Decorated = false; base.Resizable = false; base.Title = TITLE; }
public static Color toColor(ColorCode cC) { switch(cC){ case ColorCode.RED: return Color.red; break; case ColorCode.BLUE: return Color.blue; break; case ColorCode.GREEN: return Color.green; break; case ColorCode.YELLOW: return Color.yellow; break; case ColorCode.MAGENTA: return Color.magenta; break; default: return new Color(255, 0, 255, 255); } }
public RibbonXml(ColorCode.ILanguage []langs) { this.Languages = langs; }
public static bool ValidColor(ColorCode color) { return ValidColor((int)color); }
internal static Flagment FromScope(int baseIndex, string token, ColorCode.Parsing.Scope scope, ColorCode.IStyleSheet stylesheet) { return new Flagment(scope.Name, token.Substring(scope.Index, scope.Length), stylesheet.Styles[scope.Name].Foreground, baseIndex + scope.Index, scope.Length); }
public static String Color(String str, ColorCode foreground) { if(foreground == ColorCode.None) return str; return String.Concat(ColorBarrierCode, (int)foreground, str, ColorBarrierCode); }
public Color GetColor(ColorCode code) { int index = (int)code; if (index >= 0 && index < m_lookup.Length) { return m_lookup[index]; } return m_lookup[(int)ColorCode.Clear]; }
internal void SetColor(ColorCode code, Color color) { int index = (int)code; if (index < 0 || index >= m_lookup.Length) { throw new ArgumentOutOfRangeException("index"); } m_lookup[index] = color; }
public static Color GetColor(ColorCode code) { return colors.GetColor(code); }
internal static void SetColor(ColorCode code, Color color) { colors.SetColor(code, color); }