public ManageEventTemplate (Event eve)
		{
			InitializeComponent ();
			BindingContext = new EventForLists(eve);

			//distance.Text += " km";
			var times = _dataManager.UtilityManager.setTime (eve.StartDate);
			//time.Text = times[0] + " " + times[1];
			//attending.Text = (eve.NumberOfAttendees) + "/" + eve.MaxSize;

			System.Diagnostics.Debug.WriteLine("Number of attenInt: " + eve.NumberOfAttendees + ", and number of AttendList: " + eve.Attendees.Count);
			if (_dataManager.IsEventYours(eve))
			{
				System.Diagnostics.Debug.WriteLine("Number of attenInt: " + eve.NumberOfAttendees + ", and number of AttendList: " + eve.Attendees.Count);
			}

			//address.Text = "At " + eve.eve.AddressName;

			//ProfilView.Content = new ProfileDesignView (eve.Owner, null, null, 80, ProfileDesignView.Design.Plain, false);
			//EventView.Content = new EventDesignView (eve, 80, EventDesignView.Design.Plain);

			/*
			SubjectButton.Clicked += (sender, e) => {
				InspectController inspect = new InspectController(null, null, eve);
				App.coreView.setContentViewWithQueue(inspect,"", inspect.getScrollView());
			};
			*/
		}
Пример #2
0
		public ProfileDesignView(Profile profile, Event eveInvitingTo, int dims) : base(dims)
		{
			this.profile = profile;
			design = Design.NameAndButtons;
			SetupButtons(true);
			if (!eveInvitingTo.Attendees.Exists(p => p.ProfileId == profile.ProfileId))
			{
				HandleButtonRequests(delegate ()
				{
					return _dataManager.EventApiManager.InviteProfilesToEvent(eveInvitingTo.EventId, new List<Profile> { profile });
				}, addBtn, "Invite", "Invited");
			}
		}
		public SearchEventTemplate (Event eve)
		{
			InitializeComponent ();
			EventForLists efl = new EventForLists(eve);
			BindingContext = efl;

			attendingInfo.Text = (eve.Attendees.Count + 1) + "/" + eve.MaxSize;

			topTime.Text = eve.StartDate.ToString("ddd dd MMM");
			bottomTime.Text = eve.StartDate.ToString("HH:mm") + "-" + eve.EndDate.ToString("HH:mm");

			topDist.Text = efl.Distance + " km";

			string[] addressList = new string[3];
			addressList = Regex.Split(eve.AddressName, ",");
			for (int i = 0; i < addressList.Length; i++)
			{
				Label label = new Label() { TextColor = Color.FromHex("646464") };
				label.Text = addressList[i];
				label.FontSize = 14;
			}
			if (addressList.Length == 2)
			{
				bottomDist.Text = addressList[0].Substring(5).Trim();
			}
			else {
				bottomDist.Text = addressList[1].Substring(5).Trim();
			}



			/*
			SubjectButton.Clicked += (sender, e) => {
				InspectController inspect = new InspectController(null, null, eve);
				App.coreView.setContentViewWithQueue(inspect, "", inspect.getScrollView());
			};
			*/
		}
Пример #4
0
		/*
		public async Task scrollTo(VisualElement a)
		{

			await Task.Delay(40);
			var y = a.Y;
			var parent = a.ParentView;
			while (parent != null)
			{
				y += parent.Y;
				parent = parent.ParentView;
			}

			if (App.coreView.scrollViews[App.coreView.scrollViews.Count - 1] != null)
			{
				App.coreView.scrollViews[App.coreView.scrollViews.Count - 1].ScrollToAsync(0, (y - 120), true);
			}
			//s.ScrollToAsync(s.X, (y - 100), true);
		}
		*/


		public async Task<bool> SenderOfEvent(StackLayout SelectEventSenderLayout, Event eve)
		{
			bool continueCreating = true;

			if (App.userProfile.GroupsOwned != null && App.userProfile.GroupsOwned.Count > 0)
			{
				TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>();
				SelectEventSenderLayout.Children.Clear();
				SelectEventSenderLayout.IsVisible = true;

				SelectEventSenderLayout.Children.Add(new Label()
				{
					Text = "Who is the owner of this event?",
					FontSize = 16,
					FontAttributes = FontAttributes.Bold,
					HorizontalOptions = LayoutOptions.CenterAndExpand,
				});

				Grid uGrid = new Grid() { HeightRequest = 120, WidthRequest = 120, Padding = new Thickness(0,0,0,10) };
				uGrid.Children.Add(new ProfileDesignView(App.userProfile,120,false, GenericDesignView.Design.OnlyImage),0,0);
				Button youBtn = new Button()
				{
					HeightRequest = 150,
					WidthRequest = 150,
				};
				uGrid.Children.Add(youBtn, 0, 0);
				SelectEventSenderLayout.Children.Add(uGrid);
				youBtn.Clicked += async (sender, e) =>
				{
					bool success = await App.coreView.displayConfirmMessage("Continue ?", "You have selected yourself to be the owner of this event. Continue creating the event ?", "Confirm", "Cancel");
					if(success)tcs.TrySetResult(true);
				};
				StackLayout labLayout = new StackLayout();
				ListsAndButtons lab = new ListsAndButtons();
				labLayout.Children.Add(lab);
				SelectEventSenderLayout.Children.Add(labLayout);

				Button cancleBtn = new Button()
				{
					Text = "Cancel",
					HeightRequest = 30,
					WidthRequest = 100,
					FontSize = 14,
					TextColor = Color.White,
					BorderRadius = 10,
					BackgroundColor = App.HowlOutRed,
					VerticalOptions = LayoutOptions.EndAndExpand
				};
				SelectEventSenderLayout.Children.Add(cancleBtn);
				getGroupClicked(lab, eve);

				cancleBtn.Clicked += (sender, e) =>
				{
					continueCreating = false;
					tcs.TrySetResult(true);
				};
				testEvent += async (sender, e) =>
				{
					bool success = await App.coreView.displayConfirmMessage("Continue ?", "Continue creating the event with the selected group as owner ?", "Confirm", "Cancel");
					if (success) tcs.TrySetResult(true);
					else {
						labLayout.Children.Clear();
						labLayout.Children.Add(lab = new ListsAndButtons());
						getGroupClicked(lab, eve);
					}
				};
				await tcs.Task;
				lab = null;
				SelectEventSenderLayout.IsVisible = false;
			}
			return continueCreating;
		}
