public ActivitySearchView(ActivityDatabase activityDatabase, ProtoActivity_Database protoActivity_database, LayoutStack layoutStack, bool allowDeletion = false)
        {
            this.layoutStack            = layoutStack;
            this.activityDatabase       = activityDatabase;
            this.protoActivity_database = protoActivity_database;
            this.textBox              = new Editor();
            this.textBox.TextChanged += TextBox_TextChanged;
            this.largeFont_autocomplete_gridLayout = GridLayout.New(new BoundProperty_List(this.maxNumResults), new BoundProperty_List(1), LayoutScore.Zero);
            this.smallFont_autocomplete_gridLayout = GridLayout.New(new BoundProperty_List(this.maxNumResults), new BoundProperty_List(1), LayoutScore.Zero);
            this.allowDeletion = allowDeletion;

            Button rootActivity_button = new Button();

            rootActivity_button.Clicked   += RootActivity_button_Clicked;
            this.rootActivity_buttonLayout = new ButtonLayout(rootActivity_button, "Or browse hierarchically");
            this.footer = new ContainerLayout();

            this.SubLayout = new Vertical_GridLayout_Builder()
                             .AddLayout(
                new LayoutUnion(
                    this.largeFont_autocomplete_gridLayout,
                    this.smallFont_autocomplete_gridLayout)
                )
                             .AddLayout(new TextboxLayout(this.textBox))
                             .AddLayout(footer)
                             .BuildAnyLayout();

            this.titleLayout = new TextblockLayout("Activity name (and/or ProtoActivity name):").AlignHorizontally(TextAlignment.Center).AlignVertically(TextAlignment.Center);
        }
Beispiel #2
0
 public ExportProtoactivities_Layout(ProtoActivity_Database protoActivity_database, PublicFileIo fileIo, TextConverter textConverter, LayoutStack layoutStack)
 {
     this.protoActivity_database = protoActivity_database;
     this.fileIo        = fileIo;
     this.textConverter = textConverter;
     this.layoutStack   = layoutStack;
 }
 public ProtoActivity_Splitting_Layout(ProtoActivity a, ProtoActivity b, ProtoActivity_Database database, LayoutStack layoutStack)
 {
     this.protoA      = a;
     this.protoB      = b;
     this.database    = database;
     this.layoutStack = layoutStack;
     this.setupDrawing();
 }
        public SearchProtoActivities_Layout(ProtoActivity_Database protoactivityDatabase, ActivityDatabase activityDatabase, LayoutStack layoutStack)
        {
            this.protoactivityDatabase = protoactivityDatabase;
            this.activityDatabase      = activityDatabase;
            this.layoutStack           = layoutStack;

            this.queryBox              = new Editor();
            this.queryBox.TextChanged += QueryText_Changed;
            this.okButton              = new Button();
            this.okButton.Clicked     += OkButton_Clicked;

            LayoutChoice_Set sublayout = new Vertical_GridLayout_Builder()
                                         .AddLayout(new ButtonLayout(this.okButton))
                                         .AddLayout(new TextboxLayout(this.queryBox))
                                         .BuildAnyLayout();

            this.SubLayout = sublayout;
        }
