コード例 #1
0
        public Choose_LayoutDefaults_Layout(IEnumerable <VisualDefaults> choices)
        {
            // title
            Vertical_GridLayout_Builder builder = new Vertical_GridLayout_Builder();

            builder.AddLayout(new TextblockLayout("Choose a theme!"));

            Editor sampleTextbox = new Editor();

            // There's a bug in Uniforms.Misc where it saves the first font you ask about and always returns sizes for that font
            sampleTextbox.Text = "Sample editable text";
            builder.AddLayout(new TextboxLayout(sampleTextbox));

            // individual themes
            List <VisualDefaults> choiceList = new List <VisualDefaults>(choices);
            int        numColumns            = 2;
            int        numRows = (choiceList.Count + 1) / 2;
            GridLayout grid    = GridLayout.New(BoundProperty_List.Uniform(numRows), BoundProperty_List.Uniform(numColumns), LayoutScore.Zero);

            foreach (VisualDefaults choice in choiceList)
            {
                // add a separator so the user can see when it changes
                OverrideLayoutDefaults_Layout container = new OverrideLayoutDefaults_Layout(choice);
                container.SubLayout = this.makeDemoLayout(choice);
                grid.AddLayout(container);
            }
            builder.AddLayout(grid);

            // scrollable
            this.SubLayout = ScrollLayout.New(builder.Build());
        }
コード例 #2
0
        private LayoutChoice_Set makeHelpLayout(bool hasActivities)
        {
            Vertical_GridLayout_Builder builder = new Vertical_GridLayout_Builder();

            builder.AddLayout(new TextblockLayout("This screen is where you will be able to view statistics about things you've done."));
            builder.AddLayout(
                new HelpButtonLayout("There will be cool graphs!",
                                     new HelpWindowBuilder()
                                     .AddMessage("After you've entered some data, this screen will allow you analyze your data in lots of cool ways.")
                                     .AddMessage("You will be able to view a graph of your data, including how much time you spent, how much you liked it, and " +
                                                 "how efficient you were.")
                                     .AddMessage("You will be able to reminisce about your most favorite events and read any nice comment you entered for them.")
                                     .AddMessage("You will be able to search for the most significant events to have happened to you and contemplate how to make the " +
                                                 "happy events occur more often and the sad events occur less often.")
                                     .Build(),
                                     this.layoutStack
                                     )
                );
            builder.AddLayout(new TextblockLayout("Before you can browse things that you've done, you need to go back and do these things first:"));
            if (!hasActivities)
            {
                Button visitActivitiesButton = new Button();
                visitActivitiesButton.Clicked += VisitActivitiesButton_Clicked;
                builder.AddLayout(new ButtonLayout(visitActivitiesButton, "Enter an activity that you like to do"));
            }
            Button recordParticipationsButton = new Button();

            recordParticipationsButton.Clicked += RecordParticipationsButton_Clicked;
            builder.AddLayout(new ButtonLayout(recordParticipationsButton, "Record having participated in an activity"));
            return(builder.Build());
        }
コード例 #3
0
 private void update()
 {
     if (this.protoActivity_database.ProtoActivities.Count() < 1)
     {
         this.SubLayout = new TextblockLayout("No protoactivities!");
     }
     else
     {
         GridLayout_Builder   builder         = new Vertical_GridLayout_Builder().Uniform();
         List <ProtoActivity> protoActivities = new List <ProtoActivity>(protoActivity_database.ProtoActivities);
         protoActivities.Reverse();
         if (this.startIndex < 0)
         {
             this.startIndex = 0;
         }
         if (startIndex >= protoActivities.Count)
         {
             startIndex = protoActivities.Count - 1;
         }
         int endIndex = Math.Min(startIndex + this.pageCount, protoActivities.Count);
         if (this.startIndex > 0)
         {
             builder.AddLayout(this.prevButtonLayout);
         }
         for (int i = startIndex; i < endIndex; i++)
         {
             builder.AddLayout(this.summarize(protoActivities[i]));
         }
         if (endIndex < protoActivities.Count)
         {
             builder.AddLayout(this.nextButtonLayout);
         }
         this.SubLayout = ScrollLayout.New(builder.BuildAnyLayout());
     }
 }