Пример #5
0
		public async Task<Event> CreateEditEvent(Event eventToCreate)
		{
			var uri = "";
			var content = JsonConvert.SerializeObject(eventToCreate);
			List<Event> events = await PostEventServerCall(uri, content);
			if (events != null && events.Count > 0)
			{
				if (events[0].StartDate > DateTime.Now.AddHours(2).AddMinutes(1))
				{
					CrossLocalNotifications.Current.Show("Event: " + events[0].Title, events[0].Title + " is starting in 2 hours!", (int.Parse(events[0].EventId) * 2), events[0].StartDate.ToLocalTime().AddHours(-2));
				}
				if (events[0].StartDate > DateTime.Now.AddDays(1).AddMinutes(1))
				{
					CrossLocalNotifications.Current.Show("Event: " + events[0].Title, events[0].Title + " is starting in 1 day!", (int.Parse(events[0].EventId) * 2) + 1, events[0].StartDate.ToLocalTime().AddDays(-1));
				}
				return events[0];
			}
			return null;
		}
Пример #6
0
		public InviteListView(Event eve, bool owner)
		{
			InitializeComponent();
			if (owner)
			{
				foreach (Profile p in eve.ProfileOwners)
				{
					profilesThatCanBeAdded.Remove(profilesThatCanBeAdded.Find(r => r.ProfileId == p.ProfileId));
				}
			}
			else {
				foreach (Profile p in eve.Attendees)
				{
					profilesThatCanBeAdded.Remove(profilesThatCanBeAdded.Find(r => r.ProfileId == p.ProfileId));
				}
			}

			setup();
			addBtn.Clicked += async (sender, e) =>
			{
				if (profilesAdded.Count > 0)
				{
					bool success = false;
					if (owner)
					{
						success = await _dataManager.EventApiManager.InviteToEventAsOwner(eve.EventId, profilesAdded);
					}
					else {
						success = await _dataManager.EventApiManager.InviteProfilesToEvent(eve.EventId, profilesAdded);
					}
					if (success)
					{
						App.coreView.returnToPreviousView();
					}
					else {
						App.coreView.displayAlertMessage("Error", "Error inviting.", "Ok");
					}
				}
			};
		}
