public void GameLogWrite(String text, SolidColorBrush brush, TextDecorationCollection decorations) { // FIXME: probably more invalid characters... text = text.Replace((Char)0x17, ' '); //text = System.Security.SecurityElement.Escape(text).Replace((Char)0x17, ' '); XmlElement run = GameLogCreateXmlElement("Run"); run.InnerText = text; Procedure<String, String> addXmlAttribute = (name, value) => { XmlAttribute attribute = gameLog.CreateAttribute(name); attribute.InnerXml = value; run.Attributes.Append(attribute); }; if (brush != Brushes.Black) { addXmlAttribute("Foreground", brush.ToString()); } if (decorations != null) { // TODO: fixme for multiple attributes, what's the XML for that? addXmlAttribute("TextDecorations", decorations[0].Location.ToString()); } gameLogParagraph.AppendChild(run); }
public void AccountBackgroundColour_is_white_when_AccountName_is_valid() { var transaction = new Transaction(_journal, TransactionDirection.In, _account); var vm = new TransactionViewModel(transaction, _mockAccountRepository); var white = new SolidColorBrush(Colors.White); Assert.AreEqual(white.ToString(), vm.AccountBackgroundColour.ToString()); }
public void AccountBackgroundColour_is_pink_when_AccountName_is_invalid() { var transaction = new Transaction(_journal, TransactionDirection.Out, null, 123.45M); var vm = new TransactionViewModel(transaction, _mockAccountRepository); var pink = new SolidColorBrush(Colors.Pink); Assert.AreEqual(pink.ToString(), vm.AccountBackgroundColour.ToString()); }
public SysColorViewModal(string name, SolidColorBrush brush, ICopyService copyService) { if(copyService == null) { throw new ArgumentNullException("copyService"); } Name = name; Data = brush.ToString(); ColorItem = brush; CopyCommand = new CommandHandler(CopyAction, true); m_CopyService = copyService; }
/// <summary> /// Hides a DataPoint Marker /// </summary> /// <param name="dataPoint"></param> internal static void HideDataPointMarker(DataPoint dataPoint) { Brush tarnsparentColor = new SolidColorBrush(Colors.Transparent); dataPoint.Marker.MarkerShape.Fill = tarnsparentColor; SolidColorBrush stroke = dataPoint.Marker.MarkerShape.Stroke as SolidColorBrush; if(!(stroke != null && stroke.Color.ToString().Equals(tarnsparentColor.ToString()))) dataPoint.Marker.MarkerShape.Stroke = tarnsparentColor; if (dataPoint.Marker.MarkerShadow != null) dataPoint.Marker.MarkerShadow.Visibility = Visibility.Collapsed; if (dataPoint.Marker.BevelLayer != null) dataPoint.Marker.BevelLayer.Visibility = Visibility.Collapsed; }
public void AmountOutBackgroundColour_is_white_when_AmountOut_is_valid() { var transaction = new Transaction(_journal, TransactionDirection.Out, null, 123.45M); var vm = new TransactionViewModel(transaction, _mockAccountRepository); var white = new SolidColorBrush(Colors.White); Assert.AreEqual(white.ToString(), vm.AmountOutBackgroundColour.ToString()); Assert.AreEqual(white.ToString(), vm.AmountInBackgroundColour.ToString()); }
public void AmountInBackgroundColour_is_pink_when_AmountIn_is_invalid() { var transaction = new Transaction(_journal, TransactionDirection.In, _account); var vm = new TransactionViewModel(transaction, _mockAccountRepository); var white = new SolidColorBrush(Colors.White); var pink = new SolidColorBrush(Colors.Pink); Assert.AreEqual(pink.ToString(), vm.AmountInBackgroundColour.ToString()); Assert.AreEqual(white.ToString(), vm.AmountOutBackgroundColour.ToString()); }
/// <summary> /// Raise ColorChanged event when a new color is chosen using the picker /// </summary> private void PickerOnSelectedColorChanged(object sender, EventArgs<Color> eventArgs) { if (eventArgs != null) { var brush = new SolidColorBrush(eventArgs.Value); var hexColor = brush.ToString(); ColorChanged?.Invoke(this, hexColor); } }