Exemplo n.º 1
0
		public void HandleButtonFilterClicked (object sender, EventArgs EventArgs)
		{
			var pickerScreen = new FooterStatsArter(screen => 
            {
				SelectedJeger = screen.SelectedJeger;
				SelectedDog = screen.SelectedDog;
				_tableSource.ItemList = GetRanking();
				TableView.ReloadData();
				
				var labelText = Utils.Translate("showingcountfor");
				if(SelectedJeger == null && SelectedDog == null)
					labelText += Utils.Translate("all_hunters_dogs");
				
				if(SelectedJeger != null)
					labelText += SelectedJeger.Fornavn;
				
				if(SelectedDog != null && SelectedJeger != null)
					labelText += "/";
				
				if(SelectedDog != null)
					labelText += SelectedDog.Navn;
				
				headerStatsFilter.SetFilterLabel(labelText);
				
			},SelectedJeger, SelectedDog);
			
			pickerScreen.ModalTransitionStyle = UIModalTransitionStyle.PartialCurl;
			PresentViewController(pickerScreen, true, null);
		}
Exemplo n.º 2
0
		public void SaveDogItem(Dog item){
			
			DogList = DogList.OrderBy(o => o.ID).ToList<Dog>();
			var itemToUpdate = DogList.Where(j=>j.ID == item.ID).FirstOrDefault();
			if(itemToUpdate == null)
			{
				item.ID = DogList.Count == 0 ? 1 : DogList.Last().ID + 1;
				DogList.Add(item);
			}
			else
				itemToUpdate = item;
			
			_repository.SaveDogList(DogList);
		}
Exemplo n.º 3
0
		public void Delete(Dog j){
			JaktLoggApp.instance.DeleteDog(j);
			NavigationController.PopViewControllerAnimated(true);
		}
Exemplo n.º 4
0
		public DogScreen (Dog _dog, Action<DogScreen> callback) : base("DogScreen", null)
		{
			dog = _dog;
			_callback = callback;
		}
Exemplo n.º 5
0
		public DogScreen (Action<DogScreen> callback) : base("DogScreen", null)
		{
			dog = new Dog();
			_callback = callback;
			IsNewItem = true;
		}
Exemplo n.º 6
0
		public void DogSelected(Dog d){
			SelectedDog = d;
		}
Exemplo n.º 7
0
		public FooterStatsArter (Action<FooterStatsArter> callback, Jeger selectedJeger, Dog selectedDog) : base("FooterStatsArter", null)
		{
			_callback = callback;	
			SelectedJeger = selectedJeger;
			SelectedDog = selectedDog;
		}
Exemplo n.º 8
0
		public DogItemTableSource(DogScreen controller, Dog j)
		{
			_controller = controller;
			_dog = j;

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

			var sectionDog = new SectionMapping("", "");
			var sectionSlett = new SectionMapping("", "");
			
			sections.Add(sectionDog);
			sections.Add(sectionSlett);
			
			sectionDog.Rows.Add(new RowItemMapping {
				Label = Utils.Translate("dog.name"),
				GetValue = () => {
					return _dog.Navn;
				},
				RowSelected = () => {
					var fieldScreen = new FieldStringScreen(Utils.Translate("dog.name"), screen => {
						_dog.Navn = Utils.UppercaseFirst(screen.Value);
						_controller.Refresh();
					}); 
					fieldScreen.Value = _dog.Navn;
					_controller.NavigationController.PushViewController(fieldScreen, true);
				}
			});
			
			sectionDog.Rows.Add(new RowItemMapping {
				Label = Utils.Translate("dog.breed"),
				GetValue = () => {
					return _dog.Rase;
				},
				RowSelected = () => {
					var fieldScreen = new FieldStringScreen(Utils.Translate("dog.breed"), screen => {
						_dog.Rase = Utils.UppercaseFirst(screen.Value);
						_controller.Refresh();
					}); 
					fieldScreen.Value = _dog.Rase;
					_controller.NavigationController.PushViewController(fieldScreen, true);
				}
			});
			
			sectionDog.Rows.Add(new RowItemMapping {
				Label = Utils.Translate("dog.image"),
				GetValue = () => {
					return _dog.ImagePath.Length > 0 ? Utils.Translate("picture.showimage") : Utils.Translate("picture.addimage");
				},
				RowSelected = () => {
					ShowImageView();
				},
				ImageFile = "Images/Icons/camera.png"
			});
			
			sectionDog.Rows.Add(new RowItemMapping {
				Label = Utils.Translate("dog.licencenr"),
				GetValue = () => {
					return _dog.Lisensnummer;
				},
				RowSelected = () => {
					var fieldScreen = new FieldStringScreen(Utils.Translate("dog.licencenr"), screen => {
						_dog.Lisensnummer = screen.Value;
						_controller.Refresh();
					}); 
					fieldScreen.Value = _dog.Lisensnummer;
					_controller.NavigationController.PushViewController(fieldScreen, true);
				}
			});
			
			
			
			
			if(!_controller.IsNewItem){
				sectionSlett.Rows.Add(new RowItemMapping {
					Label = Utils.Translate("dog.delete"),
					GetValue = () => {
						return "";
					}
				});
			}
		}
Exemplo n.º 9
0
		public void DeleteDog(Dog item){
			//remove dog from loggs
			var logger = LoggList.Where(x => x.DogId == item.ID);
			foreach(var logg in logger){
				logg.DogId = 0;
			}
			_repository.SaveLoggList(LoggList);
			
			//remove dog from jakts
			var jakts = JaktList.Where(x => x.DogIds.Contains(item.ID));
			foreach(var jakt in jakts){
				jakt.DogIds.Remove(item.ID);
			}
			
			//remove dog images
			DeleteFile(Utils.GetPath("dog_" + item.ID + ".jpg"));
			               
			//remove dog from doglist
			DogList.Remove(item);
			_repository.SaveDogList(DogList);
		}