Пример #7
0
		private void setCreateView(Event givenEvent, bool isCreate)
		{
			newEvent = givenEvent;
			this.isCreate = isCreate;

			if (isCreate)
			{
				setNewEvent();
			}
			else {
				setEditEvent();
			}
			mapView = new MapsView(App.lastKnownPosition);

			title.TextChanged += (sender, e) => { newEvent.Title = title.Text; };
			description.TextChanged += (sender, e) => { newEvent.Description = description.Text; };

			EventCategory.ManageCategories(eventTypeGrid, newEvent.EventTypes, true);

			/// set time and date
			startDate.MinimumDate = DateTime.Now;
			endDate.MinimumDate = DateTime.Now;
			startDate.PropertyChanged += (sender, e) => { checkValidDate(); };
			startTime.PropertyChanged += (sender, e) => { checkValidDate(); };
			endDate.PropertyChanged += (sender, e) => { checkValidDate(); };
			endTime.PropertyChanged += (sender, e) => { checkValidDate(); };

			/// set location
			locationButton.Clicked += (sender, e) =>
			{
				if (newEvent.Latitude == 0 && newEvent.Longitude == 0)
				{
					mapView = new MapsView(App.lastKnownPosition);
				}
				else {
					mapView = new MapsView(new Position(newEvent.Latitude, newEvent.Longitude));
				}
				mapView.createEventView = this;
				App.coreView.setContentViewWithQueue(mapView);

			};

			visibilityPicker.SelectedIndexChanged += (sender, e) =>
			{
				//visibilityPicker.Items[1] = "Group";
				//newEvent.GroupSpecific = null;
				System.Diagnostics.Debug.WriteLine(visibilityPicker.SelectedIndex);
				if (visibilityPicker.SelectedIndex == 0) { newEvent.Visibility = EventVisibility.Public; }
				if (visibilityPicker.SelectedIndex == 1) { newEvent.Visibility = EventVisibility.Private; }
				visibilityString.Text = visibilityPicker.Items[visibilityPicker.SelectedIndex];
			};
			visibilityString.Text = visibilityPicker.Title;

			NumberAttendendeesEntry.TextChanged += (sender, e) =>
			{
				string t = NumberAttendendeesEntry.Text;
				if (t.Contains(","))
				{
					t = t.Remove(t.Length - 1);

				}

				if (!string.IsNullOrWhiteSpace(t))
				{
					try
					{
						newEvent.MaxSize = int.Parse(t);
						validAttendingAmount = true;
					}
					catch (Exception ex)
					{
						validAttendingAmount = false;
					}
				}
				NumberAttendendeesEntry.Text = t;
			};

			var pictureImage = new TapGestureRecognizer();
			pictureImage.Tapped += async (sender, e) =>
			{
				try
				{
					imageStreams = await _dataManager.UtilityManager.TakePicture(SelectedBannerImage.Source);
				}
				catch (Exception ex) { }
			};
			takePictureButton.GestureRecognizers.Add(pictureImage);

			var albumImage = new TapGestureRecognizer();
			albumImage.Tapped += async (SenderOfEvent, e) =>
			{
				try
				{
					imageStreams = await _dataManager.UtilityManager.PictureFromAlbum(SelectedBannerImage.Source);
				}
				catch (Exception ex) { }
			};
			albumPictureButton.GestureRecognizers.Add(albumImage);

			selectBannerButton.Clicked += (sender, e) =>
			{
				SelectBannerView selectBannerView = new SelectBannerView();
				selectBannerView.createEventView = this;
				App.coreView.setContentViewWithQueue(selectBannerView);
			};

			launchButton.Clicked += async (sender, e) =>
			{
				if (isCreate && !Launching)
				{
					bool continueCreating = await App.coreView.otherFunctions.SenderOfEvent(SelectSenderLayout, newEvent);
					if (continueCreating)
					{
						LaunchEvent(newEvent);
						Launching = true;
					}
				}
				else if (!isCreate && !Launching)
				{
					LaunchEvent(newEvent);
					Launching = true;
				}
			};

			cancelButton.Clicked += (sender, e) => { CancelTheEvent(); };
		}
Пример #8
0
		//Image banner = new Image();

		public CreateEvent(Event givenEvent, bool isCreate)
		{
			_dataManager = new DataManager();
			InitializeComponent();
			setCreateView(givenEvent, isCreate);
		}
Пример #9
0
		public bool IsEventJoined(Event eve)
		{
			bool yours = false;
			/*
			if (IsEventYours (eve)) {
				return true;
			}  */
			for (int i = 0; i < eve.Attendees.Count; i++) {
				if (eve.Attendees[i].ProfileId == App.userProfile.ProfileId) {
					yours = true;
				}
			}
			return yours;
		}
