Esempio n. 1
0
        public NewInheritanceLayout(ActivityDatabase activityDatabase, LayoutStack layoutStack)
        {
            this.activityDatabase = activityDatabase;
            this.layoutStack      = layoutStack;

            this.SetTitle("Relate Two Existing Activities");

            GridLayout bottomGrid = GridLayout.New(new BoundProperty_List(2), BoundProperty_List.Uniform(2), LayoutScore.Zero);

            this.childNameBox = new ActivityNameEntryBox("Activity Name", activityDatabase, layoutStack);
            this.childNameBox.AutoAcceptAutocomplete = false;
            bottomGrid.AddLayout(this.childNameBox);

            this.parentNameBox = new ActivityNameEntryBox("Parent Name", activityDatabase, layoutStack);
            this.parentNameBox.AutoAcceptAutocomplete = false;
            bottomGrid.AddLayout(this.parentNameBox);

            this.okButton          = new Button();
            this.okButton.Clicked += OkButton_Clicked;
            bottomGrid.AddLayout(new ButtonLayout(this.okButton, "OK"));


            LayoutChoice_Set helpWindow = (new HelpWindowBuilder()).AddMessage("This screen is for you to enter activities, to use as future suggestions.")
                                          .AddMessage("The text box on the left is where you type the activity name.")
                                          .AddMessage("The text box on the right is where you type another activity that you want to make be a parent of the given activity.")
                                          .AddMessage("For example, you might specify that Gaming is a child activity of the Fun activity. Grouping activities like this is helpful for two reasons. It gives " +
                                                      "ActivityRecommender more understanding about the relationships between activities and can help it to notice trends. It also means that you can later request a suggestion " +
                                                      "from within Activity \"Fun\" and ActivityRecommender will know what you mean, and might suggest \"Gaming\".")
                                          .AddMessage("If you haven't created the parent activity yet, you'll have to create it first. The only activity that exists at the beginning is the built-in activity " +
                                                      "named \"Activity\".")
                                          .AddMessage("While typing you can press Enter to fill in the autocomplete suggestion.")
                                          .Build();

            HelpButtonLayout helpLayout = new HelpButtonLayout(helpWindow, layoutStack);

            bottomGrid.AddLayout(helpLayout);

            this.feedbackLayout = new TextblockLayout();

            GridLayout mainGrid = new Vertical_GridLayout_Builder()
                                  .AddLayout(this.feedbackLayout)
                                  .AddLayout(bottomGrid)
                                  .Build();

            this.SetContent(mainGrid);
        }
Esempio n. 2
0
        public Specify_AtLeastAsFunAs_Layout(ActivityDatabase activityDatabase, LayoutStack layoutStack)
        {
            LayoutChoice_Set helpWindow = new HelpWindowBuilder()
                                          .AddMessage("As part of making an activity request, you may specify that you want the suggested activity to be at least as fun as another activity.")
                                          .AddMessage("The reason you might do this is if you have an idea of what you might end up doing but you are hoping for ActivityRecommender to provide a better idea.")
                                          .AddMessage("If you enter an activity name into the box on this screen, then the suggestion that ActivityRecommender makes on the next screen will be " +
                                                      "one such that ActivityRecommender thinks you will have at least as much fun doing the given suggestion as you would have had doing the activity you " +
                                                      "specified on this screen.")
                                          .AddMessage("You can also specify how much fun you think you would have doing the given activity.")
                                          .AddMessage("This doesn't affect the suggestion at all, this is just for your own information.")
                                          .AddMessage("The reason you might specify how much fun you think you would have doing the given activity is that if you do end up doing the activity " +
                                                      "that you were thinking about, then you can reflect on how much fun you actually had and whether it matches how much fun you expected")
                                          .Build();
            LayoutChoice_Set helpLayout = new HelpButtonLayout(helpWindow, layoutStack);

            this.desiredActivity_box = new ActivityNameEntryBox("I want an activity at least as fun as this one:", activityDatabase, layoutStack);
            this.desiredActivity_box.Placeholder("(Optional)");
            this.desiredActivity_box.PreferSuggestibleActivities = true;

            this.estimatedRating_box = new RelativeRatingEntryView();
            this.estimatedRating_box.SetTitle("which I think will be this much fun:");

            this.SubLayout = new Vertical_GridLayout_Builder().AddLayout(helpLayout).AddLayout(this.desiredActivity_box).AddLayout(this.EstimatedRating_Box).BuildAnyLayout();
        }
