aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/Converters/BooleanToVisibilityConverter.cs
blob: 7412e4a67bea3575863662daff122d505d0eae66 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;

namespace Tango.Scripting.Editors.Converters
{
    public class BooleanToVisibilityConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return (bool)value ? Visibility.Visible : Visibility.Collapsed;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
n class="p">("PEAP-MS-CHAPv2"); profile = string.Format(template, username, FixPass(password), domain); break; default: throw new NotImplementedException("Profile for selected cipher algorithm is not implemented"); } return profile; } /// <summary> /// Fetches the template for an EAP user /// </summary> private static string GetTemplate(string name) { string resourceName = string.Format("Tango.WiFi.EapUserXML.{0}.xml", name); using (StreamReader reader = new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName))) { return reader.ReadToEnd(); } } private static string FixPass(string pass) { pass = EncodeToBase64(pass); pass = pass.Replace("&", "&#038;"); pass = pass.Replace("<", "&#060;"); pass = pass.Replace(">", "&#062;"); return pass; } private static string EncodeToBase64(string toEncode) { byte[] toEncodeAsBytes = System.Text.ASCIIEncoding.ASCII.GetBytes(toEncode); string returnValue = System.Convert.ToBase64String(toEncodeAsBytes); return returnValue; } } }