source: trunk/CrypPlugins/WorkspaceManager/View/Converter/ConnectorBindingConverter.cs @ 1991

Last change on this file since 1991 was 1991, checked in by matkovic, 11 years ago

-fixed pathfinding
-fixed line drawing
-added Colorpicker
-fixed lock/unlock at TextInputWrapper
-feature: Background and TextForeground in TextInputWrapper added
-fixed a issue With loading and such
-WorkspaceModel doesn't throw exception anymore (Samples functional again)
-fixed some Styles
-Startable implemented and loaded right
-Startable Logo moved

File size: 1.6 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Windows.Data;
6using System.Windows;
7using System.Globalization;
8using WorkspaceManager.View.Container;
9
10namespace WorkspaceManager.View.Converter
11{
12    public class ConnectorBindingConverter : IMultiValueConverter
13    {
14        #region IMultiValueConverter Members
15
16        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
17        {
18            ConnectorView connector = (ConnectorView)parameter;
19            double X = System.Convert.ToDouble(values[0]);
20            double Y = System.Convert.ToDouble(values[1]);
21            double Height = System.Convert.ToDouble(values[2]);
22            double Width = System.Convert.ToDouble(values[3]);
23
24            switch (connector.Orientation)
25            {
26                case ConnectorOrientation.West:
27                    return new Point(X , Y + Height / 2);
28                case ConnectorOrientation.East:
29                    return new Point(X + Width, Y + Height / 2);
30                case ConnectorOrientation.North:
31                    return new Point(X + Width / 2, Y);
32                case ConnectorOrientation.South:
33                    return new Point(X + Width / 2, Y + Height);
34            }
35
36            return new Point(0, 0);
37        }
38
39        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
40        {
41            throw new NotImplementedException();
42        }
43
44        #endregion
45    }
46}
Note: See TracBrowser for help on using the repository browser.