Пример #1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            ThemeID = Resource.Style.ThemeLight;
            this.SetTheme(ThemeID);
            SetContentView(Resource.Layout.FrameHorizontalDouble);

            try
            {
                UW = new UnitOfWork();
                DatabaseInitializer.PopulateDatabase(UW);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            var frameTop = FragmentManager.FindFragmentById(Resource.Id.Frame01) as FragmentMenuBarHorizontal<List>;
            List list = UW.ListRepo.GetAll().FirstOrDefault<List>();
            if(frameTop == null) frameTop = new FragmentMenuBarHorizontal<List>(list, new BehaviorButtonMenu(), ThemeID);

            var frameBottom = FragmentManager.FindFragmentById(Resource.Id.Frame02) as FragmentList<ItemListItem, CheckedTextView>;

            IEnumerable<ListItem> listItems = from ListItem li in UW.ListItemRepo.GetAll()
                                             where li.ListID == list.ID
                                             select li;

            IEnumerable<Item> items = from Item i in UW.ItemRepo.GetAll()
                                      join ListItem li in listItems on i.ID equals li.ItemID
                                      select i;

            List<ItemListItem> itemListItems = new List<ItemListItem>();

            for(var i = 0; i < listItems.Count(); i++)
            {
                itemListItems.Add(new ItemListItem() { ListItem = listItems.ElementAtOrDefault(i), Item = items.ElementAtOrDefault(i) });
            }

            if(frameBottom == null) frameBottom =
                new FragmentList<ItemListItem, CheckedTextView>(new AdapterItemListItem(this, itemListItems), new BehaviorItemListItem(), ThemeID);

            FragmentControl.CreateFragment(this.FragmentManager, Resource.Id.Frame01, frameTop);

            FragmentControl.CreateFragment(this.FragmentManager, Resource.Id.Frame02, frameBottom);
        }
Пример #2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            ThemeID = Resource.Style.ThemeLight;
            this.SetTheme(ThemeID);
            SetContentView(Resource.Layout.FrameHorizontalTriple);

            UW = new UnitOfWork();

            var frameTop = FragmentManager.FindFragmentById(Resource.Id.Frame01) as FragmentMenuBarHorizontal<List>;
            List list = UW.ListRepo.GetAll().FirstOrDefault<List>();
            if (frameTop == null) frameTop = new FragmentMenuBarHorizontal<List>(list, new BehaviorButtonMenu(), ThemeID);

            var frameMiddle = FragmentManager.FindFragmentById(Resource.Id.Frame02) as FragmentList<Item, View>;
            IEnumerable<Item> items = UW.ItemRepo.GetAll();
            if (frameMiddle == null) frameMiddle = new FragmentList<Item, View>(new AdapterItem(this, items), new BehaviorItem(), ThemeID);

            var frameBottom = FragmentManager.FindFragmentById(Resource.Id.Frame02) as FragmentItemEdit;
            if (frameBottom == null) frameBottom = new FragmentItemEdit(ThemeID);

            FragmentControl.CreateFragment(FragmentManager, Resource.Id.Frame01, frameTop);
            FragmentControl.CreateFragment(FragmentManager, Resource.Id.Frame02, frameMiddle);
            FragmentControl.CreateFragment(FragmentManager, Resource.Id.Frame03, frameBottom);
        }