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

Last change on this file since 1918 was 1918, checked in by Paul Lelgemann, 11 years ago

+ Added introductory description for P2PEditor
o Extended description of KeySearcher to include info about distributed calculation using P2P

File size: 1001 bytes
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                return Visibility.Collapsed;
21            else
22                return Visibility.Visible;
23        }
24
25        public object ConvertBack(object value, Type targetType, object parameter,
26                                  CultureInfo culture)
27        {
28            throw new NotSupportedException();
29        }
30
31        #endregion
32    }
33}
Note: See TracBrowser for help on using the repository browser.