コード例 #4
0
        private void ConfirmButton_Clicked(object sender, EventArgs e)
        {
            DateTime            start    = DateTime.Now;
            EngineTesterResults results  = this.activityRecommender.TestEngine();
            DateTime            end      = DateTime.Now;
            TimeSpan            duration = end.Subtract(start);

            GridLayout_Builder builder = new Vertical_GridLayout_Builder().Uniform()
                                         .AddLayout(new TextblockLayout("Results"))
                                         .AddLayout(this.resultLayout("typical longtermHappinessPredictionIfSuggested error:\n", results.Longterm_PredictionIfSuggested_Error))
                                         .AddLayout(this.resultLayout("typical longtermHappinessPredictionIfParticipated error:\n", results.Longterm_PredictionIfParticipated_Error))
                                         .AddLayout(this.resultLayout("typicalScoreError:\n", results.TypicalScoreError))
                                         .AddLayout(new TextblockLayout("equivalentWeightedProbability:\n" + results.TypicalProbability))
                                         .AddLayout(this.resultLayout("typicalEfficiencyError:\n", results.TypicalEfficiencyError))
                                         .AddLayout(this.resultLayout("typical longtermEfficiencyIfParticipated error:\n", results.Longterm_EfficiencyIfPredicted_Error));

            ParticipationSurprise surprise = results.ParticipationHavingMostSurprisingScore;

            if (surprise != null)
            {
                builder = builder.AddLayout(new TextblockLayout("Most surprising participation: " + surprise.ActivityDescriptor.ActivityName + " at " +
                                                                surprise.Date + ": expected rating " + surprise.ExpectedRating + ", got " + surprise.ActualRating));
            }

            builder = builder.AddLayout(new TextblockLayout("Computed results in " + duration));
            LayoutChoice_Set resultsView = builder.Build();

            this.layoutStack.AddLayout(resultsView, "Test Results");
        }
コード例 #5
0
        private void calculate()
        {
            List <Activity> activities = this.engine.ActivitiesSortedByAverageRating;
            List <string>   texts      = new List <string>();

            GridLayout_Builder gridBuilder = new Vertical_GridLayout_Builder().Uniform();

            foreach (Activity activity in activities)
            {
                string text = "" + activity.Ratings.Mean + " (" + activity.Ratings.Weight + ") : " + activity.Name;
                texts.Add(text);
            }
            string   fileText = String.Join("\n", texts);
            DateTime now      = DateTime.Now;
            string   nowText  = now.ToString("yyyy-MM-dd-HH-mm-ss");
            string   fileName = "ActivityPrefSummary-" + nowText + ".txt";

            Task t = this.fileIo.Share(fileName, fileText);

            t.ContinueWith(task =>
            {
                string title = "Exported " + fileName;
                gridBuilder.AddLayout(new TextblockLayout("(" + title + ")"));
                gridBuilder.AddLayout(new TextblockLayout(" avg (count) : name"));
                foreach (string text in texts)
                {
                    gridBuilder.AddLayout(new TextblockLayout(text));
                }

                LayoutChoice_Set newLayout = ScrollLayout.New(gridBuilder.Build());
                this.layoutStack.AddLayout(newLayout, "Preferences");
            });
        }
コード例 #6
0
        public ActivitySuggestion_Explanation_Layout(ActivitySuggestion_Explanation explanation)
        {
            this.explanation = explanation;
            ActivitySuggestion          suggestion = explanation.Suggestion;
            Vertical_GridLayout_Builder builder    = new Vertical_GridLayout_Builder();

            builder.AddLayout(this.newTextBlock("I suggested " + suggestion.ActivityDescriptor.ActivityName + " at " +
                                                explanation.Suggestion.StartDate.ToString("HH:mm") + "\n"));
            builder.AddLayout(this.newTextBlock("I had time to consider " + suggestion.NumActivitiesConsidered + " activities."));
            if (suggestion.ParticipationProbability != null)
            {
                builder.AddLayout(this.newTextBlock("Participation probability: " + Math.Round(suggestion.ParticipationProbability.Value, 3) + "\n"));
            }
            if (suggestion.PredictedScoreDividedByAverage != null)
            {
                builder.AddLayout(this.newTextBlock("Rating: " + Math.Round(explanation.Score, 3) + " (" +
                                                    Math.Round(suggestion.PredictedScoreDividedByAverage.Value, 3) + " x avg)\n"));
            }

            Button explainQuality_button = new Button();

            explainQuality_button.Clicked   += ExplainQuality_button_Clicked;
            explainQuality_button.Text       = "Suggestion quality: " + Math.Round(explanation.SuggestionValue, 3);
            this.suggestionQuality_container = new ContainerLayout();
            builder.AddLayout(this.suggestionQuality_container);
            this.suggestionQuality_container.SubLayout = new ButtonLayout(explainQuality_button);

            this.SubLayout = ScrollLayout.New(builder.Build());
        }
