public override void SetModel (IListModel<TrackInfo> value, double vpos) { //Console.WriteLine ("TrackListView.SetModel for {0} with vpos {1}", value, vpos); if (value != null) { Source source = ServiceManager.SourceManager.ActiveSource; ColumnController controller = null; // Get the controller from this source, or its parent(s) if it doesn't have one while (source != null && controller == null) { controller = source.Properties.Get<ColumnController> ("TrackView.ColumnController"); if (controller == null) { string controller_xml = source.Properties.Get<string> ("TrackView.ColumnControllerXml"); if (controller_xml != null) { controller = new XmlColumnController (controller_xml); source.Properties.Remove ("TrackView.ColumnControllerXml"); source.Properties.Set<ColumnController> ("TrackView.ColumnController", controller); } } source = source.Parent; } controller = controller ?? default_column_controller; PersistentColumnController persistent_controller = controller as PersistentColumnController; if (persistent_controller != null) { //Hyena.Log.InformationFormat ("Setting controller source to {0}", ServiceManager.SourceManager.ActiveSource.Name); persistent_controller.Source = ServiceManager.SourceManager.ActiveSource; } ColumnController = controller; } base.SetModel (value, vpos); }
public BigList(IListModel provider) { this.provider = provider; RefAccessible ().Role = Atk.Role.List; hAdjustment = new Gtk.Adjustment (0, 0, currentWidth, 1, 1, 1); hAdjustment.ValueChanged += new EventHandler (HAdjustmentValueChangedHandler); vAdjustment = new Gtk.Adjustment (0, 0, provider.Rows, 1, 1, 1); vAdjustment.ValueChanged += new EventHandler (VAdjustmentValueChangedHandler); layout = new Pango.Layout (PangoContext); ExposeEvent += new ExposeEventHandler (ExposeHandler); ButtonPressEvent += new ButtonPressEventHandler (ButtonPressEventHandler); ButtonReleaseEvent += new ButtonReleaseEventHandler (ButtonReleaseEventHandler); KeyPressEvent += new KeyPressEventHandler (KeyHandler); Realized += new EventHandler (RealizeHandler); Unrealized += new EventHandler (UnrealizeHandler); ScrollEvent += new ScrollEventHandler (ScrollHandler); SizeAllocated += new SizeAllocatedHandler (SizeAllocatedHandler); MotionNotifyEvent += new MotionNotifyEventHandler (MotionNotifyEventHandler); AddEvents ((int) EventMask.ButtonPressMask | (int) EventMask.ButtonReleaseMask | (int) EventMask.KeyPressMask | (int) EventMask.PointerMotionMask); CanFocus = true; style_widget = new EventBox (); style_widget.StyleSet += new StyleSetHandler (StyleHandler); layout.SetMarkup (ellipsis); layout.GetPixelSize (out ellipsis_width, out line_height); layout.SetMarkup ("n"); layout.GetPixelSize (out en_width, out line_height); layout.SetMarkup ("W"); layout.GetPixelSize (out en_width, out line_height); old_width = Allocation.Width; }
public static IGrid <TEntity> From <TEntity>(this IGrid grid, IListModel <TEntity> model) { return(grid .From(model.Entities) .SortedBy(model.CurrentSort.Name, model.CurrentSort.IsAscending) .Paging(model.CurrentPage, model.TotalPages, model.PageSize)); }
private void UpdateDocumentNumbers() { for (int i = 0; i < allStartNumbersPerLocation.Count; i++) { foreach (var operation in allStartNumbersPerLocation[i].Value) { operation.StartNumber = (long)(spbRangeStart.Value + i * spbRangeSize.Value); } } long maxId = Operation.GetMaxId(); long maxLocations = (long)((maxId - spbRangeStart.Value) / spbRangeSize.Value); lblMaxLocationsValue.SetText(maxLocations.ToString("N", formatBigNumber)); try { if (UpdateDocumentsUsage(maxId)) { return; } IListModel model = gridDocumentNumbers.Model; gridDocumentNumbers.Model = null; gridDocumentNumbers.Model = model; } catch (ArgumentOutOfRangeException) { } }
public ListController(IListViewer viewer, IListModel model) { this.viewer = viewer; this.model = model; model.bind(viewer.updateEvent); }
public virtual void EndCellEdit(object newValue) { ListView parentListView = parentColumn.ParentListView; CellPosition pos = parentListView.EditedCell; CellEditEndEventArgs args = new CellEditEndEventArgs(pos.Column, pos.Row, newValue); IListModel model = parentListView.Model; OnCellEditEnd(args); if (string.IsNullOrEmpty(propertyName)) { try { model [pos.Row] = args.NewValue; } catch (ArgumentOutOfRangeException) { throw new CellNotValidException(pos.Row); } } else { try { model [pos.Row, propertyName] = args.NewValue; } catch (ArgumentOutOfRangeException) { throw new CellNotValidException(pos.Row, propertyName); } } }
protected void Init(bool letUpdateList = true) { model = new ListModel <IEventModel>(); List <IItemModelAdapter <IEventModel> > items = new List <IItemModelAdapter <IEventModel> >(); items.Add(new ItemModelAdapterForPassive <IEventModel>(new EventModel(235235, "Ivanovo", DateTime.Now, "Ivanovo station. 5 min."))); items.Add(new ItemModelAdapterForPassive <IEventModel>(new EventModel(945853, "Airport", DateTime.Now, "Airport station. 15 min."))); items.Add(new ItemModelAdapterForPassive <IEventModel>(new EventModel(124590, "Lake", DateTime.Now, "Lake station. 5 min. Temporarily closed."))); items.Add(new ItemModelAdapterForPassive <IEventModel>(new EventModel(744935, "Central station.", DateTime.Now, "Central station. 7 min."))); model.AddItems(items); var creator = new EventViewModelCreator(); var eventModelCreator = new EventModelAdapterCreator(); var vm = new ListViewModel <IEventModel, IEventViewModel, IDetailEventViewModel>(model, creator, eventModelCreator); vm.LetUpdate = letUpdateList; viewModel = vm; itemsVM = viewModel.ItemsVM; airportVM = itemsVM.FirstOrDefault(itmVM => itmVM.DataViewModel.Name == "Airport"); }
public static IEnumerable <T> AsEnumerable <T>(this IListModel <T> model) { for (int i = 0; i < model.Count; i++) { yield return(model[i]); } }
public void SetModels(TrackListModel track, IListModel <ArtistInfo> artist, IListModel <AlbumInfo> album, IListModel <QueryFilterInfo <string> > genre) { SetModel(track); SetModel(artist); SetModel(album); SetModel(genre); }
public void SetModels (TrackListModel track, IListModel<ArtistInfo> artist, IListModel<AlbumInfo> album, IListModel<QueryFilterInfo<string>> genre) { SetModel (track); SetModel (artist); SetModel (album); // SetModel (genre); }
private void SelectLocation(long locationId) { IListModel <Location> locationsModel = (IListModel <Location>)gridLocations.Model; int index = locationsModel.FindIndex(l => l.Id == locationId); gridLocations.Selection.Clear(); gridLocations.Selection.Select(index); gridLocations.ScrollToV(index); }
public override void SetModel(IListModel <TrackInfo> value, double vpos) { //Console.WriteLine ("TrackListView.SetModel for {0} with vpos {1}", value, vpos); if (value != null) { Source active_source = ServiceManager.SourceManager.ActiveSource; Source source = active_source; ColumnController controller = null; // Get the controller from this source, or its parent(s) if it doesn't have one while (source != null && controller == null) { controller = source.Properties.Get <ColumnController> ("TrackView.ColumnController"); if (controller == null) { string controller_xml = source.Properties.Get <string> ("TrackView.ColumnControllerXml"); if (controller_xml != null) { controller = new XmlColumnController(controller_xml); source.Properties.Remove("TrackView.ColumnControllerXml"); source.Properties.Set <ColumnController> ("TrackView.ColumnController", controller); } } source = source.Parent; } controller = controller ?? default_column_controller; PersistentColumnController persistent_controller = controller as PersistentColumnController; if (persistent_controller != null) { //Hyena.Log.InformationFormat ("Setting controller source to {0}", ServiceManager.SourceManager.ActiveSource.Name); persistent_controller.Source = active_source; } var sort_field = active_source.Properties.Get <string> ("TrackListSortField"); if (sort_field != null) { var column = controller.FirstOrDefault(c => { var s = c as SortableColumn; return(s != null && s.Field.Name == sort_field); }) as SortableColumn; if (column != null) { column.Visible = true; column.SortType = active_source.Properties.Get <bool> ("TrackListSortAscending") ? Hyena.Data.SortType.Ascending : Hyena.Data.SortType.Descending; controller.DefaultSortColumn = column; } } ColumnController = controller; } base.SetModel(value, vpos); }
/// <summary> /// /// </summary> /// <param name="model"></param> /// <param name="creator"></param> /// <param name="itemModelCreator"></param> /// <param name="updateInterval">интервал обновления в секундах</param> public ListViewModelWithTimer(IListModel <DataModelType> model, IViewModelCreator <DataModelType, DataViewModelType, DataDetailViewModelType> creator, IItemModelAdapterCreator <DataModelType> itemModelCreator, int updateInterval = 5) : base(model, creator, itemModelCreator) { timer = new System.Windows.Threading.DispatcherTimer(); timer.Tick += Timer_Tick; timer.Interval = new TimeSpan(0, 0, updateInterval); timer.Start(); }
protected void SetModel <T> (IListView <T> view, IListModel <T> model) { if (model == null) { view.SetModel(null); return; } view.SetModel(model, 0.0); }
public virtual void SetModel(IListModel <T> value, double vpos) { if (model == value) { return; } if (model != null) { model.Cleared -= OnModelClearedHandler; model.Reloaded -= OnModelReloadedHandler; } model = value; if (model != null) { model.Cleared += OnModelClearedHandler; model.Reloaded += OnModelReloadedHandler; selection_proxy.Selection = model.Selection; IsEverReorderable = model.CanReorder; } if (ViewLayout != null) { ViewLayout.Model = Model; } ISortable sortable = model as ISortable; if (sortable != null && ColumnController != null) { ISortableColumn sort_column = ColumnController.SortColumn ?? ColumnController.DefaultSortColumn; if (sort_column != null) { if (sortable.Sort(sort_column)) { model.Reload(); } RecalculateColumnSizes(); RegenerateColumnCache(); InvalidateHeader(); IsReorderable = sortable.SortColumn == null || sortable.SortColumn.SortType == SortType.None; } } RefreshViewForModel(vpos); var handler = ModelChanged; if (handler != null) { handler(this, EventArgs.Empty); } }
protected void SetModel <T> (IListModel <T> model) { var view = FindListView <T> (); if (view != null) { SetModel(view, model); } else { Hyena.Log.DebugFormat("Unable to find view for model {0}", model); } }
public override void BindListItem(int rowIndex) { base.BindListItem(rowIndex); ListView parentListView = parentColumn.ParentListView; IListModel model = parentListView.Model; try { rowObject = model [rowIndex] as Item; } catch (ArgumentOutOfRangeException) { throw new CellNotValidException(rowIndex); } }
public override void BindListItem(int rowIndex) { base.BindListItem(rowIndex); ListView parentListView = parentColumn.ParentListView; IListModel model = parentListView.Model; try { progressValue = (double)model [rowIndex, progressPropertyName]; } catch (ArgumentOutOfRangeException) { throw new CellNotValidException(rowIndex); } }
public override void SetModel (IListModel<TrackInfo> value, double vpos) { //Console.WriteLine ("TrackListView.SetModel for {0} with vpos {1}", value, vpos); if (value != null) { Source active_source = ServiceManager.SourceManager.ActiveSource; Source source = active_source; ColumnController controller = null; // Get the controller from this source, or its parent(s) if it doesn't have one while (source != null && controller == null) { controller = source.Properties.Get<ColumnController> ("TrackView.ColumnController"); if (controller == null) { string controller_xml = source.Properties.Get<string> ("TrackView.ColumnControllerXml"); if (controller_xml != null) { controller = new XmlColumnController (controller_xml); source.Properties.Remove ("TrackView.ColumnControllerXml"); source.Properties.Set<ColumnController> ("TrackView.ColumnController", controller); } } source = source.Parent; } controller = controller ?? default_column_controller; PersistentColumnController persistent_controller = controller as PersistentColumnController; if (persistent_controller != null) { //Hyena.Log.InformationFormat ("Setting controller source to {0}", ServiceManager.SourceManager.ActiveSource.Name); persistent_controller.Source = active_source; } var sort_field = active_source.Properties.Get<string> ("TrackListSortField"); if (sort_field != null) { var column = controller.FirstOrDefault (c => { var s = c as SortableColumn; return s != null && s.Field.Name == sort_field; }) as SortableColumn; if (column != null) { column.Visible = true; column.SortType = active_source.Properties.Get<bool> ("TrackListSortAscending") ? Hyena.Data.SortType.Ascending : Hyena.Data.SortType.Descending; controller.DefaultSortColumn = column; } } ColumnController = controller; } base.SetModel (value, vpos); }
private void GetNewEntities() { IListModel <T> oldEntities = entities; GetAllEntities(); grid.Model = entities; IDisposable disposable = oldEntities as IDisposable; if (disposable != null) { disposable.Dispose(); } }
public ActionResult Edit(EditListViewModel editList, int edit) { if (editList.AccountIds == null) { ModelState.AddModelError("Members", "The list must contain at least one member."); return(this.View("_EditListModal", editList)); } else { // TODO: This is NOT correct. There should be *TWO* distinct methods Edit and Create. //TODO : Check whether or not currentAccount is authorized to edit this list IListModel list = null; list = edit == 0 ? this.Storage.Lists.Create( this.CurrentAccount, editList.ListName, editList.ListDescription, !editList.ListPublic) : this.Storage.Lists.Find(editList.ListId); if (list == null) { throw new HttpException((int)HttpStatusCode.NotFound, "The list doesn't exists."); } try { list.Name = editList.ListName; list.Description = editList.ListDescription; list.IsPrivate = !editList.ListPublic; list.Members.Clear(); foreach (var member in editList.AccountIds) { IAccountModel account = this.Storage.Accounts.Find(member); list.Members.Add(account); } this.Storage.SaveChanges(); return(this.RedirectToAction("Index", "Home")); } catch (Models.Storage.AccountNotFoundException ex) { if (edit == 0) { this.Storage.Lists.Delete(list); } throw new HttpException((int)HttpStatusCode.NotFound, ex.Message); } catch (Tigwi.Storage.Library.IsPersonnalList ex) { return(this.RedirectToAction("Index", "Home", new { error = ex.Message })); } } }
int currentWidth = 50; // pixels public BigList(IListModel provider) { this.provider = provider; //Accessibility RefAccessible().Role = Atk.Role.List; hAdjustment = new Gtk.Adjustment(0, 0, currentWidth, 1, 1, 1); hAdjustment.ValueChanged += new EventHandler(HAdjustmentValueChangedHandler); vAdjustment = new Gtk.Adjustment(0, 0, provider.Rows, 1, 1, 1); vAdjustment.ValueChanged += new EventHandler(VAdjustmentValueChangedHandler); layout = new Pango.Layout(PangoContext); ExposeEvent += new ExposeEventHandler(ExposeHandler); ButtonPressEvent += new ButtonPressEventHandler(ButtonPressEventHandler); ButtonReleaseEvent += new ButtonReleaseEventHandler(ButtonReleaseEventHandler); KeyPressEvent += new KeyPressEventHandler(KeyHandler); Realized += new EventHandler(RealizeHandler); Unrealized += new EventHandler(UnrealizeHandler); ScrollEvent += new ScrollEventHandler(ScrollHandler); SizeAllocated += new SizeAllocatedHandler(SizeAllocatedHandler); MotionNotifyEvent += new MotionNotifyEventHandler(MotionNotifyEventHandler); AddEvents((int)EventMask.ButtonPressMask | (int)EventMask.ButtonReleaseMask | (int)EventMask.KeyPressMask | (int)EventMask.PointerMotionMask); CanFocus = true; style_widget = new EventBox(); style_widget.StyleSet += new StyleSetHandler(StyleHandler); // // Compute the height and ellipsis width of the font, // and the en_width for our ellipsizing algorithm // layout.SetMarkup(ellipsis); layout.GetPixelSize(out ellipsis_width, out line_height); layout.SetMarkup("n"); layout.GetPixelSize(out en_width, out line_height); layout.SetMarkup("W"); layout.GetPixelSize(out en_width, out line_height); old_width = Allocation.Width; }
public ActionResult Follow(Guid id) { try { IAccountModel account = this.Storage.Accounts.Find(id); //Todo redirect to a dedicated view IListModel list = this.Storage.Lists.Create(CurrentAccount, account.Name, "My friend " + account.Name, false); list.Members.Add(account); this.Storage.SaveChanges(); return(Json(new { ok = true })); } catch (AccountNotFoundException ex) { throw new HttpException((int)HttpStatusCode.NotFound, ex.Message); } }
protected void SetModel <T> (IListView <T> view, IListModel <T> model) { if (view.Model != null) { model_positions[view.Model] = view.Vadjustment != null ? view.Vadjustment.Value : 0; } if (model == null) { view.SetModel(null); return; } if (!model_positions.ContainsKey(model)) { model_positions[model] = 0.0; } view.SetModel(model, model_positions[model]); }
public override void SetModel(IListModel <TrackInfo> value, double vpos) { //Console.WriteLine ("TrackListView.SetModel for {0} with vpos {1}", value, vpos); if (value != null) { Source source = ServiceManager.SourceManager.ActiveSource; ColumnController controller = null; // Get the controller from this source, or its parent(s) if it doesn't have one while (source != null && controller == null) { controller = source.Properties.Get <ColumnController> ("TrackView.ColumnController"); if (controller == null) { string controller_xml = source.Properties.Get <string> ("TrackView.ColumnControllerXml"); if (controller_xml != null) { controller = new XmlColumnController(controller_xml); source.Properties.Remove("TrackView.ColumnControllerXml"); source.Properties.Set <ColumnController> ("TrackView.ColumnController", controller); } } source = source.Parent; } controller = controller ?? default_column_controller; PersistentColumnController persistent_controller = controller as PersistentColumnController; if (persistent_controller != null) { //Hyena.Log.InformationFormat ("Setting controller source to {0}", ServiceManager.SourceManager.ActiveSource.Name); persistent_controller.Source = ServiceManager.SourceManager.ActiveSource; } ColumnController = controller; } base.SetModel(value, vpos); }
public ActionResult Create(AccountCreationViewModel accountCreation) { if (ModelState.IsValid) { try { var newAccount = this.Storage.Accounts.Create(CurrentUser, accountCreation.Name, accountCreation.Description); this.CurrentAccount = newAccount; IListModel list = this.Storage.Lists.Create(newAccount, newAccount.Name, "Personal list of " + newAccount.Name, false); list.Members.Add(newAccount); this.Storage.SaveChanges(); return(this.RedirectToAction("Create", accountCreation)); } catch (DuplicateAccountException ex) { throw new HttpException(404, ex.Message); } } return(this.PartialView("_CreateAccountModal", accountCreation)); }
public virtual void BindListItem(int rowIndex) { ListView parentListView = parentColumn.ParentListView; IListModel model = parentListView.Model; if (string.IsNullOrEmpty(propertyName)) { try { boundObject = model [rowIndex]; } catch (ArgumentOutOfRangeException) { throw new CellNotValidException(rowIndex); } } else { try { boundObject = model [rowIndex, propertyName]; } catch (ArgumentOutOfRangeException) { throw new CellNotValidException(rowIndex, propertyName); } } }
public ListViewModel(IListModel <DataModelType> model, IViewModelCreator <DataModelType, DataViewModelType, DataDetailViewModelType> creator, IItemModelAdapterCreator <DataModelType> itemModelCreator) { if (creator == null) { throw new ArgumentNullException("creator can't be null"); } _creator = creator; if (itemModelCreator == null) { throw new ArgumentNullException("itemModelCreator can't be null"); } _itemModelCreator = itemModelCreator; if (model == null) { throw new ArgumentNullException("model can't be null"); } _model = model; _model.Updated += OnUpdate; var itemViewModels = GetItemViewModels(_model.GetItems()); UpdateList(itemViewModels); AddItemCommand = new AddItemCommand <DataModelType, DataViewModelType, DataDetailViewModelType>(this); DeleteItemCommand = new DeleteItemCommand <DataModelType, DataViewModelType, DataDetailViewModelType>(this); EditListCommand = new EditListCommand <DataModelType, DataViewModelType, DataDetailViewModelType>(this); SaveListCommand = new SaveListCommand <DataModelType, DataViewModelType, DataDetailViewModelType>(this); SelectItemCommand = new SelectItemCommand <DataModelType, DataViewModelType, DataDetailViewModelType>(this); UpdateListCommand = new UpdateListCommand <DataModelType, DataViewModelType, DataDetailViewModelType>(this); addedAndDelatedItems = new Dictionary <IItemModelAdapter <DataModelType>, ChangeStatus>(); IsSaved = true; }
public void SetSource(DatabaseSource source) { if (album_model != null) { album_model.Reloaded -= OnModelReloaded; album_model = null; } foreach (IListModel model in source.CurrentFilters) { album_model = model as IListModel <AlbumInfo>; if (album_model != null) { break; } } if (album_model != null) { album_model.Reloaded += OnModelReloaded; } QueueRelayout(); }
public ActionResult Register(RegisterViewModel registerViewModel) { if (ModelState.IsValid) { try { var hashedPass = Auth.PasswordAuth.HashPassword(registerViewModel.Password); // IUserRepository::Create creates a main account var newUser = this.Storage.Users.Create(registerViewModel.Login, registerViewModel.Email, hashedPass); this.AuthenticateUser(newUser, registerViewModel.RememberMe); this.CurrentAccount = newUser.MainAccount; IListModel list = this.Storage.Lists.Create(CurrentAccount, CurrentAccount.Name, "Personal list of " + CurrentAccount.Name, false); list.Members.Add(CurrentAccount); var tigwiAccount = this.Storage.Accounts.Find("Tigwi"); IListModel listTigwi = this.Storage.Lists.Create(CurrentAccount, "Tigwi", "Welcome !", true); listTigwi.Members.Add(tigwiAccount); listTigwi.Followers.Add(CurrentAccount); this.Storage.SaveChanges(); return(this.RedirectToAction("Index", "Home")); } catch (DuplicateUserException ex) { // TODO: We need more granularity (login failed ? email failed ? propositions ?) ModelState.AddModelError("Login", ex.Message); } catch (DuplicateAccountException ex) { ModelState.AddModelError("Login", ex.Message); } } // Somthing went wrong, display register page again return(this.View(registerViewModel)); }
public override bool SetSource(ISource source) { DatabaseSource track_source = source as DatabaseSource; if (track_source == null) { return(false); } base.source = source; SetModel(track_view, track_source.TrackModel); foreach (IListModel model in track_source.CurrentFilters) { IListModel <QueryFilterInfo <string> > artist_model = model as IListModel <QueryFilterInfo <string> >; if (artist_model != null) { SetModel(artist_view, artist_model); } } return(true); }
public void Configure_IList() { SutEngine.Configure<IListModel>() .For(x => x.Children, x => x.MatchUsing(y => y.Id)); var oldModel = new IListModel() { Id = 1, Children = new List<GrandChildModel> { new GrandChildModel() { Id = 100, Name = "Name 1", Value = 100 }, new GrandChildModel() { Id = 200, Name = "Name 2", Value = 200 } }, }; var newModel = new IListModel() { Id = 1, Children = new List<GrandChildModel> { new GrandChildModel() { Id = 100, Name = "Name 1", Value = 100 }, new GrandChildModel() { Id = 300, Name = "Name 3", Value = 300 } }, }; var diff = SutEngine.Compare(oldModel, newModel); Assert.AreEqual(6, diff.Count); }
public bool Remove(IListModel item) { return this.InternalDictionary.Remove(item.Id); }
public void Add(IListModel item) { this.InternalDictionary.Add( item.Id, item as StorageListModel ?? this.InternalStorage.InternalLists.InternalFind(item.Id)); }
public bool Contains(IListModel item) { return this.InternalDictionary.ContainsKey(item.Id); }
public void Reload(IListModel reloadTrigger) { if (cache == null) { Log.WarningFormat ("Called Reload on {0} for source {1} but cache is null; Did you forget to call AfterInitialized () in your DatabaseSource ctor?", this, source == null ? "null source!" : source.Name); return; } lock (this) { GenerateUserQueryFragment (); UpdateUnfilteredAggregates (); cache.SaveSelection (); List<IFilterListModel> reload_models = new List<IFilterListModel> (); bool found = (reloadTrigger == null); foreach (IFilterListModel filter in source.CurrentFilters) { if (found) { if (filter != null) { reload_models.Add (filter); } } else if (filter == reloadTrigger) { found = true; } } if (reload_models.Count == 0) { ReloadWithFilters (true); } else { ReloadWithoutFilters (); foreach (IFilterListModel model in reload_models) { model.Reload (false); } bool have_filters = false; foreach (IFilterListModel filter in source.CurrentFilters) { have_filters |= !filter.Selection.AllSelected; } // Unless both artist/album selections are "all" (eg unfiltered), reload // the track model again with the artist/album filters now in place. if (have_filters) { ReloadWithFilters (true); } } cache.UpdateAggregates (); cache.RestoreSelection (); if (SelectionAggregatesHandler != null) { cache.UpdateSelectionAggregates (SelectionAggregatesHandler); } filtered_count = cache.Count; OnReloaded (); // Trigger these after the track list, b/c visually it's more important for it to update first foreach (IFilterListModel model in reload_models) { model.RaiseReloaded (); } } }
public void CopyTo(IListModel[] array, int arrayIndex) { if (array == null) { throw new ArgumentNullException("array"); } if (array.Length + arrayIndex > this.InternalDictionary.Count) { throw new ArgumentOutOfRangeException("arrayIndex"); } var i = arrayIndex; foreach (var model in this.InternalDictionary.Values) { array[i++] = model; } }
public bool Remove(IListModel item) { return(this.InternalDictionary.Remove(item.Id)); }
public bool Contains(IListModel item) { return(this.InternalDictionary.ContainsKey(item.Id)); }
public void Compare_List_With_Null() { SutEngine.Configure<IListModel>() .For(x => x.Children, x => x.MatchUsing(y => y.Id)); var oldModel = new IListModel() { Id = 1, Children = null, }; var newModel = new IListModel() { Id = 1, Children = new List<GrandChildModel>() { new GrandChildModel() { Id = 100, Name = "Name", Value = 25, } } }; var diff = SutEngine.Compare(oldModel, newModel); Assert.AreEqual(3, diff.Count()); }