public ListType(ListType listType) { Copy(listType); }
public void Copy(ListType obj) { // copy all of the properties foreach (PropertyInfo pi in this.GetType().GetProperties()) { var val = pi.GetValue(obj, null); pi.SetValue(this, val, null); } }
private void RenderEditTask(Task task, bool renderTaskListField) { // get listType for this list try { listType = App.ViewModel.ListTypes.Single(lt => lt.ID == taskList.ListTypeID); } catch (Exception) { // if can't find the list type, use the first listType = App.ViewModel.ListTypes[0]; } // render the primary fields RenderEditTaskFields(task, listType, true, renderTaskListField); // render more button moreButton = new Button() { Content = "more details" }; moreButton.Click += new RoutedEventHandler(MoreButton_Click); EditListBox.Items.Add(moreButton); }
private void RenderEditTaskFields(Task task, ListType listtype, bool primary, bool renderTaskListField) { if (renderTaskListField == true) { FieldType fieldType = new FieldType() { Name = "TaskListID", DisplayName = "list", DisplayType = "TaskList" }; RenderEditTaskField(task, fieldType); } // render fields foreach (Field f in listtype.Fields.Where(f => f.IsPrimary == primary).OrderBy(f => f.SortOrder)) { FieldType fieldType; // get the field type for this field try { fieldType = App.ViewModel.Constants.FieldTypes.Single(ft => ft.FieldTypeID == f.FieldTypeID); } catch (Exception) { continue; } // render this field RenderEditTaskField(task, fieldType); } // refresh the keyboard tabstops keyboardHelper.RefreshTabbedControls(null); }
/// <summary> /// Initialize default listtypes /// </summary> /// <returns></returns> private ObservableCollection<ListType> InitializeListTypes() { ObservableCollection<ListType> listTypes = new ObservableCollection<ListType>(); ListType listType; // create the To Do list type listTypes.Add(listType = new ListType() { ID = ListType.ToDo, Name = "To Do List", Fields = new List<Field>() }); listType.Fields.Add(new Field() { ID = new Guid("3F6F8964-FCCD-47C6-8595-FBB0D5CAB5C2"), FieldTypeID = 1 /* Name */, ListTypeID = ListType.ToDo, IsPrimary = true, SortOrder = 1 }); listType.Fields.Add(new Field() { ID = new Guid("5B934DC3-983C-4F05-AA48-C26B43464BBF"), FieldTypeID = 2 /* Description */, ListTypeID = ListType.ToDo, IsPrimary = true, SortOrder = 2 }); listType.Fields.Add(new Field() { ID = new Guid("8F96E751-417F-489E-8BE2-B9A2BABF05D1"), FieldTypeID = 3 /* PriorityID */, ListTypeID = ListType.ToDo, IsPrimary = true, SortOrder = 3 }); listType.Fields.Add(new Field() { ID = new Guid("5F33C018-F0ED-4C8D-AF96-5B5C4B78C843"), FieldTypeID = 4 /* Due */, ListTypeID = ListType.ToDo, IsPrimary = true, SortOrder = 4 }); listType.Fields.Add(new Field() { ID = new Guid("ea7a11ad-e842-40ea-8a50-987427e69845"), FieldTypeID = 5 /* Tags */, ListTypeID = ListType.ToDo, IsPrimary = true, SortOrder = 5 }); listType.Fields.Add(new Field() { ID = new Guid("F5391480-1675-4D5C-9F4B-0887227AFDA5"), FieldTypeID = 6 /* Location */, ListTypeID = ListType.ToDo, IsPrimary = false, SortOrder = 6 }); listType.Fields.Add(new Field() { ID = new Guid("DA356E6E-A484-47A3-9C95-7618BCBB39EF"), FieldTypeID = 7 /* Phone */, ListTypeID = ListType.ToDo, IsPrimary = false, SortOrder = 7 }); listType.Fields.Add(new Field() { ID = new Guid("82957B93-67D9-4E4A-A522-08D18B4B5A1F"), FieldTypeID = 8 /* Website */, ListTypeID = ListType.ToDo, IsPrimary = false, SortOrder = 8 }); listType.Fields.Add(new Field() { ID = new Guid("261950F7-7FDA-4432-A280-D0373CC8CADF"), FieldTypeID = 9 /* Email */, ListTypeID = ListType.ToDo, IsPrimary = false, SortOrder = 9 }); listType.Fields.Add(new Field() { ID = new Guid("1448b7e7-f876-46ec-8e5b-0b9a1de7ea74"), FieldTypeID = 12 /* LinkedTaskListID */, ListTypeID = ListType.ToDo, IsPrimary = false, SortOrder = 10 }); listType.Fields.Add(new Field() { ID = new Guid("32EE3561-226A-4DAD-922A-9ED93099C457"), FieldTypeID = 10 /* Complete */, ListTypeID = ListType.ToDo, IsPrimary = false, SortOrder = 11 }); // create the Shopping list type listTypes.Add(listType = new ListType() { ID = ListType.Shopping, Name = "Shopping List", Fields = new List<Field>() }); listType.Fields.Add(new Field() { ID = new Guid("DEA2ECAD-1E53-4616-8EE9-C399D4223FFB"), FieldTypeID = 1 /* Name */, ListTypeID = ListType.Shopping, IsPrimary = true, SortOrder = 1 }); listType.Fields.Add(new Field() { ID = new Guid("7E7EAEB4-562B-481C-9A38-AEE216B8B4A0"), FieldTypeID = 9 /* Complete */, ListTypeID = ListType.Shopping, IsPrimary = true, SortOrder = 2 }); // create the Freeform list type listTypes.Add(listType = new ListType() { ID = ListType.Freeform, Name = "Freeform List", Fields = new List<Field>() }); listType.Fields.Add(new Field() { ID = new Guid("1C01E1B0-C14A-4CE9-81B9-868A13AAE045"), FieldTypeID = 1 /* Name */, ListTypeID = ListType.Freeform, IsPrimary = true, SortOrder = 1 }); listType.Fields.Add(new Field() { ID = new Guid("7FFD95DB-FE46-49B4-B5EE-2863938CD687"), FieldTypeID = 11 /* Details */, ListTypeID = ListType.Freeform, IsPrimary = true, SortOrder = 2 }); listType.Fields.Add(new Field() { ID = new Guid("6B3E6603-3BAB-4994-A69C-DF0F4310FA95"), FieldTypeID = 3 /* PriorityID */, ListTypeID = ListType.Freeform, IsPrimary = false, SortOrder = 3 }); listType.Fields.Add(new Field() { ID = new Guid("2848AF68-26F7-4ABB-8B9E-1DA74EE4EC73"), FieldTypeID = 4 /* Due */, ListTypeID = ListType.Freeform, IsPrimary = false, SortOrder = 4 }); listType.Fields.Add(new Field() { ID = new Guid("9ebb9cba-277a-4462-b205-959520eb88c5"), FieldTypeID = 5 /* Tags */, ListTypeID = ListType.Freeform, IsPrimary = false, SortOrder = 5 }); listType.Fields.Add(new Field() { ID = new Guid("4054F093-3F7F-4894-A2C2-5924098DBB29"), FieldTypeID = 6 /* Location */, ListTypeID = ListType.Freeform, IsPrimary = false, SortOrder = 6 }); listType.Fields.Add(new Field() { ID = new Guid("8F0915DE-E77F-4B63-8B22-A4FF4AFC99FF"), FieldTypeID = 7 /* Phone */, ListTypeID = ListType.Freeform, IsPrimary = false, SortOrder = 7 }); listType.Fields.Add(new Field() { ID = new Guid("9F9B9FDB-3403-4DCD-A139-A28487C1832C"), FieldTypeID = 8 /* Website */, ListTypeID = ListType.Freeform, IsPrimary = false, SortOrder = 8 }); listType.Fields.Add(new Field() { ID = new Guid("4E304CCA-561F-4CB3-889B-1F5D022C4364"), FieldTypeID = 9 /* Email */, ListTypeID = ListType.Freeform, IsPrimary = false, SortOrder = 9 }); listType.Fields.Add(new Field() { ID = new Guid("7715234d-a60e-4336-9af1-f05c36add1c8"), FieldTypeID = 12 /* LinkedTaskListID */, ListTypeID = ListType.Freeform, IsPrimary = false, SortOrder = 10 }); listType.Fields.Add(new Field() { ID = new Guid("FE0CFC57-0A1C-4E3E-ADD3-225E2C062DE0"), FieldTypeID = 10 /* Complete */, ListTypeID = ListType.Freeform, IsPrimary = false, SortOrder = 11 }); return listTypes; }