Пример #1
0
		//Design design = Design.ShowAll;

		public GroupDesignView(Group group, int dims, Design design) : base(dims)
		{
			this.group = group;
			try
			{
				SetInfo(group.ImageSource, group.Name, group.Description, design, ModelType.Group);
			}
			catch (Exception ex) { }

			subjBtn.Clicked += (sender, e) => { 
				if (dims >= 200)
				{
					OtherFunctions of = new OtherFunctions();
					of.ViewImages(new List<string>() { group.ImageSource });
					//subjBtn.Clicked += (sender, e) => { App.coreView.setContentViewReplaceCurrent(new InspectController(group), 1); };
				}
				else {
					App.coreView.setContentViewWithQueue(new InspectController(group));
				}
			};

			setInfo(dims);
		}
Пример #2
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);
			};
		}
Пример #3
0
		public async void SetupButtons(bool clickable)
		{

			profile = await _dataManager.ProfileApiManager.GetProfile(profile.ProfileId);

			subjBtn.Clicked += (sender, e) =>
			{
				if (clickable)
				{
					_dataManager.setUpdateSeen(profile.ProfileId, NotificationModelType.Profile);
					App.coreView.setContentViewWithQueue(new InspectController(profile));
				}
				else {
					OtherFunctions of = new OtherFunctions();
					of.ViewImages(new List<string>() { profile.ImageSource });
				}
			};

			Profile updateProfile = App.userProfile;
			bool edit = false;

			editBtn.Text = "Edit";
			editBtn.Clicked += (sender, e) => { 
				ShowHideEditLayout(!edit);
				if (edit)
				{
					SetInfo(profile.ImageSource, profile.Name, profile.Description, design, ModelType.Profile);
				}
				edit = !edit;
			};

			var pictureImage = new TapGestureRecognizer();
			pictureImage.Tapped += async (sender, e) =>
			{
				imageStreams = await _dataManager.UtilityManager.TakePicture(profileImage.Source);
			};
			pictureButton.GestureRecognizers.Add(pictureImage);

			var albumImage = new TapGestureRecognizer();
			albumImage.Tapped += async (SenderOfEvent, e) =>
			{
				imageStreams = await _dataManager.UtilityManager.PictureFromAlbum(profileImage.Source);
			};
			albumButton.GestureRecognizers.Add(albumImage);

			fbImageButton.Clicked += (sender, e) =>
			{
				updateProfile.SmallImageSource = "https://graph.facebook.com/v2.5/" + App.userProfile.ProfileId + "/picture?height=50&width=50";
				updateProfile.ImageSource = "https://graph.facebook.com/v2.5/" + App.userProfile.ProfileId + "/picture?height=100&width=100";
				updateProfile.LargeImageSource = "https://graph.facebook.com/v2.5/" + App.userProfile.ProfileId + "/picture?height=300&width=300";
				profileImage.Source = updateProfile.ImageSource;
				imageStreams = null;
			};

			updateProfileBtn.Clicked += async  (sender, e) =>
			{
				App.coreView.IsLoading(true);
				if (imageStreams != null)
				{
					updateProfile.SmallImageSource = await _dataManager.UtilityManager.UploadImageToStorage(new MemoryStream(imageStreams[0]), App.StoredUserFacebookId + "." + DateTime.Now.ToString("G") + ".small");
					updateProfile.ImageSource = await _dataManager.UtilityManager.UploadImageToStorage(new MemoryStream(imageStreams[1]), App.StoredUserFacebookId + "." + DateTime.Now.ToString("G")+".medium");
					updateProfile.LargeImageSource = await _dataManager.UtilityManager.UploadImageToStorage(new MemoryStream(imageStreams[2]), App.StoredUserFacebookId + "." + DateTime.Now.ToString("G") + ".large");
				}
				updateProfile.Description = descriptionEdit.Text;
				bool success = await _dataManager.ProfileApiManager.CreateUpdateProfile(updateProfile, false);
				if (success)
				{
					//App.coreView.homeView = new HomeView();
					await App.coreView.updateHomeView();
					App.coreView.setContentView(4);
				}
				App.coreView.IsLoading(false);

				ShowHideEditLayout(false);
				edit = false;
			};

			profileLogOutBtn.Clicked += async (sender, e) =>
			{
				await App.storeToken("","","");
				await Navigation.PushModalAsync(new LoginPage());
			};

			try
			{
				//profile = await _dataManager.ProfileApiManager.GetProfile(profile.ProfileId);
				string d = profile.Description != null ? profile.Description : "";
				SetInfo(profile.ImageSource, profile.Name, d, design, ModelType.Profile);
			}
			catch (Exception e) {}
		}