Esempio n. 3
0
        public BrowseBest_ProtoActivities_Layout(ProtoActivity_Database protoActivity_database, ActivityDatabase activityDatabase, LayoutStack layoutStack)
        {
            this.protoActivity_database = protoActivity_database;
            this.layoutStack            = layoutStack;
            this.activityDatabase       = activityDatabase;

            Button edit1Button = new Button();

            edit1Button.Text     = "Edit";
            edit1Button.Clicked += Edit1Button_Clicked;

            Button edit2Button = new Button();

            edit2Button.Text     = "Edit";
            edit2Button.Clicked += Edit2Button_Clicked;

            Button mark1Worse_button = new Button();

            mark1Worse_button.Text     = "Worse";
            mark1Worse_button.Clicked += Mark1Worse_button_Clicked;

            Button explainScore1Button = new Button();

            explainScore1Button.Text     = "?";
            explainScore1Button.Clicked += ExplainScore1Button_Clicked;
            this.explainScore1Button     = new ButtonLayout(explainScore1Button);

            Button mark2Worse_button = new Button();

            mark2Worse_button.Text     = "Worse";
            mark2Worse_button.Clicked += Mark2Worse_button_Clicked;

            Button explainScore2Button = new Button();

            explainScore2Button.Text     = "?";
            explainScore2Button.Clicked += ExplainScore2Button_Clicked;
            this.explainScore2Button     = new ButtonLayout(explainScore2Button);

            BoundProperty_List rowHeights   = BoundProperty_List.Uniform(3);
            BoundProperty_List columnWidths = new BoundProperty_List(3);

            columnWidths.BindIndices(0, 1);
            columnWidths.BindIndices(0, 2);
            columnWidths.SetPropertyScale(0, 1);
            columnWidths.SetPropertyScale(1, 4);
            columnWidths.SetPropertyScale(2, 1);

            GridLayout grid = GridLayout.New(rowHeights, columnWidths, LayoutScore.Zero);

            this.numBrowsesPerProtoactivity_Layout = new TextblockLayout().AlignVertically(TextAlignment.Center);
            grid.PutLayout(this.numBrowsesPerProtoactivity_Layout, 0, 0);

            this.titleLayout = new TextblockLayout("Browse Best ProtoActivities");
            grid.PutLayout(this.titleLayout, 1, 0);
            LayoutChoice_Set helpButton = new HelpButtonLayout(
                new HelpWindowBuilder()
                .AddMessage("If you have entered any ProtoActivities (which are ideas that are not yet fully-formed enough for you to want them to be suggested), then you can browse them here.")
                .AddMessage("This screen allows you to see the ProtoActivities that ActivityRecommender thinks you consider to be most interesting, and also asks you to choose which one of the top " +
                            "two is most interesting to you.")
                .AddMessage("If you want to modify a ProtoActivity, press its Edit button (note that if you make any changes, then this will temporarily dismiss it (by resetting its interest score)).")
                .AddMessage("If you want to see different ProtoActivities, then first you should choose which one (of the two visible ProtoActivities) you like less. Press the button marked " +
                            "'Worse' next to the ProtoActivity that you like less. This will cause two new ProtoActivities to appear (by resetting the interest scores of the two currently visible " +
                            "ProtoActivities to 0). This will also cause the one you marked 'Worse' to return less often and " +
                            "the other one to return more often.")
                .AddMessage("The way that ProtoActivities are chosen in this screen is that each ProtoActivity has a score of how much you like it, and " +
                            "a duration since the last time you interacted with that ProtoActivity. The product of the two is its interest score, and the " +
                            "ProtoActivities with the highest interest scores are the ones that will be displayed.")
                .AddMessage("If you want to see the calculation of the interest scores of the two current ProtoActivities, press the \"?\" button.")
                .AddMessage("Enjoy!")
                .AddLayout(new CreditsButtonBuilder(layoutStack)
                           .AddContribution(ActRecContributor.ANNI_ZHANG, new DateTime(2020, 5, 28), "Suggested explaining the calculation of protoactivity sort score")
                           .Build()
                           )
                .Build(),
                layoutStack);

            grid.PutLayout(helpButton, 2, 0);
            grid.PutLayout(new ButtonLayout(edit1Button), 0, 1);
            grid.PutLayout(new ButtonLayout(edit2Button), 0, 2);
            this.activity1Holder = new ContainerLayout();
            grid.PutLayout(this.activity1Holder, 1, 1);
            this.activity2Holder = new ContainerLayout();
            grid.PutLayout(this.activity2Holder, 1, 2);
            this.activity1ScoreBlock = new TextblockLayout();
            this.score1Holder        = new ContainerLayout();
            this.score2Holder        = new ContainerLayout();
            grid.PutLayout(
                new Vertical_GridLayout_Builder()
                .Uniform()
                .AddLayout(new ButtonLayout(mark1Worse_button))
                .AddLayout(this.score1Holder)
                .BuildAnyLayout()
                , 2, 1);
            this.activity2ScoreBlock = new TextblockLayout();
            grid.PutLayout(
                new Vertical_GridLayout_Builder()
                .Uniform()
                .AddLayout(new ButtonLayout(mark2Worse_button))
                .AddLayout(this.score2Holder)
                .BuildAnyLayout()
                , 2, 2);

            this.multiActivitiesLayout = grid;

            this.protoActivity_database.RatingsChanged += ProtoActivity_database_Changed;
            this.protoActivity_database.TextChanged    += ProtoActivity_database_Changed;

            this.singleActivityButton          = new Button();
            this.singleActivityButton.Clicked += SingleActivityButton_Clicked;
            this.singleActivityLayout          = new ButtonLayout(this.singleActivityButton);

            this.invalidate();
        }
