Ejemplo n.º 1
0
        public LeseplanVM(LeseplanData lpd) : this()
        {
            _LeseplanData = lpd;
            LoadUserData();

            // Detect first non-checked entries... and calculate the correpsonding data
            DateTime actDate = DateTime.Now.Date;

            if (UserData != null)
            {
                actDate = UserData.StartDate.Date;
                foreach (var e in _LeseplanData.Entries)
                {
                    bool brk = false;
                    foreach (var i in e.Items)
                    {
                        if (!UserData.ReadItems.ContainsKey(i.Ref))
                        {
                            brk = true;
                            break;
                        }
                    }
                    if (brk)
                    {
                        break;
                    }
                    actDate = actDate.AddDays(1);
                }
            }

            AssignData(actDate);
        }
Ejemplo n.º 2
0
        public static LeseplanData ReadLeseplanData()
        {
            // Display names of embedded resources
            var assembly = typeof(MainPage).Assembly;

            foreach (var res in assembly.GetManifestResourceNames())
            {
                // Read the first json
                if (string.Equals(Path.GetExtension(res), ".json", StringComparison.OrdinalIgnoreCase))
                {
                    var s   = assembly.GetManifestResourceStream(res);
                    var sr  = new StreamReader(s);
                    var lpd = LeseplanData.Load(sr.ReadToEnd());
                    return(lpd);
                }
            }
            return(null);
        }
Ejemplo n.º 3
0
        public MainPage()
        {
            InitializeComponent();


            // Load Leseplan...
            LeseplanVM   lp;
            LeseplanData lpd = ReadLeseplanData();

            if (lpd != null)
            {
                lp = new LeseplanVM(lpd);
            }
            else
            {
                lp = new LeseplanVM();
            }

            this.BindingContext = lp;
        }