Ignore:
Timestamp:
Jun 20, 2010, 10:27:22 PM (12 years ago)
Author:
Paul Lelgemann
Message:

o Work on the distributed KeySearcher presentation

Location:
trunk/CrypPlugins/KeySearcher/Converter
Files:
1 added
4 copied

Legend:

Unmodified
Added
Removed
  • trunk/CrypPlugins/KeySearcher/Converter/FalseToVisibleConverter.cs

    r1677 r1682  
    44using System.Windows.Data;
    55
    6 namespace Cryptool.P2PEditor.Converters
     6namespace KeySearcherConverter
    77{
    88    [ValueConversion(typeof (bool), typeof (Visibility))]
    9     public class ConnectivityToVisibilityConverter : IValueConverter
     9    public class FalseToVisibleConverter : IValueConverter
    1010    {
    1111        #region IValueConverter Members
     
    1515        {
    1616            if (targetType != typeof (Visibility))
    17                 throw new InvalidOperationException("The target must be a Visibility");
     17                throw new InvalidOperationException("The target must be of Visibility");
    1818
    1919            if ((bool) value)
    2020            {
    2121                return Visibility.Hidden;
    22             } else
    23             {
    24                 return Visibility.Visible;
    2522            }
     23
     24            return Visibility.Visible;
    2625        }
    2726
  • trunk/CrypPlugins/KeySearcher/Converter/TimeSpanToRoundedStringConverter.cs

    r1677 r1682  
    11using System;
    22using System.Globalization;
    3 using System.Windows;
    43using System.Windows.Data;
    54
    6 namespace Cryptool.P2PEditor.Converters
     5namespace KeySearcherConverter
    76{
    8     [ValueConversion(typeof (bool), typeof (Visibility))]
    9     public class ConnectivityToVisibilityConverter : IValueConverter
     7    [ValueConversion(typeof (TimeSpan), typeof (string))]
     8    public class TimeSpanToRoundedStringConverter : IValueConverter
    109    {
    1110        #region IValueConverter Members
     
    1413                              CultureInfo culture)
    1514        {
    16             if (targetType != typeof (Visibility))
    17                 throw new InvalidOperationException("The target must be a Visibility");
     15            if (!(value is TimeSpan))
     16            {
     17                return "-";
     18            }
    1819
    19             if ((bool) value)
    20             {
    21                 return Visibility.Hidden;
    22             } else
    23             {
    24                 return Visibility.Visible;
    25             }
     20            var timeSpan = (TimeSpan) value;
     21            return String.Format("{0}:{1}:{2}.{3}",
     22                                 timeSpan.Hours,
     23                                 timeSpan.Minutes,
     24                                 timeSpan.Seconds,
     25                                 Math.Round((decimal) timeSpan.Milliseconds, 3));
     26
    2627        }
    2728
  • trunk/CrypPlugins/KeySearcher/Converter/TrueToVisibleConverter.cs

    r1677 r1682  
    44using System.Windows.Data;
    55
    6 namespace Cryptool.P2PEditor.Converters
     6namespace KeySearcherConverter
    77{
    88    [ValueConversion(typeof (bool), typeof (Visibility))]
    9     public class ConnectivityToVisibilityConverter : IValueConverter
     9    public class TrueToVisibleConverter : IValueConverter
    1010    {
    1111        #region IValueConverter Members
     
    1515        {
    1616            if (targetType != typeof (Visibility))
    17                 throw new InvalidOperationException("The target must be a Visibility");
     17                throw new InvalidOperationException("The target must be of Visibility");
    1818
    1919            if ((bool) value)
    2020            {
    21                 return Visibility.Hidden;
    22             } else
    23             {
    2421                return Visibility.Visible;
    2522            }
     23
     24            return Visibility.Hidden;
    2625        }
    2726
  • trunk/CrypPlugins/KeySearcher/Converter/TrueToVisibleOrCollapsedConverter.cs

    r1677 r1682  
    44using System.Windows.Data;
    55
    6 namespace Cryptool.P2PEditor.Converters
     6namespace KeySearcherConverter
    77{
    88    [ValueConversion(typeof (bool), typeof (Visibility))]
    9     public class ConnectivityToVisibilityConverter : IValueConverter
     9    public class TrueToVisibleOrCollapsedConverter : IValueConverter
    1010    {
    1111        #region IValueConverter Members
     
    1515        {
    1616            if (targetType != typeof (Visibility))
    17                 throw new InvalidOperationException("The target must be a Visibility");
     17                throw new InvalidOperationException("The target must be of Visibility");
    1818
    1919            if ((bool) value)
    2020            {
    21                 return Visibility.Hidden;
    22             } else
    23             {
    2421                return Visibility.Visible;
    2522            }
     23
     24            return Visibility.Collapsed;
    2625        }
    2726
Note: See TracChangeset for help on using the changeset viewer.