internal static SearchOptionSegment CreateFromSearchOption(SearchOptionsItem item) { ISegmentPresenter<SearchOptionSegment> presenter = item as ISegmentPresenter<SearchOptionSegment>; if (presenter != null) { SearchOptionSegment segment = presenter.CreateSegment(); ObservableCollection<SegmentPart> parts = item.CurrentView.CreateSegmentValues(); segment.Parts = parts; return segment; } return null; }
private void PopulateItems() { SearchOptionsItem coordinates = new SearchOptionsItem() { Caption = "Coordinates :", CurrentView = new CoordinatesViewModel(), CanAdd = true, CanModify = false }; coordinates.PropertyChanged += SearchItem_PropertyChanged; SearchOptionsItem epoch = new SearchOptionsItem() { Caption = "Epoch :", CurrentView = new EpochViewModel(), CanAdd = true, CanModify = false, Kind = SearchOptionKind.Epoch }; epoch.PropertyChanged += SearchItem_PropertyChanged; SearchOptionsItem equinox = new SearchOptionsItem() { Caption = "Equinox", CurrentView = new EquinoxViewModel(), CanAdd = true, CanModify = false, Kind = SearchOptionKind.Equinox }; equinox.PropertyChanged += SearchItem_PropertyChanged; SearchOptionsItem radius = new SearchOptionsItem() { Caption = "Radius :", CurrentView = new RadiusViewModel(), CanAdd = true, CanModify = false, Kind = SearchOptionKind.Radius }; radius.PropertyChanged += SearchItem_PropertyChanged; SearchOptionsItem objectName = new SearchOptionsItem() { Caption = "Object name :", CurrentView = new ObjectNameViewModel(), CanAdd = true, CanModify = false, Kind = SearchOptionKind.ObjectName }; objectName.PropertyChanged += SearchItem_PropertyChanged; _items.Add(coordinates); _items.Add(epoch); _items.Add(equinox); _items.Add(radius); _items.Add(objectName); }
private void UpdateSearchOptionSegment(SearchOptionsItem searchOption) { searchOption.CurrentView.UpdateSegmentValues(); NotifyPropertyChanged(this, new PropertyChangedEventArgs("Segments")); }
private void AddSearchOptionSegment(SearchOptionsItem searchOption) { SearchOptionSegment segment = SearchHelper.CreateFromSearchOption(searchOption); searchOption.CanModify = true; this._segments.Add(segment); NotifyPropertyChanged(this, new PropertyChangedEventArgs("Segments")); }