Esempio n. 1
0
        public ItemObservableCollection <T> Duplicate()
        {
            ItemObservableCollection <T> result = new ItemObservableCollection <T>();

            foreach (T item in this.Items)
            {
                result.Add(item);
            }
            return(result);
        }
Esempio n. 2
0
        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();
        }
Esempio n. 3
0
        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();
        }
Esempio n. 4
0
        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();
        }