Esempio n. 4
0
        public ActivityCreationLayout(ActivityDatabase activityDatabase, LayoutStack layoutStack)
        {
            this.activityDatabase = activityDatabase;
            this.layoutStack      = layoutStack;

            this.SetTitle("New Activity");
            SingleSelect typeSelector = new SingleSelect("Type:", this.typeChoices);

            GridLayout mainGrid = GridLayout.New(new BoundProperty_List(3), new BoundProperty_List(1), LayoutScore.Zero);

            mainGrid.AddLayout(typeSelector);
            this.feedbackLayout = new TextblockLayout("", 18).AlignVertically(TextAlignment.Center);
            mainGrid.AddLayout(this.feedbackLayout);

            GridLayout bottomGrid = GridLayout.New(new BoundProperty_List(2), BoundProperty_List.Uniform(2), LayoutScore.Zero);

            mainGrid.AddLayout(bottomGrid);

            this.typePicker       = typeSelector;
            typeSelector.Updated += TypeSelector_Clicked;

            this.childNameBox = new ActivityNameEntryBox("Activity Name", activityDatabase, layoutStack, true);
            this.childNameBox.AutoAcceptAutocomplete = false;
            bottomGrid.AddLayout(this.childNameBox);

            this.parentNameBox = new ActivityNameEntryBox("Parent Name", activityDatabase, layoutStack);
            this.parentNameBox.AutoAcceptAutocomplete = false;
            // for first-time users, make it extra obvious that the root activity exists
            this.parentNameBox.autoselectRootActivity_if_noCustomActivities();
            bottomGrid.AddLayout(this.parentNameBox);

            this.okButton          = new Button();
            this.okButton.Clicked += OkButton_Clicked;
            bottomGrid.AddLayout(new ButtonLayout(this.okButton, "OK"));

            LayoutChoice_Set helpWindow = (new HelpWindowBuilder()).AddMessage("This screen is for you to enter activities to do, to use as future suggestions.")
                                          .AddMessage("In the left text box, choose a name for the activity.")
                                          .AddMessage("In the right text box, specify another activity to assign as its parent.")
                                          .AddMessage("For example, you might specify that Gaming is a child activity of the Fun activity. Grouping activities like this is helpful for two reasons. It gives " +
                                                      "ActivityRecommender more understanding about the relationships between activities and can help it to notice trends. It also means that you can later request a suggestion " +
                                                      "from within Activity \"Fun\" and ActivityRecommender will know what you mean, and might suggest \"Gaming\".")
                                          .AddMessage("If you haven't created the parent activity yet, you'll have to create it first. The only activity that exists at the beginning is the built-in activity " +
                                                      "named \"Activity\".")
                                          .AddMessage("While typing you can press Enter to fill in the autocomplete suggestion.")
                                          .AddMessage("If the thing you're creating is something you plan to do many times (or even if you want it to be able to be the parent of another Activity), then select the type " +
                                                      "Category. For example, Sleeping would be a Category.")
                                          .AddMessage("If the thing you're creating is something you plan to complete once and don't plan to do again, then select the type ToDo. For example, \"Reading " +
                                                      "ActivityRecommender's Built-In Features Overview\" would be a ToDo.")
                                          .AddMessage("If the thing you're creating is something measureable that you might try to solve repeatedly but in different ways, then select the type Problem. For example, " +
                                                      "\"Headache\" (or \"Fixing my Headache\") would be a Problem because it may be addressed in several ways: resting, drinking water, or adjusting your posture")
                                          .AddMessage("If the thing you're creating is something that solves a Problem, then select the type Category and choose the appropriate Problem as a parent. Note " +
                                                      "that there is also a choice named \"Solution\", which is another name for Category, to emphasize this.")
                                          .AddLayout(new CreditsButtonBuilder(layoutStack)
                                                     .AddContribution(ActRecContributor.AARON_SMITH, new DateTime(2019, 8, 17), "Suggested that if Activity is the only valid choice then it should autopopulate")
                                                     .AddContribution(ActRecContributor.DAGOBERT_RENOUF, new DateTime(2021, 06, 14), "Mentioned that it was difficult to determine how to create a new activity without " +
                                                                      "visual hierarchy among the elements on the screen")
                                                     .Build()
                                                     )
                                          .Build();

            HelpButtonLayout helpLayout = new HelpButtonLayout(helpWindow, layoutStack);

            bottomGrid.AddLayout(helpLayout);

            this.explainActivityType();

            this.SetContent(mainGrid);
        }