コード例 #7
0
        private void initialize(bool showRatings)
        {
            List <Participation> participations = new List <Participation>(this.participations);

            if (!showRatings)
            {
                this.orderRandomly(participations);
            }

            Vertical_GridLayout_Builder gridBuilder = new Vertical_GridLayout_Builder();

            foreach (Participation participation in participations)
            {
                ParticipationView v = new ParticipationView(participation, this.scoreSummarizer, this.layoutStack, this.engine, showRatings);
                v.AddParticipationComment += Child_AddParticipationComment;
                gridBuilder.AddLayout(v);
            }
            if (!showRatings)
            {
                Button showRatings_button = new Button();
                showRatings_button.Clicked += ShowRatings_button_Clicked;
                showRatings_button.Text     = "Show Ratings";
                ButtonLayout showRatings_layout = new ButtonLayout(showRatings_button);
                gridBuilder.AddLayout(showRatings_layout);
            }
            this.SubLayout = ScrollLayout.New(gridBuilder.BuildAnyLayout());
        }
コード例 #8
0
        public PostView(AnalyzedPost post)
        {
            this.post = post;
            Vertical_GridLayout_Builder mainBuilder  = new Vertical_GridLayout_Builder();
            Vertical_GridLayout_Builder titleBuilder = new Vertical_GridLayout_Builder();

            // post title
            foreach (AnalyzedString component in post.TitleComponents)
            {
                Label label = new Label();
                if (component.Score > 0)
                {
                    label.TextColor = Color.Green;
                }
                else
                {
                    if (component.Score < 0)
                    {
                        label.TextColor = Color.Red;
                    }
                    else
                    {
                        label.TextColor = Color.White;
                    }
                }
                label.BackgroundColor = Color.Black;
                TextblockLayout textBlockLayout = new TextblockLayout(label, 16, false, true);
                textBlockLayout.setText(component.Text);
                titleBuilder.AddLayout(textBlockLayout);
            }
            this.starButton = new Button();
            this.updateStarButton();
            this.starButton.Clicked += SaveButton_Clicked;

            GridLayout topGrid = GridLayout.New(new BoundProperty_List(1), BoundProperty_List.WithRatios(new List <double>()
            {
                5, 1
            }), LayoutScore.Zero);

            topGrid.AddLayout(titleBuilder.BuildAnyLayout());
            topGrid.AddLayout(new ButtonLayout(this.starButton));
            mainBuilder.AddLayout(topGrid);

            this.linkLayout = new TextblockLayout(post.Interaction.Post.Source, 16, false, true);
            this.linkLayout.setBackgroundColor(Color.Black);
            this.updateLinkColor();
            mainBuilder.AddLayout(this.linkLayout);

            Button openButton = new Button();

            mainBuilder.AddLayout(new ButtonLayout(openButton, "Open", 16));
            openButton.Clicked += OpenButton_Clicked;

            this.SubLayout = mainBuilder.BuildAnyLayout();
        }
