Beispiel #1
0
		public ArtTableSource(ArtScreen controller, Art j)
		{
			_controller = controller;
			_art = j;

			CellDelete = new CellDeleteButton(HandleDeleteButtonTouchUpInside);
			NSBundle.MainBundle.LoadNib("CellDeleteButton", CellDelete, null);
			delcell = CellDelete.Cell;

			var sectionArt = new SectionMapping("", "");
			var sectionSlett = new SectionMapping("", "");
			
			sections.Add(sectionArt);
			sections.Add(sectionSlett);
			
			sectionArt.Rows.Add(new RowItemMapping {
				Label = Utils.Translate("specie.name"),
				GetValue = () => {
					return _art.Navn;
				},
				RowSelected = () => {
					var fieldScreen = new FieldStringScreen(Utils.Translate("specie.name"), screen => {
						_art.Navn = Utils.UppercaseFirst(screen.Value);
						_controller.Refresh();
					}); 
					fieldScreen.Value = _art.Navn;
					_controller.NavigationController.PushViewController(fieldScreen, true);
				}
			});
			
			sectionArt.Rows.Add(new RowItemMapping {
				Label = Utils.Translate("specie.wikiword"),
				GetValue = () => {
					return _art.Wikinavn;
				},
				RowSelected = () => {
					var fieldScreen = new FieldStringScreen(Utils.Translate("specie.wikiword"), screen => {
						_art.Wikinavn = screen.Value;
						_controller.Refresh();
					}); 
					fieldScreen.Value = _art.Wikinavn;
					_controller.NavigationController.PushViewController(fieldScreen, true);
				}
			});
			
			
			
			if(!_controller.IsNewItem){
				sectionSlett.Rows.Add(new RowItemMapping {
					Label = Utils.Translate("specie.delete"),
					GetValue = () => {
						return "";
					}
				});
			}
		}
Beispiel #2
0
		public void SaveArtItem(Art item){
			
			ArtList = ArtList.OrderBy(o => o.ID).ToList<Art>();
			var itemToUpdate = ArtList.Where(j=>j.ID == item.ID).FirstOrDefault();
			if(itemToUpdate == null)
			{
				item.ID = ArtList.Count == 0 ? 1 : ArtList.Last().ID + 1;

				ArtList.Add(item);
			}
			else
				itemToUpdate = item;
			
			_repository.SaveArtList(ArtList.Where(w => w.GroupId == 100).ToList());
		}
Beispiel #3
0
		public ArtScreen (Art art) : base("ArtScreen", null)
		{
			_art = art;
		}
		public ArtWebViewController (Art art) : base("ArtWebViewController", null)
		{
			_art = art;
		}
Beispiel #5
0
		public void Delete(Art a){
			JaktLoggApp.instance.DeleteArt(a);
			NavigationController.PopViewControllerAnimated(true);
		}
Beispiel #6
0
		public ArtScreen (Art _art, Action<ArtScreen> callback) : base("ArtScreen", null)
		{
			art = _art;
			_callback = callback;
		}
Beispiel #7
0
		public ArtScreen (Action<ArtScreen> callback) : base("ArtScreen", null)
		{
			art = new Art();
			_callback = callback;
			IsNewItem = true;
		}
Beispiel #8
0
		public void DeleteArt(Art item){
			//remove art from loggs
			var logger = LoggList.Where(x => x.ArtId == item.ID);
			foreach(var logg in logger){
				logg.ArtId = 0;
			}
			_repository.SaveLoggList(LoggList);

			//remove art from selected artlist
			if(SelectedArtIds.Contains(item.ID))
				SelectedArtIds.Remove(item.ID);

			//remove art from artlist
			ArtList.Remove(item);
			_repository.SaveArtList(ArtList);
		}