Пример #10
0
		public InspectEvent (Event eve, bool inspectType, ScrollView scrollView)
		{
			InitializeComponent ();
			efl = new EventForLists(eve);
			BindingContext = efl;
			_dataManager = new DataManager();
			setInfo (eve);
			/*
			if (_dataManager.IsEventJoined(eve) || _dataManager.IsEventYours(eve))  { 	
				//trackImg.IsVisible = false; 
				inviteImg.IsVisible = true; } 
			else  { 
				//trackImg.IsVisible = true; 
				inviteImg.IsVisible = false; 
			} */


			mapBtn.Clicked += (sender, e) =>
			{
				mapGrid.IsVisible = !mapGrid.IsVisible;
			};

			/*
			detailsButton.Clicked += (sender, e) => 
			{
				if(detailedInfo.IsVisible == false) { 
					detailedInfo.IsVisible = true; 
					quickInfo.IsVisible = false;
					detailsButton.Text = "Hide Map";
					App.coreView.otherFunctions.scrollTo(100);
				} 
				else { 
					detailedInfo.IsVisible = false; 
					quickInfo.IsVisible = true;
					detailsButton.Text = "Show Map";
					App.coreView.otherFunctions.scrollTo(200);
				}

				if(mapInitialized != true) { 
					mapInitialized = true;
					_dataManager.UtilityManager.setMapForEvent (new Position(eve.Latitude, eve.Longitude), map, mapLayout);
					_dataManager.UtilityManager.setPin(new Position(eve.Latitude, eve.Longitude), map, eve.Title, eve.AddressName);
				}
			}; */

			scrollView.Scrolled += (sender, e) =>
			{
				


				if (scrollView.ScrollY > 0)
				{
					bannerElement.TranslationY = Math.Abs(scrollView.ScrollY) / 3.0;
				}
				else {
					bannerElement.Scale = 1 + (Math.Abs(scrollView.ScrollY) / 100.0);
					//if (bannerElement.Scale > 2) bannerElement.Scale = 2;
					bannerElement.TranslationY = scrollView.ScrollY;
					bannerElementBackground.TranslationY = scrollView.ScrollY;
					//titleInfo.TranslationY = scrollView.ScrollY;
				}


				if (scrollView.ScrollY < 100 && scrollView.ScrollY > 0)
				{
					//titleInfo.TranslationY = scrollView.ScrollY;
				}
			};
				
			mapButton.Clicked += (sender, e) => {
				App.coreView.setContentViewWithQueue(new MapsView(eve));
			};

			//JoinLeaveButton.IsVisible = false;
			//editImg.IsVisible = true;

			/*
			if (eve.Attendees.Exists(p => p.ProfileId == App.StoredUserFacebookId) || eve.ProfileOwners.Exists(p => p.ProfileId == App.StoredUserFacebookId))
			{
				JoinLeaveButton.IsVisible = false;
			}
			else {
				JoinLeaveButton.Clicked += (sender, e) =>
				{
					_dataManager.AttendTrackEvent(eve, true, true);
				};
			} */

			if (!_dataManager.IsEventJoined(eve))
			{
				JoinLeaveButton.Clicked += (sender, e) =>
				{
					_dataManager.AttendTrackEvent(eve, true, true);
				};
			}
			else {
				JoinLeaveButton.IsVisible = false;
			}

			if (App.userProfile.EventsInviteToAsOwner.Exists(e => e.EventId == eve.EventId))
			{
				AcceptOwnerButton.IsVisible = true;
				DeclineOwnerButton.IsVisible = true;
				AcceptOwnerButton.Clicked += (sender, e) =>
				{
					_dataManager.EventApiManager.AcceptDeclineLeaveEventAsOwner(eve.EventId, OwnerHandlingType.Accept);
				};
				DeclineOwnerButton.Clicked += (sender, e) =>
				{
					_dataManager.EventApiManager.AcceptDeclineLeaveEventAsOwner(eve.EventId, OwnerHandlingType.Decline);
				};
			}


			BannerImage.Clicked += (sender, e) =>
			{
				OtherFunctions of = new OtherFunctions();
				of.ViewImages(new List<string>() { eve.ImageSource });
			};
			/*
			if (eve.Followers.Exists(p => p.ProfileId == App.StoredUserFacebookId))
			{
				trackImg.Foreground = App.HowlOut;
			}

			TapGestureRecognizer tgr = new TapGestureRecognizer();
			tgr.Tapped += (sender, e) =>
			{
				App.coreView.DisplayShare(eve);
			};
			shareImg.GestureRecognizers.Add(tgr);

			tgr = new TapGestureRecognizer();
			tgr.Tapped += async (sender, e) =>
			{
				bool success = false;
				if (eve.Followers.Exists(p => p.ProfileId == App.StoredUserFacebookId))
				{
					success = await _dataManager.AttendTrackEvent(eve, false, false);
					if (success)
					{
						trackImg.Foreground = App.HowlOutFade;
					}
				}
				else {
					success = await _dataManager.AttendTrackEvent(eve, true, false);
					if (success)
					{
						trackImg.Foreground = App.HowlOut;
					}
				}
			};
			trackImg.GestureRecognizers.Add(tgr);

			tgr = new TapGestureRecognizer();
			tgr.Tapped += (sender, e) =>
			{
				App.coreView.setContentViewWithQueue(new CreateEvent(eve, false));
			};
			editImg.GestureRecognizers.Add(tgr);

			tgr = new TapGestureRecognizer();
			tgr.Tapped += (sender, e) =>
			{
				App.coreView.setContentViewWithQueue(new InviteListView(eve));
			};
			inviteImg.GestureRecognizers.Add(tgr);
			*/
			if (mapInitialized != true)
			{
				mapInitialized = true;
				_dataManager.UtilityManager.setMapForEvent(new Position(eve.Latitude, eve.Longitude), map, mapLayout);
				_dataManager.UtilityManager.setPin(new Position(eve.Latitude, eve.Longitude), map, eve.Title, eve.AddressName);
			}

			TapGestureRecognizer tgr = new TapGestureRecognizer();
			tgr.Tapped += (sender, e) =>
			{
				App.coreView.setContentViewWithQueue(new ListsAndButtons(eve.ProfileOwners, null, false, false));
			};
			ownerImg.GestureRecognizers.Add(tgr);

			groupOwnerBtn.Clicked += (sender, e) =>
			{
				App.coreView.GoToSelectedGroup(eve.GroupOwner.GroupId);
			};
		}