コード例 #9
0
        private void regenerateEntries()
        {
            List <Inheritance> unchosenInheritances          = this.findUnchosenInheritances();
            List <Inheritance> immediatelyUsableInheritances = this.selectUsableInheritances(unchosenInheritances);

            if (immediatelyUsableInheritances.Count < 1)
            {
                if (this.dismissedInheritances.Count > 0)
                {
                    this.SubLayout = new TextblockLayout("You have already accepted or dismissed all of the built-in activity inheritances. Go back to the Add Activities screen to enter your own!");
                }
                else
                {
                    this.SubLayout = new TextblockLayout("You have already accepted all of the built-in activity inheritances. Go back to the Add Activities screen to enter your own!");
                }
            }
            else
            {
                GridLayout_Builder gridBuilder = new Vertical_GridLayout_Builder().Uniform();
                LayoutChoice_Set   helpLayout  = new HelpWindowBuilder()
                                                 .AddMessage("ActivityRecommender needs to know what you like to do, for providing suggestions, autocomplete, and more.")
                                                 .AddMessage("Do you like any of the activities here?")
                                                 .AddMessage("Selecting 'I like this' on an item of the form 'child (parent)' indicates two things: A: that you believe that the child is encompassed by the parent, and B: that the child is relevant to you.")
                                                 .AddMessage("Pushing the 'I like all kinds' button is equivalent to pushing the 'I like this' button on the given activity and all of its descendants.")
                                                 .AddMessage("Pushing the 'Not Interested' button will simply hide the given activity in this screen")
                                                 .Build();

                gridBuilder.AddLayout(new TextblockLayout("Press everything you like to do! Then go back.\n" +
                                                          "" + unchosenInheritances.Count + " remaining, built-in activity ideas:", 30).AlignHorizontally(TextAlignment.Center));

                int count = 0;
                foreach (Inheritance inheritance in immediatelyUsableInheritances)
                {
                    int numDescendants = this.FindDescendants(inheritance).Count;
                    Import_SpecificActivities_Layout specific = new Import_SpecificActivities_Layout(inheritance, numDescendants);
                    specific.Dismissed      += DismissedInheritance;
                    specific.AcceptedSingle += AcceptedSingleInheritance;
                    specific.AcceptedAll    += AcceptedInheritanceRecursive;
                    gridBuilder.AddLayout(specific);
                    // Don't display too many results at once to avoid taking to long to update the screen.
                    // The user should dismiss the ones they're not interested in, anyway
                    count++;
                    if (count >= 10)
                    {
                        gridBuilder.AddLayout(new TextblockLayout("Dismiss or accept an idea to see more!"));
                        break;
                    }
                }
                gridBuilder.AddLayout(new HelpButtonLayout(helpLayout, this.layoutStack, 30));

                this.SubLayout = ScrollLayout.New(gridBuilder.Build());
            }
        }
コード例 #10
0
        private void explainSuggestionQuality()
        {
            Vertical_GridLayout_Builder builder = new Vertical_GridLayout_Builder();

            builder.AddLayout(new TextblockLayout("Why:", this.maxFontSize));
            builder.AddLayout(new TextblockLayout("Suggestion quality: " + Math.Round(explanation.SuggestionValue, 3), this.maxFontSize));
            int childIndex = 0;

            foreach (Justification child in this.explanation.Reasons)
            {
                builder.AddLayouts(this.renderJustification(child, 0, this.explanation.Suggestion.ActivityDescriptor, childIndex));
                childIndex++;
            }
            this.suggestionQuality_container.SubLayout = builder.BuildAnyLayout();
        }
コード例 #11
0
        public override SpecificLayout GetBestLayout(LayoutQuery query)
        {
            if (this.text == null)
            {
                if (this.textProvider == null)
                {
                    this.text = "Reading logs on this platform is not supported. Sorry";
                }
                else
                {
                    this.text = textProvider.Get().ReadToEnd();
                }

                Vertical_GridLayout_Builder builder = new Vertical_GridLayout_Builder();
                // Split text into multiple text blocks so that if roudning error occurs in text measurement, the errors are spaced evenly.
                // There could be 50 pages of text, and we don't want 2% rounding error to add a completely blank page at the end
                List <string> lines            = new List <string>(this.text.Split(new char[] { '\n' }));
                int           numLinesPerBlock = 10;
                for (int i = 0; i < lines.Count; i += numLinesPerBlock)
                {
                    int           maxIndex     = Math.Min(i + numLinesPerBlock, lines.Count);
                    List <string> currentLines = lines.GetRange(i, maxIndex - i);
                    string        currentText  = string.Join("\n", currentLines);
                    builder.AddLayout(new TextblockLayout(currentText, 16, false, true));
                }

                this.SubLayout = ScrollLayout.New(builder.BuildAnyLayout());
            }
            return(base.GetBestLayout(query));
        }
コード例 #12
0
 private void makeArrows()
 {
     this.arrowLayouts = new List <LayoutChoice_Set>();
     for (int i = 0; i < this.itemLayouts.Count; i++)
     {
         GridLayout_Builder arrowBuilder = new Vertical_GridLayout_Builder().Uniform();
         if (i != 0)
         {
             arrowBuilder.AddLayout(this.Make_PrevButton(i));
         }
         if (i != this.itemLayouts.Count - 1)
         {
             arrowBuilder.AddLayout(this.Make_NextButton(i));
         }
         this.arrowLayouts.Add(arrowBuilder.Build());
     }
 }
