public ItemObservableCollection <T> Duplicate() { ItemObservableCollection <T> result = new ItemObservableCollection <T>(); foreach (T item in this.Items) { result.Add(item); } return(result); }
public Journey(Journey other) { FromDateTime = other.FromDateTime; ToDateTime = other.ToDateTime; Weather = other.Weather; Note = other.Note; Bivouac = new Bivouac(other.Bivouac); BorderCrossing = new BorderCrossing(other.BorderCrossing); IncludeBorderCrossing = other.IncludeBorderCrossing; Events = other.Events.Duplicate(); Spendings = other.Spendings.Duplicate(); }
public Journey(DateTime fromDateTime, DateTime toDateTime) { FromDateTime = fromDateTime.Date; ToDateTime = toDateTime.Date; Weather = ConstantManager.Instance.WeatherKinds.First(); Note = "1"; Bivouac = new Bivouac(); BorderCrossing = new BorderCrossing(); Events = new ItemObservableCollection <Event>(); Spendings = new ItemObservableCollection <Spending>(); EndInit(); }
public MainViewModel() { Journeys = new ItemObservableCollection <JourneyViewModel>(); IMongoDatabase database = DataContext.GetMongoDatabase(DataContext.DatabaseName); IMongoCollection <Journey> collection = database.GetCollection <Journey>("journeys"); List <Journey> journeysFromDatabase = collection.Find(x => true).ToListAsync().Result; List <Journey> journeysFromDatabaseOrdered = journeysFromDatabase.OrderByDescending(x => x.FromDateTime).ToList(); foreach (var journey in journeysFromDatabaseOrdered) { Journeys.Add(new JourneyViewModel(journey)); } Journeys.CollectionChanged += (sender, e) => UpdateApplicationBadge(); Journeys.ItemPropertyChanged += (sender, e) => UpdateApplicationBadge(); }