Beispiel #5
0
        public BrowseAll_ProtoActivities_Layout(ProtoActivity_Database protoActivity_database, ActivityDatabase activityDatabase, LayoutStack layoutStack)
        {
            this.protoActivity_database = protoActivity_database;
            this.activityDatabase       = activityDatabase;
            this.layoutStack            = layoutStack;

            Button nextButton = new Button();

            nextButton.Clicked   += NextButton_Clicked;
            this.nextButtonLayout = new ButtonLayout(nextButton, "Older");

            Button prevButton = new Button();

            prevButton.Clicked   += PrevButton_Clicked;
            this.prevButtonLayout = new ButtonLayout(prevButton, "Newer");

            this.protoActivity_database.TextChanged += ProtoActivity_database_TextChanged;
            this.invalidate();
        }
        public ProtoActivities_Layout(ProtoActivity_Database protoActivity_database, ActivityDatabase activityDatabase, LayoutStack layoutStack, PublicFileIo publicFileIo, TextConverter textConverter)
        {
            this.SetTitle("Protoactivities");

            this.protoActivity_database = protoActivity_database;
            MenuLayoutBuilder menuBuilder = new MenuLayoutBuilder(layoutStack);

            this.newProtoactivityBuilder = new ProtoActivity_LayoutBuilder(protoActivity_database, activityDatabase, layoutStack);
            menuBuilder.AddLayout(
                new AppFeatureCount_ButtonName_Provider("New", this.newProtoactivityBuilder.GetFeatures()),
                this.newProtoactivityBuilder
                );

            this.browseBestProtoactivities_layout = new BrowseBest_ProtoActivities_Layout(protoActivity_database, activityDatabase, layoutStack);
            menuBuilder.AddLayout(
                new AppFeatureCount_ButtonName_Provider("Browse Best", this.browseBestProtoactivities_layout.GetFeatures()),
                new StackEntry(this.browseBestProtoactivities_layout, "Browse Best", null));


            this.listLayout = new BrowseAll_ProtoActivities_Layout(protoActivity_database, activityDatabase, layoutStack);

            menuBuilder.AddLayout(
                new AppFeatureCount_ButtonName_Provider("List All", listLayout.GetFeatures()),
                new StackEntry(listLayout, "List All", null));

            this.searchLayout = new SearchProtoActivities_Layout(protoActivity_database, activityDatabase, layoutStack);

            menuBuilder.AddLayout(
                new AppFeatureCount_ButtonName_Provider("Search", this.searchLayout.GetFeatures()),
                new StackEntry(searchLayout, "Search", null));

            this.exportProtoactivities_layout = new ExportProtoactivities_Layout(protoActivity_database, publicFileIo, textConverter, layoutStack);
            menuBuilder.AddLayout(
                new AppFeatureCount_ButtonName_Provider("Export", this.exportProtoactivities_layout.GetFeatures()),
                new StackEntry(this.exportProtoactivities_layout, "Export", null));
            menuBuilder.AddLayout("Help", new HelpWindowBuilder()
                                  .AddMessage("Here you can brainstorm things that you might want to do but that aren't yet formed well enough to be meaningful to suggest.")
                                  .AddMessage("Once an idea that you enter here does become worth suggesting, you can promote it from a ProtoActivity to an Activity")
                                  .Build());
            this.SetContent(menuBuilder.Build());
        }
        public ExperimentInitializationLayout(LayoutStack layoutStack, ActivityRecommender activityRecommender, ActivityDatabase activityDatabase, ProtoActivity_Database protoActivity_database, Engine engine, int numActivitiesThatMayBeRequestedDirectly)
        {
            this.SetTitle("Efficiency Experiment");
            this.activityRecommender = activityRecommender;

            Button okbutton = new Button();

            this.okButtonLayout = new ButtonLayout(okbutton, "Next");
            okbutton.Clicked   += Okbutton_Clicked;

            LayoutChoice_Set helpButton = this.make_helpButton(layoutStack);

            SuggestedMetric_Metadata experimentsStatus = activityRecommender.Test_ChooseExperimentOption();

            if (experimentsStatus.Error != "")
            {
                this.SetContent(new TextblockLayout(experimentsStatus.Error));
                return;
            }

            this.statusHolder = new ContainerLayout();
            GridLayout topGrid = new Horizontal_GridLayout_Builder()
                                 .AddLayout(helpButton)
                                 .AddLayout(new HelpButtonLayout("Browse Activities", new ActivitySearchView(activityDatabase, protoActivity_database, layoutStack), layoutStack))
                                 .Uniform()
                                 .Build();

            GridLayout_Builder childrenBuilder = new Horizontal_GridLayout_Builder().Uniform();

            for (int i = 0; i < this.numChoices; i++)
            {
                bool allowRequestingActivityDirectly = (i < numActivitiesThatMayBeRequestedDirectly);
                ExperimentOptionLayout child         = new ExperimentOptionLayout(this, activityDatabase, allowRequestingActivityDirectly, engine, layoutStack);
                this.children.Add(child);
                childrenBuilder.AddLayout(child);
                child.SuggestionDismissed += Child_SuggestionDismissed;
                child.JustifySuggestion   += Child_JustifySuggestion;
            }
            GridLayout bottomGrid = childrenBuilder.Build();

            BoundProperty_List rowHeights = new BoundProperty_List(3);

            rowHeights.BindIndices(0, 1);
            rowHeights.BindIndices(0, 2);
            rowHeights.SetPropertyScale(0, 2);
            rowHeights.SetPropertyScale(1, 1);
            rowHeights.SetPropertyScale(2, 6);

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

            mainGrid.AddLayout(topGrid);
            mainGrid.AddLayout(this.statusHolder);
            mainGrid.AddLayout(bottomGrid);

            string statusMessage = "(" + experimentsStatus.NumExperimentParticipationsRemaining + " experiment";

            if (experimentsStatus.NumExperimentParticipationsRemaining != 1)
            {
                statusMessage += "s";
            }
            statusMessage += " remaining before another ToDo must be entered!)";
            this.UpdateStatus(statusMessage);

            this.SetContent(mainGrid);
        }
Beispiel #8
0
 public CompareProtoactivities_Feature(ProtoActivity_Database protoactivityDatabase)
 {
     this.protoactivityDatabase = protoactivityDatabase;
 }
Beispiel #9
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();
        }
 public SearchProtoActivities_Feature(ProtoActivity_Database protoActivity_database)
 {
     this.protoActivity_database = protoActivity_database;
 }
 public ProtoActivity_LayoutBuilder(ProtoActivity_Database protoActivity_Database, ActivityDatabase activityDatabase, LayoutStack layoutStack)
 {
     this.protoActivity_database = protoActivity_Database;
     this.activityDatabase       = activityDatabase;
     this.layoutStack            = layoutStack;
 }
 public CreateProtoactivity_Feature(ProtoActivity_Database protoactivityDatabase)
 {
     this.protoactivityDatabase = protoactivityDatabase;
 }
 public SearchActivities_Feature(ActivityDatabase activityDatabase, ProtoActivity_Database protoActivity_database)
 {
     this.activityDatabase       = activityDatabase;
     this.protoActivity_database = protoActivity_database;
 }
Beispiel #14
0
 public ExportProtoactivities_Feature(ProtoActivity_Database protoactivityDatabase)
 {
     this.protoactivityDatabase = protoactivityDatabase;
 }
Beispiel #15
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();
        }