コード例 #13
0
        public DemoLayout(ViewManager viewManager, ActivityDatabase activityDatabase)
        {
            this.viewManager      = viewManager;
            this.activityDatabase = activityDatabase;

            Vertical_GridLayout_Builder builder = new Vertical_GridLayout_Builder();

            builder.AddLayout(new TextblockLayout("Usage Demo"));
            this.feedbackLabel = new TextblockLayout();
            this.feedbackLabel.setText("You probably don't want to use this feature because it will make changes to your data.");
            builder.AddLayout(this.feedbackLabel);
            Button okButton = new Button();

            okButton.Clicked += OkButton_Clicked;
            builder.AddLayout(new ButtonLayout(okButton, "See Demo!"));
            this.SubLayout = builder.Build();
        }
コード例 #14
0
        public ParticipationComparisonMenu(LayoutStack layoutStack, ActivityDatabase activityDatabase, Engine engine)
        {
            this.layoutStack      = layoutStack;
            this.activityDatabase = activityDatabase;
            this.engine           = engine;

            this.SetTitle("Finding which activities often precede another");

            Vertical_GridLayout_Builder builder = new Vertical_GridLayout_Builder();

            this.activityToPredict_box = new ActivityNameEntryBox("Activity:", activityDatabase, layoutStack);
            builder.AddLayout(this.activityToPredict_box);

            builder.AddLayout(new TextblockLayout("Window duration:"));
            this.durationBox = new DurationEntryView();
            builder.AddLayout(this.durationBox);

            this.activityToPredictFrom_box = new ActivityNameEntryBox("Predictor Activity (default = all categories):", activityDatabase, layoutStack);
            builder.AddLayout(this.activityToPredictFrom_box);

            builder.AddLayout(new TextblockLayout("Comparison Type:"));
            this.typebox = new VisiPlacement.CheckBox("Linear Regression", "Bin Comparison");
            builder.AddLayout(this.typebox);

            this.okButton          = new Button();
            this.okButton.Clicked += OkButton_Click;
            builder.AddLayout(new ButtonLayout(this.okButton, "Ok"));

            this.SetContent(builder.Build());
        }
コード例 #15
0
        private void showPosts()
        {
            List <AnalyzedPost>         posts       = new List <AnalyzedPost>(this.analyzedPosts);
            Vertical_GridLayout_Builder gridBuilder = new Vertical_GridLayout_Builder();

            gridBuilder.AddLayout(this.downloadStatus_container);

            this.sortPosts(posts);
            posts = this.withoutDuplicateSources(posts);

            int maxCountToShow = 30;

            if (posts.Count > maxCountToShow)
            {
                posts = posts.GetRange(0, maxCountToShow);
            }
            double previousScore = double.NegativeInfinity;

            foreach (AnalyzedPost scoredPost in posts)
            {
                double thisScore = scoredPost.Score;
                if (thisScore != previousScore)
                {
                    string          text            = "Score: " + thisScore;
                    TextblockLayout textBlockLayout = new TextblockLayout(text, 30);
                    textBlockLayout.setBackgroundColor(Color.Black);
                    textBlockLayout.setTextColor(Color.White);
                    gridBuilder.AddLayout(textBlockLayout);

                    previousScore = thisScore;
                }
                PostView postView = new PostView(scoredPost);
                postView.PostClicked += PostView_PostClicked;
                postView.PostStarred += PostView_PostStarred;
                gridBuilder.AddLayout(postView);
            }

            LayoutChoice_Set scrollLayout = ScrollLayout.New(gridBuilder.BuildAnyLayout());

            this.downloadsStatus.NumUrlsDownloadedButNotShown = 0;
            this.downloadsStatus.NumFailed = 0;
            this.update_numCompletedDownloads_status();

            this.resultsLayout.SubLayout = scrollLayout;
        }
コード例 #16
0
        public ActivityVisualizationMenu(Engine engine, LayoutStack layoutStack)
        {
            this.SetTitle("View Statistics");
            this.engine      = engine;
            this.layoutStack = layoutStack;

            GridLayout_Builder gridBuilder = new Vertical_GridLayout_Builder().Uniform();

            this.yAxisNameBox = new ActivityNameEntryBox("Activity", engine.ActivityDatabase, layoutStack);
            gridBuilder.AddLayout(this.yAxisNameBox);

            this.okButton          = new Button();
            this.okButton.Clicked += OkButton_Clicked;

            gridBuilder.AddLayout(new ButtonLayout(this.okButton, "Visualize"));

            this.SetContent(gridBuilder.Build());
        }
