コード例 #1
0
        public void ReloadEntries()
        {
            RecordsManager manager = DataContext as RecordsManager;

            if (DataContext == null)
            {
                return;
            }
            List <Record> l = manager.Select(Conditions, StartOffset, MaxPerPage);

            if (l.Count == 0)
            {
                ParentContent.OnInfo("No more entries");
                return;
            }
            Results.Clear();
            List <RecordDescription> d = manager.Description;

            foreach (Record r in l)
            {
                BindableDynamicDictionary o = new BindableDynamicDictionary();
                o["ID"] = r.ID;
                for (int i = 0; i < d.Count; i++)
                {
                    o[d[i].Name] = d[i].ShowText(r.GetValue(i));
                }
                Results.Add(o);
            }
        }
コード例 #2
0
        private void AddRecord(object sender, RoutedEventArgs e)
        {
            RecordsManager manager = DataContext as RecordsManager;
            StackPanel     c       = FindName("Entries") as StackPanel;
            int            count   = manager.Description.Count;
            Record         rec     = new Record(count);

            for (int index = 0, i = 0; i < c.Children.Count; i++)
            {
                ControlValue val = c.Children[i] as ControlValue;
                if (val == null)
                {
                    continue;
                }
                rec.SetValue(val.ConvertToValue(), index);
                index++;
            }
            ParentContent.OnInfo("Added record");
            manager.AddRecord(rec);
            CreateNewForm();
        }