示例#1
0
        public UserStartSurvey(UserProductSurveyTemplateModel taskInfo)
        {
            FetchUserActiveSurveyDetailByRefKeyFromServer(taskInfo.refKey);
            var layout = new StackLayout();
            var label = new Label
            {
                Text = "start survey page",
                VerticalOptions = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
            };            
            layout.Children.Add(label);
            //layout.Children.Add(logoutButton);
            //Content = layout;            
             Children.Add(new ContentPage {Content = new BoxView {Color = new Color (1, 0, 0)}, Title = "Page 1"});
            Children.Add(new ContentPage {Content = new BoxView {Color = new Color(1, 0, 0)}, Title = "Page 1"});
            Children.Add(new ContentPage {Content = new BoxView {Color = new Color(0, 1, 0)}, Title = "Page 2"});
            Children.Add(new ContentPage {Content = new BoxView {Color = new Color (0, 0, 1)}, Title = "Page 3"});            

        }
        public UserActiveTaskInformation(UserProductSurveyTemplateModel taskInfo)
        {
            globalTaskInfo = taskInfo;
            var titleLabel = new Label
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Font = Font.SystemFontOfSize(NamedSize.Large),
                BindingContext = taskInfo
            };
            titleLabel.SetBinding(Label.TextProperty, "title");

            var detailLabel = new Label
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Font = Font.SystemFontOfSize(NamedSize.Medium),
                BindingContext = taskInfo
                //Font = Fonts.Twitter
            };

            var totalThreadLabel = new Label
            {
                Text = "CITs Total:",
                Font = Font.SystemFontOfSize(NamedSize.Medium)
            };

            var totalThreadData = new Label
            {
                TextColor = Color.Yellow,
                Font = Font.SystemFontOfSize(NamedSize.Medium),
                BindingContext = taskInfo
            };
            totalThreadData.SetBinding(Label.TextProperty, "totalThreads");

            var remainingThreadLabel = new Label
            {
                Text = " Remaining:",
                Font = Font.SystemFontOfSize(NamedSize.Medium)
            };
            var remainingThreadData = new Label
            {
                TextColor = Color.Red,
                Font = Font.SystemFontOfSize(NamedSize.Medium),
                BindingContext = taskInfo
            };
            remainingThreadData.SetBinding(Label.TextProperty, "remainingThreads");

            var taskInfoLayout = new StackLayout()
            {
                Orientation = StackOrientation.Horizontal,
                Children = {totalThreadLabel, totalThreadData, remainingThreadLabel, remainingThreadData}
            };

            var maxEarningLabel = new Label
            {
                Text = "Max Earning:",
                Font = Font.SystemFontOfSize(NamedSize.Medium)
            };

            var earningCurrencyData = new Label
            {
                TextColor = Color.Yellow,
                Font = Font.SystemFontOfSize(NamedSize.Medium),
                BindingContext = taskInfo
            };
            earningCurrencyData.SetBinding(Label.TextProperty, "currency");

            var maxEarningData = new Label
            {
                TextColor = Color.Yellow,
                Font = Font.SystemFontOfSize(NamedSize.Medium),
                BindingContext = taskInfo
            };
            maxEarningData.SetBinding(Label.TextProperty, "earningPerThreads");

            var paymentInfoLayout = new StackLayout()
            {
                Orientation = StackOrientation.Horizontal,
                Children = {maxEarningLabel, earningCurrencyData, maxEarningData},
            };

            detailLabel.SetBinding(Label.TextProperty, "title");

            var warningInfo = new Label
            {
                TextColor = Color.Red,
                Font = Font.SystemFontOfSize(NamedSize.Medium),
                Text =
                    "After accepting you have to complete the job within 10 min, failing to do so will result in decrease in your reputation level. only accept if you will be able to complete the job within 10 mins of time span."
            };

            var startTaskButton = new Button
            {
                Text = "Start this CIT",
                Font = Font.SystemFontOfSize(NamedSize.Micro),
                HorizontalOptions = LayoutOptions.FillAndExpand,
                BackgroundColor = Color.Green,
                TextColor = Color.White
            };
            startTaskButton.Clicked += startTaskButton_Clicked;
            ;

            var iCantDoThis = new Button
            {
                Text = "I won't be able to do it",
                Font = Font.SystemFontOfSize(NamedSize.Micro),
                HorizontalOptions = LayoutOptions.FillAndExpand,
                BackgroundColor = Color.Red,
                TextColor = Color.White
            };

            var buttonInfoLayout = new StackLayout()
            {
                Orientation = StackOrientation.Horizontal,
                Children = {startTaskButton, iCantDoThis},
            };

            var taskImage = new Image
            {
                Aspect = Aspect.AspectFit,
                VerticalOptions = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                Source = ImageSource.FromUri(new Uri("http://i.imgur.com/sn0Croys.jpg")),
                WidthRequest = 200,
                HeightRequest = 200,
            };

            var nameLayout = new StackLayout()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Orientation = StackOrientation.Vertical,
                Children =
                {
                    taskImage,
                    titleLabel,
                    detailLabel,
                    taskInfoLayout,
                    paymentInfoLayout,
                    warningInfo,
                    buttonInfoLayout
                }
            };
            Content = nameLayout;
        }