コード例 #17
0
        private LayoutChoice_Set MakeSublayout(AppContribution contribution)
        {
            // get some properties
            AppContributor who         = contribution.Contributor;
            string         name        = who.Name;
            string         when        = contribution.DateTime.ToString("yyyy-MM-dd");
            string         description = contribution.Description;
            double         fontSize    = 16;
            double         nameSize    = 30;

            // build the name button layout
            LayoutChoice_Set nameLayout;

            if (who.Email != null || who.Website != null)
            {
                // If this contributor provided details, then make a button to show those details
                Vertical_GridLayout_Builder detailBuilder = new Vertical_GridLayout_Builder();
                detailBuilder.AddLayout(new TextblockLayout("Contributor Name: " + name, fontSize));
                if (who.Email != null)
                {
                    detailBuilder.AddLayout(new TextblockLayout("Email: " + who.Email, fontSize));
                }
                if (who.Website != null)
                {
                    detailBuilder.AddLayout(new TextblockLayout("Website: " + who.Website, fontSize));
                }
                nameLayout = new HelpButtonLayout(name, detailBuilder.Build(), layoutStack, nameSize);
            }
            else
            {
                // If this contributor didn't provide details, then just display their name
                TextblockLayout l = new TextblockLayout(name, nameSize);
                l.AlignHorizontally(TextAlignment.Center);
                nameLayout = l;
            }

            // build the rest of the layout
            Vertical_GridLayout_Builder fullBuilder = new Vertical_GridLayout_Builder();

            fullBuilder.AddLayout(nameLayout);
            fullBuilder.AddLayout(new TextblockLayout("On " + when + ": " + description, fontSize));
            fullBuilder.AddLayout(new TextblockLayout("Thanks!", fontSize));
            return(fullBuilder.Build());
        }
コード例 #18
0
 private LayoutChoice_Set MakeSublayout(double fontSize)
 {
     Vertical_GridLayout_Builder builder = new Vertical_GridLayout_Builder();
     GridLayout gridLayout = GridLayout.New(new BoundProperty_List(this.components.Count()), BoundProperty_List.Uniform(1), LayoutScore.Zero);
     foreach (HelpBlock block in this.components)
     {
         builder.AddLayout(block.Get(fontSize, this.components.Count()));
     }
     return builder.Build();
 }
コード例 #19
0
        public void testList()
        {
            Vertical_GridLayout_Builder builder = new Vertical_GridLayout_Builder();

            for (int i = 0; i < 20; i++)
            {
                builder.AddLayout(new TextblockLayout("Sample text " + i, 16));
            }
            this.Verify(builder.Build(), new Xamarin.Forms.Size(400, 1000), 1784);
        }
コード例 #20
0
        private void draw()
        {
            Vertical_GridLayout_Builder mainGrid_builder = new Vertical_GridLayout_Builder();

            mainGrid_builder.AddLayout(new TextblockLayout(participation.ActivityDescriptor.ActivityName, 30));
            mainGrid_builder.AddLayout(new TextblockLayout(participation.StartDate.ToString() + " - " + participation.EndDate.ToString(), 16));
            if (showCalculatedValues)
            {
                if (participation.GetAbsoluteRating() != null)
                {
                    mainGrid_builder.AddLayout(new TextblockLayout("Score: " + participation.GetAbsoluteRating().Score, 16));
                }
                if (participation.RelativeEfficiencyMeasurement != null)
                {
                    string message = "Efficiency: " + participation.RelativeEfficiencyMeasurement.RecomputedEfficiency.Mean;
                    mainGrid_builder.AddLayout(new HelpButtonLayout(message, new ExperimentResultsView(participation), layoutStack, 16));
                }
                Distribution netPresentHappiness = ratingSummarizer.GetValueDistributionForDates(participation.StartDate, ratingSummarizer.LatestKnownDate, true, true);
                if (netPresentHappiness.Weight > 0)
                {
                    mainGrid_builder.AddLayout(new TextblockLayout("Net present happiness: " + netPresentHappiness.Mean));
                }
            }
            if (participation.Comment != null)
            {
                mainGrid_builder.AddLayout(new TextblockLayout("Comment: " + participation.Comment, 16));
            }
            if (participation.PostComments.Count > 0)
            {
                foreach (ParticipationComment comment in participation.PostComments)
                {
                    mainGrid_builder.AddLayout(new TextblockLayout("Comment on " + comment.CreatedDate + ":" + comment.Text));
                }
            }
            if (showCalculatedValues)
            {
                this.feedbackHolder = new ContainerLayout();
                Button feedbackButton = new Button();
                feedbackButton.Clicked       += FeedbackButton_Clicked;
                this.feedbackHolder.SubLayout = new ButtonLayout(feedbackButton, "Compute Feedback");
                mainGrid_builder.AddLayout(this.feedbackHolder);
            }
            New_ParticipationComment_Layout commentBox = new New_ParticipationComment_Layout(participation, this.layoutStack);

            commentBox.AddParticipationComment += CommentBox_AddParticipationComment;
            mainGrid_builder.AddLayout(new HelpButtonLayout("Add comment", commentBox, layoutStack));
            this.SubLayout = mainGrid_builder.Build();
        }
