Exemplo n.º 1
0
 public void Attach()
 {
     foreach (var dep in Dependencies)
     {
         dep.Successors.Set(this);
     }
     value = SL.FirstOrDefault(source);
 }
Exemplo n.º 2
0
 public void Attach()
 {
     if (!isAttached)
     {
         value = SL.FirstOrDefault(source);
         source.CollectionChanged += SourceCollectionChanged;
         isAttached = true;
     }
 }
Exemplo n.º 3
0
 private void SourceCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
 {
     if (e.Action == NotifyCollectionChangedAction.Reset ||
         (e.OldItems != null && e.OldStartingIndex <= 0) ||
         (e.NewItems != null && e.NewStartingIndex <= 0))
     {
         SetValue(SL.FirstOrDefault(source));
     }
 }
Exemplo n.º 4
0
        public INotificationResult Notify(IList <INotificationResult> sources)
        {
            var newValue = SL.FirstOrDefault(source);

            if (!EqualityComparer <TSource> .Default.Equals(value, newValue))
            {
                oldValue = value;
                value    = newValue;
                OnValueChanged();
                return(this);
            }

            return(UnchangedNotificationResult.Instance);
        }
Exemplo n.º 5
0
        //Note: currently the selected features are one select behind.
        //e.g on drawing the first region all the layers features are returned
        // on drawing the second region all the features matching the first region are returned etc..
        private void AttributeQueryHandler_End(object sender, MapActionHandlerEventArgs e)
        {
            IFeatureLayer l =
                Enumerable.FirstOrDefault(
                    Caster.Cast <IFeatureLayer>(
                        Processor.Where(Map.SelectedLayers, delegate(ILayer o) { return(o as IFeatureLayer != null); })));

            if (l != null)
            {
                FeatureDataView dv = new FeatureDataView(l.SelectedFeatures.Table);

                if (l.SelectedFeatures.AttributeFilter != null)
                {
                    dv.AttributeFilter =
                        (AttributeBinaryExpression)
                        l.SelectedFeatures.AttributeFilter.Clone();
                }

                if (l.SelectedFeatures.SpatialFilter != null)
                {
                    dv.SpatialFilter =
                        (SpatialBinaryExpression)
                        l.SelectedFeatures.SpatialFilter.Clone();
                }

                if (l.SelectedFeatures.OidFilter != null)
                {
                    dv.OidFilter =
                        (OidCollectionExpression)
                        l.SelectedFeatures.OidFilter.Clone();
                }

                if (l.SelectedFeatures.ViewDefinition != null)
                {
                    dv.ViewDefinition =
                        (FeatureQueryExpression)
                        l.SelectedFeatures.ViewDefinition.Clone();
                }


                QueryResultsTab tab = new QueryResultsTab(l.LayerName, dv);
                resultsTabControl.TabPages.Insert(0, tab);
                resultsTabControl.SelectedTab = tab;
            }
        }
Exemplo n.º 6
0
        private Boolean inOidFilter(FeatureDataRow feature)
        {
            if (!feature.HasOid)
            {
                return(false);
            }

            if (_viewDefinition == null || _viewDefinition.OidPredicate == null)
            {
                return(true);
            }

            // NOTE: This will get to be a performance problem due to the
            // poor structuring of the OID values. Consider creating a local,
            // sorted index where a binary search can be performed.
            IEnumerable oids = _viewDefinition.OidPredicate.OidValues;

            Int32 count = 0;

            if (Enumerable.FirstOrDefault(Caster.Cast <object>(oids)) == null) //jd:added explicit type param to allow compiliation in net3.5
            {
                return(true);
            }

            Object featureOid = feature.GetOid();

            Debug.Assert(featureOid != null);

            foreach (Object oid in oids)
            {
                if (featureOid.Equals(oid))
                {
                    return(true);
                }
            }

            return(false);
        }
Exemplo n.º 7
0
 private static WriteablePropertyDescriptor FindWritable(string columnName, IEnumerable <WriteablePropertyDescriptor> writables)
 {
     return(Enumerable.FirstOrDefault(writables, writable => writable.PropertyName.Equals(columnName)));
 }
Exemplo n.º 8
0
        // Searches all Players to find the next Player without a Joystick assigned
        private Player FindPlayerWithoutJoystick()
        {
            IList <Player> players = ReInput.players.Players;

            return(Enumerable.FirstOrDefault(players, player => player.controllers.joystickCount <= 0));
        }