/*
		public async Task GoToSelectedOrganization(string id)
		{
			IsLoading(true);
			Organization org = await _dataManager.OrganizationApiManager.GetOrganization(id);
			InspectController inspect = new InspectController(org);
			setContentViewWithQueue(inspect);
			IsLoading(false);
		} */

		public async Task GoToSelectedConversation(string id)
		{
			IsLoading(true);
			Conversation con = await _dataManager.MessageApiManager.GetOneConversation(id);
			ConversationView conV = new ConversationView(con);
			setContentViewWithQueue(conV);
			IsLoading(false);
		}
		public void addConversationViewToActiveList(ConversationView convView)
		{
			activeConversationViews.Add(convView);
		}
		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();
			}
		}
		public async void setContentView (int type)
		{
			topBar.hideAll();
			if(contentViews.Count > 0) contentViews[contentViews.Count-1].viewExitFocus();
			//await Task.Delay(2);
			DependencyService.Get<ForceCloseKeyboard>().CloseKeyboard();
			ViewModelInterface view = null;
			viewdConversation = null;

			updateHomeView();

			if (type == 0) { view = createView; 
			} else if (type == 1) {  view = joinedEventView;
			} else if (type == 2) {  view = searchEventView; 
			} else if (type == 3) { view = conversatios; 
			} else if (type == 4) { 
				//await updateHomeView();
				view = myProfile; 
			}

			if ((type == 1 || type == 2))
			{
				if (!topBarHidden)
					hideTopBar(-1);
			}
			else {
				if (topBarHidden)
					hideTopBar(1);
			}

			lastCoreView = type;


			activeConversationViews.Clear();
			contentViews.Clear ();
			contentViews.Add (view);
			//changeView(view);
			mainView.Content = view.getContentView();
			view.viewInFocus(topBar);
		}
		async void SetGroupInspect(Group userGroup)
		{
			try
			{
				this.grp = userGroup;
				userGroup = await _dataManager.GroupApiManager.GetGroup(userGroup.GroupId);
				this.grp = userGroup;
				addGroupMenu(userGroup);

				infoView.Content = new GroupDesignView(userGroup, 200, GenericDesignView.Design.ShowAll);
				infoView.Padding = new Thickness(0, 10, 0, 0);

				if (_dataManager.AreYouGroupMember(userGroup))
				{
					if (userGroup.ProfilesRequestingToJoin.Count > 0)
					{
						addNewElement(new ListsAndButtons(userGroup.ProfilesRequestingToJoin, null, null, userGroup), "Requesting To Join", userGroup.ProfilesRequestingToJoin.Count);
					}

					addNewElement(new ListsAndButtons(userGroup.ProfileOwners, null, true, false), "Owners", userGroup.ProfileOwners.Count);
					if (userGroup.Members.Count > 0)
					{
						addNewElement(new ListsAndButtons(userGroup.Members, null, true, false), "Members", userGroup.Members.Count);
					}

					if (userGroup.NumberOfActiveEvents > 0) addNewElement(new EventListView(userGroup), "Events", userGroup.NumberOfActiveEvents);
					StackLayout wall = new StackLayout();
					conversationView = new ConversationView(userGroup.Comments, MessageApiManager.CommentType.GroupComment, userGroup.GroupId, wall);
					wall.Children.Add(conversationView);
					addWallElement(wall, "Wall", userGroup.GroupId, ConversationModelType.Group);
				}
			}catch (Exception ex) {
				App.coreView.displayAlertMessage("Error", "Error loading content", "Ok");
				App.coreView.returnToPreviousView(); 
			}
		}