コード例 #21
0
        private LayoutChoice_Set MakeSublayout(double fontSize)
        {
            Vertical_GridLayout_Builder builder = new Vertical_GridLayout_Builder();

            foreach (HelpBlock block in this.components)
            {
                builder.AddLayout(block.Get(fontSize, this.components.Count()));
            }
            return(builder.Build());
        }
コード例 #22
0
        public LayoutChoice_Set Build()
        {
            Vertical_GridLayout_Builder gridBuilder = new Vertical_GridLayout_Builder().Uniform();

            foreach (string name in this.layoutNames)
            {
                LayoutChoice_Set subLayout = this.Get_ButtonLayout_By_Name(name);
                gridBuilder.AddLayout(subLayout);
            }
            return(gridBuilder.BuildAnyLayout());
        }
コード例 #23
0
        public Browse_RecentSignificantActivities_Layout(Engine engine, ScoreSummarizer scoreSummarizer, LayoutStack layoutStack)
        {
            this.SetTitle("Significant recent activities");
            this.engine          = engine;
            this.scoreSummarizer = scoreSummarizer;
            this.layoutStack     = layoutStack;

            Button okButton = new Button();

            okButton.Clicked += OkButton_Clicked;

            this.durationLayout = new DurationEntryView();

            GridLayout_Builder gridBuilder = new Vertical_GridLayout_Builder().Uniform();

            gridBuilder.AddLayout(new TextblockLayout("What changed your happiness most"));
            gridBuilder.AddLayout(new TitledControl("in the last:", durationLayout));
            gridBuilder.AddLayout(new ButtonLayout(okButton, "OK"));
            this.SetContent(gridBuilder.Build());
        }
コード例 #24
0
        public LayoutChoice_Set Build()
        {
            Vertical_GridLayout_Builder builder = new Vertical_GridLayout_Builder();
            int minIndex = Math.Max(this.contributions.Count - 12, 0);

            for (int i = this.contributions.Count - 1; i >= minIndex; i--)
            {
                builder.AddLayout(this.MakeSublayout(this.contributions[i]));
            }

            return(ScrollLayout.New(builder.Build()));
        }
        public ExperimentationDifficultySelectionLayout(List <SuggestedMetric> suggestions, ActivityDatabase activityDatabase)
        {
            int requiredNumChoices = 3;

            if (suggestions.Count != requiredNumChoices)
            {
                throw new ArgumentException("ExperimentationDifficultySelectionLayout unsupported number of choices: got " + suggestions.Count + ", expected " + requiredNumChoices);
            }

            this.difficultyOptions = new List <ExperimentDifficultyEstimateLayout>();

            for (int i = 0; i < 3; i++)
            {
                this.difficultyOptions.Add(this.newItem(suggestions[i], activityDatabase));
            }

            string instructions = "Estimate the relative difficulty for each of these tasks. Also, you may change which metric you would like to use to measure your efficiency.";

            Button okButton = new Button();

            okButton.Clicked        += OkButton_Clicked;
            this.okButtonLayout      = new ButtonLayout(okButton, "Accept");
            this.invalidOrder_layout = new TextblockLayout("Illegal ordering! Each difficulty must be a positive number!");
            this.okButtonHolder      = new ContainerLayout();


            GridLayout_Builder builder = new Vertical_GridLayout_Builder().Uniform();

            builder.AddLayout(new TextblockLayout(instructions));
            foreach (ExperimentDifficultyEstimateLayout option in this.difficultyOptions)
            {
                builder.AddLayout(option);
            }
            builder.AddLayout(this.okButtonHolder);

            this.updateValidity();

            this.SubLayout = builder.Build();
        }
