source: trunk/CrypPlugins/P2PEditor/Converters/ConnectivityToVisibilityConverter.cs @ 1619

Last change on this file since 1619 was 1619, checked in by Paul Lelgemann, 12 years ago

+ P2PEditor: new tab, which "invites" to connect to the network

File size: 1.0 KB
Line 
1using System;
2using System.Globalization;
3using System.Windows;
4using System.Windows.Data;
5
6namespace Cryptool.P2PEditor.Converters
7{
8    [ValueConversion(typeof (bool), typeof (Visibility))]
9    public class ConnectivityToVisibilityConverter : IValueConverter
10    {
11        #region IValueConverter Members
12
13        public object Convert(object value, Type targetType, object parameter,
14                              CultureInfo culture)
15        {
16            if (targetType != typeof (Visibility))
17                throw new InvalidOperationException("The target must be a Visibility");
18
19            if ((bool) value)
20            {
21                return Visibility.Hidden;
22            } else
23            {
24                return Visibility.Visible;
25            }
26        }
27
28        public object ConvertBack(object value, Type targetType, object parameter,
29                                  CultureInfo culture)
30        {
31            throw new NotSupportedException();
32        }
33
34        #endregion
35    }
36}
Note: See TracBrowser for help on using the repository browser.