Пример #11
0
		public async Task<Group> createList(List<Profile> profiles, List<Group> groups,
		                       Event eventInvitingTo, Group groupInvitingTo, bool preview, bool buttons, bool returnClick)
		{
			thisGrid.Children.Clear();
			thisGrid.RowDefinitions.Clear();
			thisGrid.ColumnDefinitions.Clear();
			Grid grid = thisGrid;

			TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>();
			Group clickedGroup = null;

			GenericDesignView.Design design = GenericDesignView.Design.Name;

			int height = 0;
			int newRowValue = 3;
			if (buttons)
			{
				design = GenericDesignView.Design.NameAndButtons;
				newRowValue = 3;
				height = 100;
			}
			else {
				newRowValue = 4;
				height = 75;
			}
			float rowHeight = height * 1.3f;
			int column = 0;
			int row = 0;
			int count = 0;

			if (!preview && !buttons)
			{
				findFriendsBtn.Clicked += (sender, e) =>
				{
					App.coreView.setContentViewWithQueue(new FindNewFriendsView(0));
				};
			}

			grid.Children.Clear();

			if (profiles != null)
			{
				count = profiles.Count;
			}
			else if (groups != null)
			{
				count = groups.Count;
			}

			grid.RowDefinitions.Add (new RowDefinition{ Height = rowHeight });

			for (int i = 0; i < count; i++)
			{
				if (column == newRowValue)
				{
					column = 0;
					row++;
					grid.RowDefinitions.Add(new RowDefinition { Height = rowHeight });
				}
				Grid cell = new Grid();

				if (profiles != null)
				{
					if (eventInvitingTo != null)
					{
						cell.Children.Add(new ProfileDesignView(profiles[i], eventInvitingTo, height), 0, 0);
					}
					else if (groupInvitingTo != null)
					{
						cell.Children.Add(new ProfileDesignView(profiles[i], groupInvitingTo, height), 0, 0);
					}
					else {
						cell.Children.Add(new ProfileDesignView(profiles[i], height, true, design), 0, 0);
					}
				}
				else if (groups != null)
				{
					cell.Children.Add(new GroupDesignView(groups[i], height, design), 0, 0);
				}

				grid.Children.Add(cell, column, row);
				if(returnClick) {
					Button clickedGroupBtn = new Button() { };
					Group clickedGrp = groups[i];
					grid.Children.Add(clickedGroupBtn, column, row);

					clickedGroupBtn.Clicked += (sender, e) =>
					{
						clickedGroup = clickedGrp;
						tcs.TrySetResult(true);
					};
				}
				column ++;

				if (preview && count > newRowValue && i == (newRowValue-2))
				{
					Button b = new Button() { BackgroundColor = App.HowlOut, HeightRequest = height, WidthRequest = height, Text="more", TextColor=Color.White, BorderRadius=height / 2};
					Grid g = new Grid() { RowSpacing=0 };
					g.RowDefinitions.Add(new RowDefinition { Height = 1});
					g.RowDefinitions.Add(new RowDefinition { Height = height });
					g.ColumnDefinitions.Add(new ColumnDefinition { Width = height });
					Grid g2 = new Grid();
					g.Children.Add(b,0,1);
					g2.Children.Add(g);
					grid.Children.Add(g2, column, row);
					b.Clicked += (sender, e) =>
					{
						App.coreView.setContentViewWithQueue(new ListsAndButtons(profiles, groups, false, buttons));
					};

					break;
				}
			}

			if (returnClick)
			{
				await tcs.Task;
			}
			return clickedGroup;
		}
Пример #12
0
		public ListsAndButtons(List<Profile> profiles, List<Group> groups,
							   Event eventInvitingTo, Group groupInvitingTo)
		{
			InitializeComponent();
			createList(profiles, groups, eventInvitingTo, groupInvitingTo, true, true, false);
		}
Пример #13
0
		public MapsView (Event eve)
		{
			InitializeComponent ();
			utilityManager.setMapForEvent (new Position(eve.Latitude, eve.Longitude), map, mapLayout);
			utilityManager.setPin(new Position(eve.Latitude, eve.Longitude), map, eve.Title, eve.AddressName);
			this.eve = eve;
			searchList.IsVisible = false;
			searchList.HeightRequest=0;
			selectButton.IsVisible = false;
			searchBar.IsVisible = false;
		}