Esempio n. 5
0
        public ProtoActivity_Editing_Layout(ProtoActivity protoActivity, ProtoActivity_Database database, ActivityDatabase activityDatabase, LayoutStack layoutStack)
        {
            this.protoActivity    = protoActivity;
            this.database         = database;
            this.activityDatabase = activityDatabase;
            this.activityDatabase.ActivityAdded += ActivityDatabase_ActivityAdded;
            this.layoutStack  = layoutStack;
            this.textBox      = new Editor();
            this.textBox.Text = protoActivity.Text;

            Vertical_GridLayout_Builder gridBuilder = new Vertical_GridLayout_Builder();
            string titleText;

            if (protoActivity.Id >= 0)
            {
                titleText = "ProtoActivity #" + protoActivity.Id;
            }
            else
            {
                titleText = "New ProtoActivity";
            }
            gridBuilder.AddLayout(new TextblockLayout(titleText));
            gridBuilder.AddLayout(ScrollLayout.New(new TextboxLayout(this.textBox)));

            Button saveButton = new Button();

            saveButton.Text     = "Save";
            saveButton.Clicked += SaveButton_Clicked;

            Button promoteButton = new Button();

            promoteButton.Text     = "Promote to Activity";
            promoteButton.Clicked += PromoteButton_Clicked;

            Button splitButton = new Button();

            splitButton.Text     = "Split";
            splitButton.Clicked += SplitButton_Clicked;

            HelpButtonLayout helpButtonLayout = new HelpButtonLayout(new HelpWindowBuilder()
                                                                     .AddMessage("This screen allows you to edit " + titleText + ".")
                                                                     .AddMessage("Enter as much text as you like.")
                                                                     .AddMessage("To save your entry, either press Save or simply go back to another screen.")
                                                                     .AddMessage("  After you go back, if you later want to return to this same ProtoActivity, you will have to go to one of the screens for browsing existing ProtoActivities and then search for it.")
                                                                     .AddMessage("To turn this ProtoActivity into an Activity, press Promote to Activity.")
                                                                     .AddMessage("To delete this ProtoActivity, delete all of the text in the box and then either press Save or go back to a previous screen.")
                                                                     .AddLayout(new CreditsButtonBuilder(layoutStack)
                                                                                .AddContribution(ActRecContributor.AARON_SMITH, new DateTime(2019, 9, 16), "Pointed out that the promote-a-protoactivity button crashed if the text box was empty")
                                                                                .Build()
                                                                                )
                                                                     .Build()
                                                                     , layoutStack);

            LayoutChoice_Set buttonsLayout = new Horizontal_GridLayout_Builder()
                                             .AddLayout(new ButtonLayout(saveButton))
                                             .AddLayout(new ButtonLayout(promoteButton))
                                             .AddLayout(new ButtonLayout(splitButton))
                                             .AddLayout(helpButtonLayout)
                                             .BuildAnyLayout();

            gridBuilder.AddLayout(buttonsLayout);

            this.SubLayout = gridBuilder.Build();
        }