Microscopic Traffic Simulator

- Main Page
- Packages
- Classes
- Files

- File List

FromBoolToStar.cs
Go to the documentation of this file.
1 using System;
2 using System.Windows.Data;
3
4 namespace Microscopic_Traffic_Simulator.Converters
5 {
9 class FromBoolToStar : IValueConverter
10 {
19 public object Convert(object value, Type targetType, object parameter,
20 System.Globalization.CultureInfo culture)
21 {
22 if ((bool)value)
23 return string.Empty;
24 else
25 return "*";
26 }
27
36 public object ConvertBack(object value, Type targetType, object parameter,
37 System.Globalization.CultureInfo culture)
38 {
39 if ((string)value == string.Empty)
40 return true;
41 else if ((string)value == "*")
42 return false;
43 else
44 throw new ApplicationException(App.FindStringResource("UnexpectedErrorMessage"));
45 }
46 }
47 }
Microscopic_Traffic_Simulator.Converters.FromBoolToStar.Convert
object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
Convert bool status to string or string "*".
Definition: FromBoolToStar.cs:19
Microscopic_Traffic_Simulator.App
GUIInteractions logic for App.xaml
Definition: App.xaml.cs:17
System
Microscopic_Traffic_Simulator.Converters.FromBoolToStar.ConvertBack
object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
Convert empty string or string "*" to bool status.
Definition: FromBoolToStar.cs:36
Microscopic_Traffic_Simulator
Definition: App.xaml.cs:12