Ejemplo n.º 1
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is ProjectType type)
            {
                var descriptionFound = EnumDescriptions.TryGetValue(type, out var description);
                return(descriptionFound ? description : "Другое");
            }

            return("Неизвестно");
        }
Ejemplo n.º 2
0
        public void OnPageLoaded(object sender, RoutedEventArgs e)
        {
            PagesUtilities.DontFocusOnAnythingOnLoaded(sender, e);
            try
            {
                EnumDescriptions positive = new EnumDescriptions("Would you use this strain again?", "Rate the quality of the treatment:");
                PostQuestions.Items.Add(positive);
                questionDictionary[positive.q1] = "Don't know";
            }

            catch (Exception x)
            {
                AppDebug.Exception(x, "PostTreatment2 => OnPageLoaded");
            }
        }
Ejemplo n.º 3
0
        public SettingsWindow()
        {
            InitializeComponent();


            var navTypes = EnumDescriptions.GetNavigationTypes();

            cb_navTypes.ItemsSource   = navTypes;
            cb_navTypes.SelectedIndex = EnumDescriptions.GetIndex(navTypes, GlobalData.Settings.NavigationType);

            var searchEngines = EnumDescriptions.GetSearchEngines();

            cb_searchEngines.ItemsSource   = searchEngines;
            cb_searchEngines.SelectedIndex = EnumDescriptions.GetIndex(searchEngines, GlobalData.Settings.SearchEngine);

            var newPageBehaviors = EnumDescriptions.GetNewPageBehaviors();

            cb_newPageBehaviors.ItemsSource   = newPageBehaviors;
            cb_newPageBehaviors.SelectedIndex = EnumDescriptions.GetIndex(newPageBehaviors, GlobalData.Settings.NewPageBehavior);
        }
Ejemplo n.º 4
0
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var foundDescription = EnumDescriptions.FirstOrDefault(pair => pair.Value == value.ToString());

            return(foundDescription.Equals(default) ? ProjectType.Other : foundDescription.Key);