コード例 #26
0
        public TextMeasurement_Test_Layout()
        {
            GridLayout_Builder gridBuilder = new Vertical_GridLayout_Builder().Uniform();

            Editor textBox = new Editor();

            textBox.TextChanged += TextBox_TextChanged;
            this.textBox         = textBox;
            gridBuilder.AddLayout(new TextboxLayout(textBox, 16));

            for (double i = 0; i < 8; i += 1)
            {
                Label textBlock1 = new Label();
                textBlock1.BackgroundColor = Color.Red;
                TextblockLayout textBlockLayout = new TextblockLayout(textBlock1, i + 16, false, true);
                textBlockLayout.ScoreIfEmpty = false;
                gridBuilder.AddLayout(textBlockLayout);
                this.textBlockLayouts.Add(textBlockLayout);
            }

            this.SubLayout = ScrollLayout.New(gridBuilder.Build());
        }
コード例 #27
0
        public Customize_FeedUrls_Layout(UserPreferences_Database userPreferencesDatabase)
        {
            // save some properties
            this.userPreferencesDatabase = userPreferencesDatabase;

            // setup display
            Vertical_GridLayout_Builder newFeedBuilder = new Vertical_GridLayout_Builder();
            TextblockLayout             newFeedHelp    = new TextblockLayout("Add new feed:");

            newFeedHelp.setBackgroundColor(Color.Black);
            newFeedHelp.setTextColor(Color.White);
            newFeedBuilder.AddLayout(newFeedHelp);
            this.newFeedBox = new Editor();
            newFeedBuilder.AddLayout(new TextboxLayout(this.newFeedBox));
            Button newFeedButton = new Button();

            newFeedButton.Clicked += NewFeedButton_Clicked;
            newFeedBuilder.AddLayout(new ButtonLayout(newFeedButton, "Add"));

            this.newFeedsLayout = newFeedBuilder.Build();

            this.updateLayout();
        }
コード例 #28
0
        public TextMeasurement_Test_Layout()
        {
            Vertical_GridLayout_Builder grid1Builder = new Vertical_GridLayout_Builder().Uniform();

            //GridLayout grid2 = GridLayout.New(new BoundProperty_List(1), new BoundProperty_List(2), LayoutScore.Zero, 0.0625);
            Editor textBox = new Editor();

            textBox.TextChanged += TextBox_TextChanged;
            this.textBox         = textBox;
            grid1Builder.AddLayout(new TextboxLayout(textBox, 16));

            Label textBlock = new Label();

            textBlock.BackgroundColor           = Color.Red;
            this.textBlockLayout                = new TextblockLayout(textBlock, 16, false, true);
            this.textBlockLayout.ScoreIfEmpty   = false;
            this.textBlockLayout.LoggingEnabled = true;
            //grid2.PutLayout(this.textBlockLayout, 0, 0);
            //grid2.PutLayout(new ImageLayout(null, LayoutScore.Get_MinPriorityScore_ForTesting(1)), 1, 0);

            grid1Builder.AddLayout(this.textBlockLayout);
            this.SubLayout = grid1Builder.Build();
        }
コード例 #29
0
        public void UpdateLayout()
        {
            Vertical_GridLayout_Builder builder        = new Vertical_GridLayout_Builder();
            List <TextRule>             TextPredicates = this.userPreferencesDatabase.ScoringRules;

            foreach (TextRule rule in TextPredicates)
            {
                string text       = rule.ToString();
                Button ruleButton = new Button();
                ruleButton.Clicked += RuleButton_Clicked;
                ButtonLayout buttonLayout = new ButtonLayout(ruleButton, text, 16);
                builder.AddLayout(buttonLayout);
            }
            this.SubLayout = ScrollLayout.New(builder.Build());
        }
コード例 #30
0
        private LayoutChoice_Set makeContent()
        {
            this.chooseFile_button          = new Button();
            this.chooseFile_button.Clicked += ChooseFile;
            ButtonLayout chooseLayout = new ButtonLayout(this.chooseFile_button, "Select file");

            GridLayout_Builder builder = new Vertical_GridLayout_Builder()
                                         .Uniform()
                                         .AddLayout(new TextblockLayout("The file to import should be of the form created by the Export feature " +
                                                                        "(and the name of file should start with \"ActivityData\")"));

            builder.AddLayout(chooseLayout);

            return(builder.BuildAnyLayout());
        }