Пример #14
0
		async void addEventMenu(Event eve)
		{
			App.coreView.topBar.setRightButton("ic_menu.png").Clicked += async (sender, e) =>
			{
				List<Action> actions = new List<Action>();
				List<string> titles = new List<string>();
				List<string> images = new List<string>();

				actions.Add(() => { _dataManager.AttendTrackEvent(eve, !eve.Followers.Exists(p => p.ProfileId == App.StoredUserFacebookId), false); });
				titles.Add(eve.Followers.Exists(p => p.ProfileId == App.StoredUserFacebookId) == true ? "Unfollow" : "Follow");
				images.Add("ic_paw.png");

				actions.Add(() => { App.coreView.DisplayShare(eve); });
				titles.Add("Share");
				images.Add("ic_share.png");

				if (_dataManager.IsEventYours(eve))
				{
					actions.Add(() => { App.coreView.setContentViewWithQueue(new InviteListView(eve, false)); });
					titles.Add("Invite Attendees");
					images.Add("ic_add_profiles.png");

					if (eve.GroupOwner == null)
					{
						actions.Add(() => { App.coreView.setContentViewWithQueue(new InviteListView(eve, true)); });
						titles.Add("Invite Owners");
						images.Add("ic_add_profiles.png");
					}

					actions.Add(() => { App.coreView.setContentViewWithQueue(new CreateEvent(eve, false)); });
					titles.Add("Edit");
					images.Add("ic_edit.png");

					if (eve.ProfileOwners != null && eve.ProfileOwners.Count > 1)
					{
						actions.Add(async () => { await _dataManager.EventApiManager.AcceptDeclineLeaveEventAsOwner(eve.EventId, OwnerHandlingType.Leave); });
						titles.Add("Leave");
						images.Add("ic_settings.png");
					}
					else if (_dataManager.IsEventJoined(eve)){
						actions.Add(() => { App.coreView._dataManager.AttendTrackEvent(eve, false, true); });
						titles.Add("Leave Event");
						images.Add("ic_manage.png");
					}
				}
				else {

					if (_dataManager.IsEventJoined(eve))
					{
						actions.Add(() => { App.coreView._dataManager.AttendTrackEvent(eve, false, true); });
						titles.Add("Leave Event");
						images.Add("ic_manage.png");
					}
				}
				await App.coreView.DisplayOptions(actions, titles, images);
			};
		}
Пример #15
0
		async void SetEventInspect(Event eve)
		{
			try
			{
				this.eve = eve;
				eve = await _dataManager.EventApiManager.GetEventById(eve.EventId);
				this.eve = eve;

				addEventMenu(eve);


				infoView.Content = new InspectEvent(eve, _dataManager.IsEventJoined(eve), scrollView);

				if (eve.Attendees.Count > 0)
				{
					addNewElement(new ListsAndButtons(eve.Attendees, null, true, false), "Attendees", eve.Attendees.Count);
				}

				if (_dataManager.IsEventJoined(eve) || _dataManager.IsEventYours(eve))
				{
					StackLayout wall = new StackLayout();
					conversationView = new ConversationView(eve.Comments, MessageApiManager.CommentType.EventComment, eve.EventId, wall);
					wall.Children.Add(conversationView);
					addWallElement(wall, "Wall", eve.EventId, ConversationModelType.Event);
				}
			}
			catch (Exception ex)
			{
				App.coreView.displayAlertMessage("Error", "Error loading content", "Ok");
				App.coreView.returnToPreviousView();
			}
		}
Пример #16
0
		/*
		public InspectController(Organization organization)
		{
			InitializeComponent();
			if (organization != null)
			{
				Title = organization.Name;
				SetOrganizationInspect(organization);
				_dataManager.setUpdateSeen(organization.OrganizationId, NotificationModelType.Organization);
			}
		}

		async void SetOrganizationInspect(Organization organization)
		{
			try
			{
				organization = await _dataManager.OrganizationApiManager.GetOrganization(organization.OrganizationId);
				infoView.Content = new OrganizationDesignView(organization, 200, GenericDesignView.Design.ShowAll);


				if (organization.Members.Exists(p => p.ProfileId == App.userProfile.ProfileId))
				{
					if (organization.Members.Count > 0)
					{
						addNewElement(new ListsAndButtons(organization.Members, null, null, true, false), "Members", organization.Members.Count);
					}
					if(organization.NumberOfActiveEvents > 0)addNewElement(new EventListView(organization), "Events", organization.NumberOfActiveEvents);
					StackLayout wall = new StackLayout();
					conversationView = new ConversationView(organization.Comments, MessageApiManager.CommentType.OrganizationComment, organization.OrganizationId, wall);
					wall.Children.Add(conversationView);
					addWallElement(wall, "Wall", organization.OrganizationId, ConversationModelType.Organization);
				}
			}
			catch (Exception ex)
			{
				App.coreView.displayAlertMessage("Error", "Error loading content", "Ok");
				App.coreView.returnToPreviousView();
			}
		}*/

		public InspectController(Event eve)
		{
			InitializeComponent();
			if (eve != null)
			{
				Title = eve.Title;
				SetEventInspect(eve);
				_dataManager.setUpdateSeen(eve.EventId, NotificationModelType.Event);
			}
		}
Пример #17
0
		private async Task getGroupClicked(ListsAndButtons lab, Event eve)
		{
			eve.GroupOwner = await lab.createList(null, App.userProfile.GroupsOwned, null, null, false, false, true);
			EventArgs e = new EventArgs();
			testEvent(null, e);
		}
