~halega/+junk/sharpdevelop

« back to all changes in this revision

Viewing changes to src/AddIns/DisplayBindings/Data/ICSharpCode.Data.EDMDesigner.Core.UI/Converters/IUITypeToBorderBrushConverter.cs

  • Committer: sk
  • Date: 2011-09-10 05:17:57 UTC
  • Revision ID: halega@halega.com-20110910051757-qfouz1llya9m6boy
4.1.0.7915 Release Candidate 1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
 
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
 
3
 
 
4
#region Usings
 
5
 
 
6
using System;
 
7
using System.Globalization;
 
8
using System.Windows.Data;
 
9
using System.Windows.Media;
 
10
using ICSharpCode.Data.EDMDesigner.Core.EDMObjects.Designer.CSDL.Type;
 
11
 
 
12
#endregion
 
13
 
 
14
namespace ICSharpCode.Data.EDMDesigner.Core.UI.Converters
 
15
{
 
16
    public class IUITypeToBorderBrushConverter : IValueConverter
 
17
    {
 
18
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 
19
        {
 
20
            var uiEntityType = value as UIEntityType;
 
21
            if (uiEntityType != null)
 
22
            {
 
23
                if (uiEntityType.BusinessInstance.Abstract)
 
24
                    return new DrawingBrush(new GeometryDrawing(Brushes.Blue, null, Geometry.Parse("M0,0 0,1 1,1 1,0Z M 1,1 2,1 2,2 1,2Z"))) { ViewportUnits = BrushMappingMode.Absolute, Viewport = new System.Windows.Rect(0, 0, 4, 4), TileMode = TileMode.FlipXY };
 
25
                return Brushes.Olive;
 
26
            }
 
27
            else if (value is UIComplexType)
 
28
                return Brushes.DarkOliveGreen;
 
29
            throw new NotImplementedException();
 
30
        }
 
31
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
 
32
        {
 
33
            throw new NotImplementedException();
 
34
        }
 
35
    }
 
36
}