Ejemplo n.º 1
0
        private void searchCriteriaItemRoot_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            var item = this.DataContext as ISqlSearch;

            var core = ((App)Application.Current).Core;

            this.IsSVO = core.IsSVOLanguage;

            this.disposables.Clear();

            if (item == null)
            {
                this.BackGroundColor = new SolidColorBrush(Colors.Gray);
                this.IsComplex       = false;
                this.Mode            = null;
                this.Property        = null;
            }
            else if (item.IsUnit)
            {
                this.BackGroundColor = (Brush)Application.Current.Resources["UnitSearchItemColor"];
                this.IsComplex       = false;

                var unit = (UnitSearch)item;

                var isVString = core.GetResourceString("IsV");

                unit.ObserveProperty(x => x.Property)
                .Select(x => x.GetPropertyLabel() + isVString)
                .Subscribe(x => this.Property = x)
                .AddTo(this.disposables);


                unit.ObserveProperty(x => x.Mode)
                .CombineLatest(unit.ObserveProperty(x => x.Property), (m, p) => p.GetCompareLabel(m))
                .Subscribe(x => this.Mode = x)
                .AddTo(this.disposables);
            }
            else
            {
                this.BackGroundColor = (Brush)Application.Current.Resources["ComplexSearchItemColor"];
                this.IsComplex       = true;

                this.Property = null;

                var pack = (ComplexSearch)item;

                pack.ObserveProperty(x => x.IsOr)
                .Select(x => FilePropertyManager.GetMatchLabel(x))
                .Subscribe(x => this.Mode = x)
                .AddTo(this.disposables);
            }



            //this.rootGrid.DataContext = null;
            //this.rootGrid.DataContext = item;
        }
Ejemplo n.º 2
0
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            var isOr = value as bool?;

            if (isOr.HasValue)
            {
                return(FilePropertyManager.GetMatchLabel(isOr.Value));
            }
            return("");
        }