Ejemplo n.º 1
0
		public async void  OnSubmit (object sender, EventArgs e)
		{
			string postTitle = PostTitle.Text;
			string postContent = PostContent.Text;
			string authorName = ((App)Application.Current).UserEmail;

			if (postTitle != "") {
				if (postContent != "") {
						Forum1Post new_post = new Forum1Post (postTitle,postContent,authorName);
						var database = new Forum1DB ();
						database.InsertNewPost (new_post);
									}
			}
		}
Ejemplo n.º 2
0
        public static List<Forum1Post> CreatePosts()
        {
            //fpost 1 = variable hold datas, Forum1Post = get set method, post_f1 = temporary data
            var postDB = new Forum1DB();

            List<Forum1Post> fpost1 = new List<Forum1Post>();

            for (int i = 0; i < Forum1PostTitle.Count ; i++) {
                string title   = Forum1PostTitle [i];
                string content_f1 = Forum1PostContent [i];
                Forum1Post post_f1 = new Forum1Post();
                post_f1.Forum1PostTitle = title;
                post_f1.Forum1PostContent = content_f1;
                fpost1.Add (post_f1);

            }
            return fpost1;
        }
Ejemplo n.º 3
0
		public Forum1Content(Forum1Post post){
			f1vm = new Forum1ContentViewModel ();
			BindingContext = f1vm;
			Post = post;
			InitializeComponent ();

			StackLayout layout = new StackLayout(){
				Spacing = 10,
				Orientation = StackOrientation.Horizontal
			};

			StackLayout layout2 = new StackLayout(){
				Spacing = 10,
				HorizontalOptions = LayoutOptions.FillAndExpand,
			};

			StackLayout layout3 = new StackLayout(){
				Padding = 20,
				Spacing = 155,
				Orientation = StackOrientation.Vertical
			};

			StackLayout layout4 = new StackLayout(){
				Spacing = 20,
				Orientation = StackOrientation.Horizontal,
			};

			StackLayout layout5 = new StackLayout(){
				Spacing = 20,
				Orientation = StackOrientation.Vertical,
			};

			StackLayout layout6 = new StackLayout(){
				Spacing = 20,
				Orientation = StackOrientation.Horizontal,
			};

			Label label = new Label{
				Text = Post.Forum1PostTitle,
				FontSize = 18,
				TextColor = Color.White
			};
					
			Label label2 = new Label{
				Text = Post.Forum1PostContent,
				FontSize = 14,
				TextColor = Color.White
			};

			BoxView label3 = new BoxView{
				HeightRequest = 1,
				Color = Color.Black,
				HorizontalOptions = LayoutOptions.FillAndExpand
			};

			Label label4 = new Label {
				Text = "Add Comment",
				FontSize = 18,
				TextColor = Color.White
			};

			Editor label5 = new Editor {
				BackgroundColor = Color.White,
				WidthRequest = 100,
			};

			BoxView label6 = new BoxView{
				HeightRequest = 0.5,
				Color = Color.White,
				HorizontalOptions = LayoutOptions.FillAndExpand
			};

			BoxView label9 = new BoxView{
				HeightRequest = 0.5,
				Color = Color.White,
				HorizontalOptions = LayoutOptions.FillAndExpand
			};

			Button label8 = new Button {
				BackgroundColor = Color.White,
				Text = "Add",
				FontSize = 10,
				HeightRequest = 40,
				WidthRequest = 60,
				TextColor = Color.Black,
				HorizontalOptions = LayoutOptions.End,
			};

			var photo = new RoundedBoxView(){
				WidthRequest = 45,
				HeightRequest = 45,
				HorizontalOptions = LayoutOptions.Center,
			};
			photo.Source = ImageSource.FromFile("xen.jpg");

			var photo2 = new RoundedBoxView(){
				WidthRequest = 45,
				HeightRequest = 45,
				HorizontalOptions = LayoutOptions.Center,
			};
			photo2.Source = ImageSource.FromFile("images.jpg");

			var photo3 = new RoundedBoxView(){
				WidthRequest = 45,
				HeightRequest = 45,
				VerticalOptions = LayoutOptions.Center
			};
			photo3.Source = ImageSource.FromFile("images.jpg");

			Label label7 = new Label{
				Text = "You are real idiot",
				FontSize = 14,
				TextColor = Color.White
			};

			layout4.Children.Add(photo);
			layout4.Children.Add(label2);

			layout6.Children.Add(photo2);
			layout6.Children.Add(label7);

			layout5.Children.Add(label);
			layout5.Children.Add(label3);
			layout5.Children.Add (layout4);
			layout5.Children.Add (label6);

			layout5.Children.Add (layout6);
			layout5.Children.Add (label9);

			layout2.Children.Add(label4);
			layout2.Children.Add(label5);
			layout2.Children.Add(label8);

			//user's photo comment box
			layout.Children.Add(photo3);
			layout.Children.Add(layout2);

//			layout3.Children.Add (layout5);
//			layout3.Children.Add (layout);
			Content.Children.Insert (0, layout5);
			Content.Children.Insert (1, layout);

			this.Content = Content;

		}