示例#1
0
 public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     try
     {
         var v     = GuidParser.Convert(value);// as Guid;
         var param = parameter.ToString();
         return(v.GetObject(param)?.NameSearch);
     }
     catch
     {
         return(value);
     }
 }
示例#2
0
        public void PopulatePossibleValues()
        {
            // Get possible values
            PossibleValues.Clear();
            var type = GetTypeName(SelectedProeprty.PropertyType);
            HashSet <string> collections = new HashSet <string>();

            foreach (var item in Inputs)
            {
                var val = _SelectedProeprty.GetValue(item, null)?.ToString();
                if (val != null)
                {
                    if (type == "Guid")
                    {
                        try
                        {
                            var attributes = _SelectedProeprty.GetCustomAttribute(typeof(ColumnAttribute)) as ColumnAttribute;
                            var option     = attributes.Options;
                            if (string.IsNullOrWhiteSpace(option) || option.Contains(">") || string.IsNullOrWhiteSpace(val))
                            {
                                continue;
                            }
                            var link = DS.Generic(option)?.GetById(GuidParser.Convert(val));//, true) as IEnumerable<IDocument>;
                            if (link == null)
                            {
                                continue;
                            }
                            collections.Add(link?.Name);
                            StatusLabel = $"{_("Récupération des données")} - {link?.Name}";
                            NotifyOfPropertyChange("StatusLabel");
                        }
                        catch (Exception s)
                        {
                            DataHelpers.ShowMessage(s.Message);
                        }
                    }
                    else
                    {
                        collections.Add(val as string);
                    }
                }
            }
            PossibleValues.AddRange(collections);
            StatusLabel = _($"Términé");
            NotifyOfPropertyChange("StatusLabel");
            NotifyOfPropertyChange("PossibleValues");
        }
示例#3
0
 public Client()
 {
     Series = GuidParser.Convert((MyModuleBase())?.SeriesDefault);
 }