Пример #18
0
		public EventForLists (Event theGivenEvent)
		{
			eve = theGivenEvent;
			Banner = eve.ImageSource;



			if (eve.ProfileOwners != null)
			{
				ProfileImageSource = eve.ProfileOwners[0].ImageSource;
				EventHolder = eve.ProfileOwners[0].Name;
				//EventHolderView = new ProfileDesignView(eve.ProfileOwners[0], 60, true, GenericDesignView.Design.OnlyImage);
				GroupOwner = false;
			}
			else if(eve.GroupOwner != null){
				ProfileImageSource = eve.GroupOwner.ImageSource;
				EventHolder = eve.GroupOwner.Name;
				//EventHolderView = new GroupDesignView(eve.GroupOwner, 60, GenericDesignView.Design.OnlyImage);
				GroupOwner = true;
			}
			/*
			if (eve.GroupSpecific != null)
			{
				ForSpecificGroup = true;
				SpecificGroupText = "" + eve.GroupSpecific.Name + "";
				SpecificGroupImageSource = eve.GroupSpecific.ImageSource;
			} */

			BannerHeight = (0.56 * App.coreView.Width) - 30;
			InspectBannerHeight = (0.56 * App.coreView.Width);
			InspectHalfBannerHeight = InspectBannerHeight / 2;

			Title = eve.Title;
			Position position = App.lastKnownPosition;
			Distance = util.distance(new Position(eve.Latitude, eve.Longitude), position);
			var Times = util.setTime (eve.StartDate);

			int attendees = eve.NumberOfAttendees;
			/*
			if (eve.Attendees != null)
			{
				attendees = eve.Attendees.Count + 1;
			}
			else {
				attendees = eve.NumberOfAttendees;
			} */

			EventVisibilityString = "Public";
			if (eve.Visibility == EventVisibility.Private)
			{
				EventVisibilityString = "Private";
			}


			attendingInfo = attendees + "/" + eve.MaxSize;

			topTime = eve.StartDate.ToString("ddd dd MMM");
			bottomTime = eve.StartDate.ToString("HH:mm") + "-" + eve.EndDate.ToString("HH:mm");

			topProfileTime = eve.StartDate.ToString("dd");
			bottomProfileTime = eve.StartDate.ToString("MMM");

			topDist = Distance + " km";

			allTime = bottomTime + " " + topTime;
			allDist = bottomDist + " " + topDist + " away";

			string[] addressList = new string[3];
			addressList = Regex.Split(eve.AddressName, ",");
			for (int i = 0; i < addressList.Length; i++)
			{
				Label label = new Label() { TextColor = Color.FromHex("646464") };
				label.Text = addressList[i];
				label.FontSize = 14;
			}
			if (addressList.Length == 2)
			{
				bottomDist = addressList[0].Substring(5).Trim();
			}
			else {
				bottomDist = addressList[1].Substring(5).Trim();
			}

			if (eve.EventTypes.Count != 0) {
				EventType1 = eve.EventTypes [0] + "";
				EventCategory1 = "category_" + eve.EventTypes[0].ToString().ToLower() + "_ic.jpg";
			}
			if (eve.EventTypes.Count > 1) {
				EventType2 = eve.EventTypes [1] + "";
				EventType2Visible = true;
				EventCategory2 = "category_" + eve.EventTypes[1].ToString().ToLower() + "_ic.jpg";
			}
			if (eve.EventTypes.Count > 2) {
				EventType3 = eve.EventTypes [2] + "";
				EventType3Visible = true;
				EventCategory3 = "category_" + eve.EventTypes[2].ToString().ToLower() + "_ic.jpg";
			}


		}
Пример #19
0
		public async Task<bool> DisplayShare(Event eve)
		{
			TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>();
			bool answer = false;
			ShareLayout.IsVisible = true;


			closeShare.Clicked += (sender, e) =>
			{
				tcs.TrySetResult(true);
			};

			CalenderBtn.Clicked += async (sender, e) =>
			{
				ShareLayout.IsVisible = false;
				bool success = await App.coreView.displayConfirmMessage("Add Event To Calendar", "Would you like to add this event to your calendar ?", "yes", "no");
				if (success)
				{
					success = await DependencyService.Get<SocialController>().addEventToCalendar(eve);
					if (!success) await App.coreView.displayAlertMessage("Error", "An error occured and event was not added to calendar", "ok");
				}
			};
			await tcs.Task;
			ShareLayout.IsVisible = false;
			return answer;
		}
Пример #20
0
		public async Task<bool> AttendTrackEvent(Event eve, bool attendOrUnattend, bool joinOrTrack)
		{
			var Continue = false;
			string action = "";
			if (joinOrTrack)
			{
				if (attendOrUnattend)
				{
					action = "You are about to join an event, continue?";
					Continue = await App.coreView.displayConfirmMessage("Join", action, "Yes", "No");
				}
				else {
					action = "You are about to leave an event, continue?";
					Continue = await App.coreView.displayConfirmMessage("Leave", action, "Yes", "No");
				}
			}
			else {
				Continue = true;
			}


			if (Continue)
			{
				bool success = await EventApiManager.AttendOrTrackEvent(eve.EventId, attendOrUnattend, joinOrTrack);
				if (!success)
				{
					await App.coreView.displayAlertMessage("Error", "An error happened and one or more profiles was not invited", "Ok");
					return false;
				}
				else {
					if (App.coreView.contentViews.Count > 1)
					{
						App.coreView.setContentViewReplaceCurrent(new InspectController(await App.coreView._dataManager.EventApiManager.GetEventById(eve.EventId)), 1);
					}
					App.coreView.updateHomeView();
					return true;
				}
			}
			App.coreView.GetLoggedInProfile();
			return Continue;
		}
