예제 #1
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            string selectedIndex = "";
            dataContext = new AppDataContext(AppDataContext.DBConnectionString);

            if (NavigationContext.QueryString.TryGetValue("selectedItem", out selectedIndex)) {
                int index = int.Parse(selectedIndex);
                this.DataContext = this;
                glucoseRecord = dataContext.GlucoseRecordsTable.Single(x => x.Id == index);
            } else {
                glucoseRecord = new GlucoseRecord {
                    Value = 0,
                    DateTime = DateTime.Now
                };
            }

            LayoutRoot.DataContext = glucoseRecord;
        }
예제 #2
0
 public ShotPage()
 {
     InitializeComponent();
     this.DataContext = this;
     dataContext = new AppDataContext(AppDataContext.DBConnectionString);
 }