Пример #21
0
		public async void setInfo (Event eve)
		{
			quickInfo.IsVisible = true;
			//detailedInfo.IsVisible = false;

			//topTime.Text = eve.StartDate.ToString("ddd dd MMM");
			//bottomTime.Text = eve.StartDate.ToString("HH:mm") + "-" + eve.EndDate.ToString("HH:mm");

			//topDist.Text = efl.Distance + " km";
			eventDescription.Text = eve.Description;
			//StartTime.Text = "" + eve.StartDate.DayOfWeek + " the " + eve.StartDate.Day + " " + eve.StartDate.ToString("MMMM").ToLower();
			//EndTime.Text =  _dataManager.UtilityManager.getTime(eve.StartDate) + " - " + _dataManager.UtilityManager.getTime(eve.EndDate);

			string [] addressList = new string [3];
			addressList = Regex.Split(eve.AddressName, ",");
			for (int i = 0; i < addressList.Length; i++) { 
				Label label = new Label () {TextColor = Color.FromHex("646464")}; 
				label.Text = addressList [i].Trim();
				label.FontSize = 14;
				addressLayout.Children.Add(label);
			}
			if (addressList.Length == 2)
			{
				//bottomDist.Text = addressList[0].Substring(5).Trim();
			}
			else {
				//bottomDist.Text = addressList[1].Substring(5).Trim();
			}
		}
Пример #22
0
		public bool IsEventYours(Event eve)
		{
			bool yours = false;
			if ((eve.ProfileOwners != null && eve.ProfileOwners.Exists(p => p.ProfileId == App.StoredUserFacebookId)) || (eve.GroupOwner != null && eve.GroupOwner.ProfileOwners.Exists(p => p.ProfileId == App.StoredUserFacebookId)))
			{
				yours = true;
			}
			return yours;
		}
Пример #23
0
		private async void LaunchEvent(Event eventToCreate)
		{
			App.coreView.IsLoading(true);
			if (imageStreams != null)
			{
				eventToCreate.ImageSource = await _dataManager.UtilityManager.UploadImageToStorage(new MemoryStream(imageStreams[2]), App.StoredUserFacebookId + "." + DateTime.Now.ToString("G"));
			}
			if (eventToCreate.GroupOwner == null)
			{
				eventToCreate.ProfileOwners = new List<Profile> { App.userProfile };
			}

			if (String.IsNullOrWhiteSpace (eventToCreate.Title)) {
				await App.coreView.displayAlertMessage ("Title Missing", "Title is missing", "Ok");
			} else if (String.IsNullOrWhiteSpace (eventToCreate.Description)) {
				await App.coreView.displayAlertMessage ("Description Missing", "Description is missing", "Ok");
			} else if ((eventToCreate.MaxSize == -1) || !validAttendingAmount) {
				await App.coreView.displayAlertMessage("Attendendees Needed Missing", "", "Ok");
			} else if (eventToCreate.EventTypes.Count == 0) {
				await App.coreView.displayAlertMessage ("EventTypes Missing", "No Event Type has been selected", "Ok");
			} else if (String.IsNullOrWhiteSpace (eventToCreate.AddressName) || eventToCreate.Latitude == 0) {
				await App.coreView.displayAlertMessage ("Address Missing", "No valid address has been selected", "Ok");
			} else if (String.IsNullOrWhiteSpace (eventToCreate.ImageSource)) {
				await App.coreView.displayAlertMessage ("Banner Missing", "No banner has been selected", "Ok");
			}else {
				
				eventToCreate.MinAge = 0;
				eventToCreate.MaxAge = 100;
				eventToCreate.MinSize = 1;


				Event eventCreated = await _dataManager.EventApiManager.CreateEditEvent(eventToCreate);

				if (eventCreated != null) {
					eventCreated.Attendees = new List<Profile> ();
					eventCreated.Followers = new List<Profile> ();
					InspectController inspect = new InspectController(eventCreated);
					if (isCreate)
					{
						App.coreView.setContentViewWithQueue(inspect);
						App.coreView.updateHomeView();
					}
					else {
						App.coreView.setContentViewReplaceCurrent(inspect, 2);
					}
					//setCreateView(new Event(), true);
					App.coreView.createEvent = new CreateEvent(new Event(), true);
					App.coreView.updateCreateViews();

				} else {
					await App.coreView.displayAlertMessage ("Error", "Event not created, try again", "Ok");
				}
			}
			Launching = false;
			App.coreView.IsLoading(false);
		}
Пример #24
0
		public async Task<bool> sendProfilesInviteToEvent(Event eve, List<Profile> profiles)
		{
			bool success = await EventApiManager.InviteProfilesToEvent(eve.EventId, profiles);
			if (!success)
			{
				await App.coreView.displayAlertMessage("Error", "An error happened and one or more profiles was not invited", "Ok");
				return false;
			}
			else {
				return true;
			}
		}