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);
        }
Exemple #2
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());
        }
 public ActivityImportLayout(ActivityDatabase activityDatabase, LayoutStack layoutStack)
 {
     this.activityDatabase      = activityDatabase;
     this.layoutStack           = layoutStack;
     this.dismissedInheritances = new HashSet <Inheritance>();
     this.regenerateEntries();
 }
        public ActivityEditingLayout(ActivityDatabase activityDatabase, LayoutStack layoutStack)
        {
            this.activityDatabase = activityDatabase;

            this.activityCreationLayout    = new ActivityCreationLayout(activityDatabase, layoutStack);
            this.inheritanceCreationLayout = new NewInheritanceLayout(activityDatabase, layoutStack);
            this.metricEditingLayout       = new MetricEditingLayout(activityDatabase, layoutStack);

            LayoutChoice_Set helpLayout = (new HelpWindowBuilder()
                                           .AddMessage("If you want to assign an activity as the child of multiple parents, you can do that here.")
                                           .AddMessage("Additionally, if you plan to ask ActivityRecommender to measure how quickly (your Effectiveness) you complete various Activities, you have to enter a " +
                                                       "Metric for those activities here, so ActivityRecommender can know that it makes sense to measure (for example, it wouldn't make sense to measure how quickly you sleep at " +
                                                       "once: it wouldn't count as twice effective to do two sleeps of half duration each).")
                                           .AddMessage("To undo, remove, or modify an entry, you have to edit the data file directly. Go back to the Export screen and export all of your data as a .txt file. " +
                                                       "Then make some changes, and go to the Import screen to load your changed file.")
                                           .AddLayout(new CreditsButtonBuilder(layoutStack)
                                                      .AddContribution(ActRecContributor.CORY_JALBERT, new DateTime(2017, 12, 14), "Suggested having pre-chosen activities available for easy import")
                                                      .AddContribution(ActRecContributor.ANNI_ZHANG, new DateTime(2020, 3, 8), "Pointed out that linebreaks in buttons didn't work correctly on iOS")
                                                      .Build()
                                                      )
                                           .Build()
                                           );

            this.SubLayout = new MenuLayoutBuilder(layoutStack)
                             .AddLayout(
                new AppFeatureCount_ButtonName_Provider("New Relationship Between Activities", this.inheritanceCreationLayout.GetFeatures()),
                new StackEntry(this.inheritanceCreationLayout, "New Relationship", null)
                )
                             .AddLayout(
                new AppFeatureCount_ButtonName_Provider("New Completion Metric", this.metricEditingLayout.GetFeatures()),
                new StackEntry(this.metricEditingLayout, "New Completion Metric", null)
                )
                             .AddLayout("Help", helpLayout)
                             .Build();
        }
        private ExperimentDifficultyEstimateLayout newItem(SuggestedMetric metric, ActivityDatabase activityDatabase)
        {
            Activity activity = activityDatabase.ResolveDescriptor(metric.ActivityDescriptor);
            ExperimentDifficultyEstimateLayout item = new ExperimentDifficultyEstimateLayout(metric, activity);

            item.DifficultyText_Changed += Item_DifficultyText_Changed;
            return(item);
        }
Exemple #6
0
        public ExperimentOptionLayout(ExperimentInitializationLayout owner, ActivityDatabase activityDatabase, bool allowRequestingActivitiesDirectly, Engine engine, LayoutStack layoutStack)
        {
            this.owner = owner;

            RequestSuggestion_Layout requestSuggestion_layout = new RequestSuggestion_Layout(activityDatabase, allowRequestingActivitiesDirectly, false, true, 1, engine, layoutStack);

            requestSuggestion_layout.RequestSuggestion += RequestSuggestion_Impl;
            this.requestSuggestion_layout = requestSuggestion_layout;
            this.Suggestion = null;
        }
Exemple #7
0
        public GameActivity(IPlayniteAPI api) : base(api)
        {
            settings = new GameActivitySettings(this);

            DatabaseReference = PlayniteApi.Database;

            // Old database
            oldToNew = new OldToNew(this.GetPluginUserDataPath());

            // Loading plugin database
            PluginDatabase = new ActivityDatabase(PlayniteApi, settings, this.GetPluginUserDataPath());
            PluginDatabase.InitializeDatabase();

            // Temp
            Task.Run(() =>
            {
                System.Threading.SpinWait.SpinUntil(() => PluginDatabase.IsLoaded, -1);

                settings.tmp = true;
                this.SavePluginSettings(settings);
            });

            // Get plugin's location
            pluginFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            // Add plugin localization in application ressource.
            PluginLocalization.SetPluginLanguage(pluginFolder, api.ApplicationSettings.Language);

            // Add common in application ressource.
            Common.Load(pluginFolder);
            Common.SetEvent(PlayniteApi);

            // Check version
            if (settings.EnableCheckVersion)
            {
                CheckVersion cv = new CheckVersion();
                cv.Check("GameActivity", pluginFolder, api);
            }

            // Init ui interagration
            gameActivityUI = new GameActivityUI(api, settings, this.GetPluginUserDataPath());

            // Custom theme button
            EventManager.RegisterClassHandler(typeof(Button), Button.ClickEvent, new RoutedEventHandler(gameActivityUI.OnCustomThemeButtonClick));

            // Add event fullScreen
            if (api.ApplicationInfo.Mode == ApplicationMode.Fullscreen)
            {
                EventManager.RegisterClassHandler(typeof(Button), Button.ClickEvent, new RoutedEventHandler(BtFullScreen_ClickEvent));
            }
        }
        private Engine MakeEngine(int numActivities)
        {
            Engine engine = new Engine();

            engine.Randomness = new Random(0);
            ActivityDatabase activities = engine.ActivityDatabase;

            for (int i = 1; i < numActivities; i++)
            {
                ActivityDescriptor activityDescriptor = new ActivityDescriptor("a" + i);
                Inheritance        inheritance        = new Inheritance(activities.RootActivity.MakeDescriptor(), activityDescriptor);
                activities.CreateToDo(inheritance);
            }
            return(engine);
        }
Exemple #9
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();
        }
Exemple #10
0
        public ActivitiesMenuLayout(
            ActivitySearchView browseInheritancesLayout,
            ActivityImportLayout importPremadeActivitiesLayout,
            ActivityCreationLayout activityCreationLayout,
            ActivityEditingLayout activityEditingLayout,
            ProtoActivities_Layout protoactivitiesLayout,
            LayoutStack layoutStack,
            ActivityDatabase activityDatabase)
        {
            this.SetTitle("Activities");

            this.browseInheritancesLayout      = browseInheritancesLayout;
            this.importPremadeActivitiesLayout = importPremadeActivitiesLayout;
            this.activityCreationLayout        = activityCreationLayout;
            this.activityEditingLayout         = activityEditingLayout;
            this.protoactivitiesLayout         = protoactivitiesLayout;
            this.layoutStack      = layoutStack;
            this.activityDatabase = activityDatabase;
            this.setupLayouts();
        }
        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());
        }
Exemple #12
0
        public RequestSuggestion_Layout(ActivityDatabase activityDatabase, bool allowRequestingActivitiesDirectly, bool allowMultipleSuggestionTypes, bool vertical,
                                        int numChoicesPerSuggestion, Engine engine, LayoutStack layoutStack)
        {
            this.activityDatabase = activityDatabase;
            this.allowRequestingActivitiesDirectly = allowRequestingActivitiesDirectly;
            this.allowMultipleSuggestionTypes      = allowMultipleSuggestionTypes;
            this.vertical                = vertical;
            this.engine                  = engine;
            this.layoutStack             = layoutStack;
            this.numChoicesPerSuggestion = numChoicesPerSuggestion;

            GridLayout_Builder gridBuilder;

            if (vertical)
            {
                gridBuilder = new Vertical_GridLayout_Builder();
            }
            else
            {
                gridBuilder = new Horizontal_GridLayout_Builder();
            }
            gridBuilder.Uniform();

            Full_RequestSuggestion_Layout child = new Full_RequestSuggestion_Layout(this.activityDatabase, false, false, this.vertical, numChoicesPerSuggestion, this.engine, this.layoutStack);

            this.impl = child;
            child.RequestSuggestion += Child_RequestSuggestion;
            gridBuilder.AddLayout(this.impl);

            bool expandable = allowRequestingActivitiesDirectly || allowMultipleSuggestionTypes;

            if (expandable)
            {
                Button expandButton = new Button();
                expandButton.Clicked += ExpandButton_Clicked;
                gridBuilder.AddLayout(new ButtonLayout(expandButton, "Customize"));
            }

            this.SubLayout = gridBuilder.BuildAnyLayout();
        }
        public MetricEditingLayout(ActivityDatabase activityDatabase, LayoutStack layoutStack)
        {
            this.activityDatabase = activityDatabase;
            this.nameBox          = new ActivityNameEntryBox("Activity", activityDatabase, layoutStack);
            Button okButton = new Button();

            okButton.Clicked       += OkButton_Clicked;
            this.metricBox          = new TitledTextbox("Metric Name");
            this.errorMessageHolder = new TextblockLayout();

            LayoutChoice_Set helpWindow = new HelpWindowBuilder()
                                          .AddMessage("This screen lets you add a Metric to an existing activity (metrics are required for running experiments).")
                                          .AddMessage("A metric is a way of measuring how well a participation accomplishes a goal.")
                                          .AddMessage("At the moment, ActivityRecommender only supports adding Metrics that classify a participation as a success or failure.")
                                          .AddMessage("(You record the success/failure status when you record having participated in the Activity)")
                                          .AddMessage("For example, if you have an Activity named Making Food, one possible metric would be 'Make 1 gallon of smoothie'.")
                                          .AddMessage("Alternatively, if you have a computer game you'd like to beat, another possible metric would be 'Beat 1 Level'.")
                                          .AddMessage("The reason you might want to create a Metric is to allow ActivityRecommender to know it can measure your effectiveness on this task.")
                                          .AddMessage("Any Activity with a Metric is eligible to take part in effectiveness experiments.")
                                          .AddMessage("Also note that any Activity of type ToDo already starts with a built-in metric, which is to complete the ToDo.")
                                          .AddMessage("Also note that any Activity that is a Problem or inherits from a Problem will receive a metric, which is to solve the Problem.")
                                          .Build();

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

            mainGrid.AddLayout(new TextblockLayout("Add Metric to Existing Activity"));
            mainGrid.AddLayout(new TextblockLayout("Metrics are required before running an experiment (and measuring your efficiency).", 12));
            mainGrid.AddLayout(this.errorMessageHolder);

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

            bottomGrid.AddLayout(this.metricBox);
            bottomGrid.AddLayout(this.nameBox);
            bottomGrid.AddLayout(new ButtonLayout(okButton, "OK"));
            bottomGrid.AddLayout(new HelpButtonLayout(helpWindow, layoutStack));

            mainGrid.AddLayout(bottomGrid);

            this.SubLayout = mainGrid;
        }
Exemple #14
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();
        }
Exemple #15
0
        public SuggestionsView(ActivityRecommender recommenderToInform, LayoutStack layoutStack, ActivityDatabase activityDatabase, Engine engine) : base("Get Suggestions")
        {
            this.TitleLayout.AlignVertically(TextAlignment.Center);
            this.activityDatabase = activityDatabase;
            this.engine           = engine;
            this.recommender      = recommenderToInform;

            this.layoutStack = layoutStack;

            this.messageLayout = new TextblockLayout("").AlignHorizontally(TextAlignment.Center).AlignVertically(TextAlignment.Center);

            this.requestSuggestion_layout = new RequestSuggestion_Layout(activityDatabase, true, true, false, 3, engine, layoutStack);
            this.requestSuggestion_layout.RequestSuggestion += RequestSuggestion_layout_RequestSuggestion;
            this.askWhatIsNext_layout = new TextblockLayout().AlignHorizontally(TextAlignment.Center).AlignVertically(TextAlignment.Center);

            LayoutChoice_Set helpWindow = (new HelpWindowBuilder()).AddMessage("Use this screen to ask for activity recommendations from among activities you have said that you like.")
                                          .AddMessage("By default, the recommendation will attempt to maximize your long-term happiness.")
                                          .AddMessage("The recommendation may be slightly randomized if ActivityRecommender doesn't have enough time to consider every activity within a couple seconds.")
                                          .AddMessage("If you are sure that you want an activity from a certain category, then you can enter its name into the category box, and ActivityRecommender will make sure " +
                                                      "that your suggestion will be an instance of that activity. For example, if you have previously entered an activity named Checkers and listed it as a child activity " +
                                                      "of Game, then when you ask for a Game, one possible suggestion will be Checkers.")
                                          .AddMessage("If you're looking for an activity to have a high amount of enjoyability right now, then think of what you would do if you couldn't ask ActivityRecommender for " +
                                                      "help, and type the name of that activity into the second box. If you do, then ActivityRecommender will make sure to provide a suggestion that it thinks you will like as " +
                                                      "much as it thinks you will like as much as the one you entered.")
                                          .AddMessage("Then, push one of the Suggest buttons")
                                          .AddMessage("You can request either the activity that is expected to maximize the long-term value to you, or " +
                                                      "the activity that ActivityRecommender thinks that you're most likely to do, among the activities satisfying your other criteria.")
                                          .AddMessage("Each suggestion will list an activity name, followed by the time to start the activity, an estimate of the probability that you will actually do that activity, " +
                                                      "and an estimate of the rating that you'd be expected to give to that activity.")
                                          .AddMessage("If you don't like a suggestion, press the X button next to it. The duration between when you ask for a suggestion and when you press the X is considered to " +
                                                      "be worth 0 happiness to you (unless you already recorded having done a participation during that time, in which case the duration between your latest completed participation and " +
                                                      "when you press the X is considered to be worth 0 happiness to you), so ActivityRecommender tries to avoid giving you too many suggestions that you don't take. However, if there's " +
                                                      "a certain activity that ActivityRecommender thinks would be awesome for you despite your current disinterest, then ActivityRecommender may repeat its suggestions a few times, in " +
                                                      "an effort to get you to reconsider.")
                                          .AddMessage("You can also plan out several participations in a row by pressing the Suggest button multiple times in a row.")
                                          .AddMessage("Whenever you record a participation matching the first suggestion in the list, then that suggestion will be removed.")
                                          .AddMessage("Enjoy!")
                                          .AddLayout(new CreditsButtonBuilder(layoutStack)
                                                     .AddContribution(ActRecContributor.ANNI_ZHANG, new DateTime(2019, 8, 1), "Suggested that when the user asks for a suggestion at least as fun as a certain activity, ActivityRecommender should always suggest a different activity than the one they mentioned")
                                                     .AddContribution(ActRecContributor.ANNI_ZHANG, new DateTime(2020, 7, 18), "Pointed out that buttons on iOS weren't visually responding to touch")
                                                     .AddContribution(ActRecContributor.ANNI_ZHANG, new DateTime(2020, 12, 17), "Mentioned that the suggestions were sometimes more repetitive than desired")
                                                     .AddContribution(ActRecContributor.ANNI_ZHANG, new DateTime(2021, 3, 26), "Suggested that the suggestions view could use the same descriptions as the participation entry view")
                                                     .AddContribution(ActRecContributor.ANNI_ZHANG, new DateTime(2021, 4, 24), "Asked for the suggestions to be less repetitive again")
                                                     .AddContribution(ActRecContributor.ANNI_ZHANG, new DateTime(2021, 4, 30), "Asked for the suggestions view to display multiple suggestions at once")
                                                     .AddContribution(ActRecContributor.ANNI_ZHANG, new DateTime(2021, 7, 2), "Suggested shorter suggestion button text")
                                                     .Build()
                                                     )
                                          .Build();

            this.helpButton_layout         = new HelpButtonLayout(helpWindow, this.layoutStack);
            this.experimentButton          = new Button();
            this.startExperiment_layout    = new ButtonLayout(this.experimentButton, "Efficiency Experiment");
            this.experimentButton.Clicked += ExperimentButton_Clicked;
            this.bottomLayout              = new Horizontal_GridLayout_Builder().Uniform().AddLayout(this.startExperiment_layout).AddLayout(this.helpButton_layout).Build();

            Vertical_GridLayout_Builder noActivities_help_builder = new Vertical_GridLayout_Builder();

            noActivities_help_builder.AddLayout(new TextblockLayout("This screen is where you will be able to ask for suggestions of what to do."));
            noActivities_help_builder.AddLayout(
                new HelpButtonLayout("Not a calendar: no interruptions, no reminders. Exciting!",
                                     new HelpWindowBuilder()
                                     .AddMessage("ActivityRecommender doesn't offer reminders at prescheduled times because that's boring. " +
                                                 "If you're looking for a simple scheduling algorithm, you may be interested in a calendar. ActivityRecommender is more like " +
                                                 "a friend, full of cool, interesting, somewhat randomized ideas based on information about you.")
                                     .Build()
                                     ,
                                     layoutStack
                                     )
                );
            noActivities_help_builder.AddLayout(
                new HelpButtonLayout("Suggestions get better over time",
                                     new HelpWindowBuilder()
                                     .AddMessage("The more data you enter into ActivityRecommender, the better its suggestions will be.")
                                     .AddMessage("When you haven't entered much data, ActivityRecommender primarily suggests activities that resemble other " +
                                                 "activities that you like. For example, if you've mentioned that Soccer and Jogging are relevant to you and that " +
                                                 "both of them are exercise, and if you tend to like Soccer, then ActivityRecommender may also recomend Jogging to you.")
                                     .AddMessage("After you've entered a little bit of data, ActivityRecommender tends to suggest activities that you like. " +
                                                 "If you tend to enjoy playing Soccer, then ActivityRecommender will recommend that!")
                                     .AddMessage("After you've entered more data, ActivityRecommender will be able to look for trends in how happy you are after " +
                                                 "having done various activities, and incorporate that too. For example, if you like to Eat Ice Cream, but eating ice cream" +
                                                 "late at night tends to make it hard to sleep, then maybe ActivityRecommender won't suggest it late at night even if you " +
                                                 "like it.")
                                     .AddMessage("After you've entered a lot of data, ActivityRecommender will even be able to look for trends in how happy you are " +
                                                 "after suggesting various activities. If you like walking but you don't have any ideas of where to walk, then maybe " +
                                                 "ActivityRecommender will notice that suggesting Walking never works. However, if you like buying things at the store, then " +
                                                 "perhaps ActivityRecommender will suggest that instead, if that causes you to walk to the store to buy something.")
                                     .Build()
                                     ,
                                     layoutStack
                                     )
                );
            noActivities_help_builder.AddLayout(new TextblockLayout("Before you can ask for a suggestion, ActivityRecommender needs you to go back " +
                                                                    "and add some activities first. Here is a convenient button for jumping directly to the Activities screen:"));
            Button visitActivities_button = new Button();

            visitActivities_button.Text     = "Activities";
            visitActivities_button.Clicked += VisitActivities_button_Clicked;
            noActivities_help_builder.AddLayout(new ButtonLayout(visitActivities_button));

            this.noActivities_explanationLayout = noActivities_help_builder.BuildAnyLayout();

            this.UpdateSuggestions();
        }
        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);
        }
Exemple #17
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 ActivityInheritancesView(Activity activity, ActivityDatabase activityDatabase, bool allowDeletion = false)
 {
     this.activityDatabase = activityDatabase;
     this.supportDeletion  = allowDeletion;
     this.setup(activity);
 }
 public NumberOfActivities_Graph(ActivityDatabase activityDatabase)
 {
     this.activityDatabase = activityDatabase;
     this.SubLayout        = this.plot();
 }
Exemple #20
0
 public DeclineSuggestion_Feature(ActivityDatabase activityDatabase)
 {
     this.activityDatabase = activityDatabase;
 }
Exemple #21
0
        public Full_RequestSuggestion_Layout(ActivityDatabase activityDatabase, bool allowRequestingActivitiesDirectly, bool allowMultipleSuggestionTypes, bool vertical,
                                             int numChoicesPerSuggestion, Engine engine, LayoutStack layoutStack)
        {
            this.numChoicesPerSuggestion = numChoicesPerSuggestion;
            Button suggestionButton = new Button();

            suggestionButton.Clicked += SuggestBestActivity_Clicked;
            ButtonLayout suggest_maxLongtermHappiness_button;

            if (allowMultipleSuggestionTypes)
            {
                suggest_maxLongtermHappiness_button = new ButtonLayout(suggestionButton, "Best");
            }
            else
            {
                suggest_maxLongtermHappiness_button = new ButtonLayout(suggestionButton, "Suggest");
            }
            LayoutChoice_Set suggestButton_layout;

            if (allowRequestingActivitiesDirectly)
            {
                GridLayout_Builder builder = new Vertical_GridLayout_Builder().Uniform().AddLayout(suggest_maxLongtermHappiness_button);
                if (allowMultipleSuggestionTypes)
                {
                    Button suggestionButton2 = new Button();
                    suggestionButton2.Clicked += SuggestMostLikelyActivity_Clicked;
                    ButtonLayout suggest_mostLikely_button = new ButtonLayout(suggestionButton2, "Most Likely");
                    builder.AddLayout(suggest_mostLikely_button);

                    Button suggestionButton3 = new Button();
                    suggestionButton3.Clicked += SuggestMostEfficientActivity_Clicked;
                    ButtonLayout suggest_mostEfficient_button = new ButtonLayout(suggestionButton3, "Most Future Efficiency");
                    builder.AddLayout(suggest_mostEfficient_button);
                }
                suggestButton_layout = builder.BuildAnyLayout();
            }
            else
            {
                suggestButton_layout = suggest_maxLongtermHappiness_button;
            }

            this.categoryBox = new ActivityNameEntryBox("Category:", activityDatabase, layoutStack);
            this.categoryBox.Placeholder("(Optional)");
            this.activityDatabase = activityDatabase;
            this.engine           = engine;
            this.layoutStack      = layoutStack;


            if (!allowRequestingActivitiesDirectly)
            {
                this.SubLayout = suggest_maxLongtermHappiness_button;
            }
            else
            {
                GridLayout configurationLayout = GridLayout.New(BoundProperty_List.Uniform(2), new BoundProperty_List(1), LayoutScore.Zero);
                configurationLayout.AddLayout(this.categoryBox);


                this.atLeastAsFunAs_button     = new Button();
                atLeastAsFunAs_button.Clicked += RequestAsFunAs_Button_Clicked;
                configurationLayout.AddLayout(new TitledControl("As fun as:", new ButtonLayout(atLeastAsFunAs_button)));

                if (vertical)
                {
                    GridLayout verticalContentLayout = GridLayout.New(new BoundProperty_List(2), new BoundProperty_List(1), LayoutScore.Get_UnCentered_LayoutScore(2));
                    verticalContentLayout.AddLayout(configurationLayout);
                    verticalContentLayout.AddLayout(suggestButton_layout);
                    this.SubLayout = verticalContentLayout;
                }
                else
                {
                    GridLayout horizontalContentLayout = GridLayout.New(new BoundProperty_List(1), new BoundProperty_List(2), LayoutScore.Get_UnCentered_LayoutScore(1));
                    horizontalContentLayout.AddLayout(suggestButton_layout);
                    horizontalContentLayout.AddLayout(configurationLayout);

                    this.SubLayout = horizontalContentLayout;
                }
                this.specify_AtLeastAsFunAs_Layout = new Specify_AtLeastAsFunAs_Layout(this.activityDatabase, this.layoutStack);
                this.update_atLeastAsFunAs_activity();
            }
        }
Exemple #22
0
 public RequestSuggestionToBeat_Feature(ActivityDatabase activityDatabase)
 {
     this.activityDatabase = activityDatabase;
 }
        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;
        }
Exemple #24
0
 public RequestSolution_Feature(ActivityDatabase activityDatabase)
 {
     this.activityDatabase = activityDatabase;
 }
Exemple #25
0
 public BrowseActivitiesMenu_Namer(ActivityDatabase activityDatabase)
 {
     this.activityDatabase = activityDatabase;
 }
Exemple #26
0
        public BrowseParticipations_Layout(ActivityDatabase activityDatabase, Engine engine, ScoreSummarizer scoreSummarizer, LayoutStack layoutStack)
        {
            this.activityDatabase = activityDatabase;
            this.engine           = engine;
            this.layoutStack      = layoutStack;
            this.scoreSummarizer  = scoreSummarizer;

            TextblockLayout helpLayout = new TextblockLayout("Browse participations");

            ActivityNameEntryBox categoryBox = new ActivityNameEntryBox("Category", activityDatabase, layoutStack, false, false);

            categoryBox.Placeholder("(Optional)");
            this.categoryBox = categoryBox;

            this.sinceDate_box = new DateEntryView("Since", layoutStack, false);
            this.sinceDate_box.Placeholder("(Optional)");

            this.displayRatings_box         = new VisiPlacement.CheckBox("No", "Yes");
            this.displayRatings_box.Checked = true;
            Thickness        buttonMargin          = new Thickness(0, 1);
            LayoutChoice_Set displayRatings_layout = new Horizontal_GridLayout_Builder()
                                                     .Uniform()
                                                     .AddLayout(new TextblockLayout("Show ratings?"))
                                                     .AddLayout(new MustBorderLayout(null, this.displayRatings_box, buttonMargin))
                                                     .BuildAnyLayout();

            this.requireComments_box         = new VisiPlacement.CheckBox("No", "Yes");
            this.requireComments_box.Checked = true;
            LayoutChoice_Set requireComments_layout = new Horizontal_GridLayout_Builder()
                                                      .Uniform()
                                                      .AddLayout(new TextblockLayout("Require comments?"))
                                                      .AddLayout(new MustBorderLayout(null, this.requireComments_box, buttonMargin))
                                                      .BuildAnyLayout();

            this.requireSuccessful_box = new VisiPlacement.SingleSelect(null, new List <string>()
            {
                "Any", "No Metric", "Successful", "Failed"
            });
            LayoutChoice_Set requireSuccessful_layout = new Horizontal_GridLayout_Builder()
                                                        .Uniform()
                                                        .AddLayout(new TextblockLayout("Require success status ="))
                                                        .AddLayout(new MustBorderLayout(null, this.requireSuccessful_box, buttonMargin))
                                                        .BuildAnyLayout();

            this.sortBy_box = new VisiPlacement.SingleSelect(null, new List <string>()
            {
                this.sortByFun_text, this.sortBy_netPresentHappiness_text, this.sortByEfficiency_text
            });
            LayoutChoice_Set sortBy_layout = new Horizontal_GridLayout_Builder()
                                             .Uniform()
                                             .AddLayout(new TextblockLayout("Sort by"))
                                             .AddLayout(new MustBorderLayout(null, this.sortBy_box, buttonMargin))
                                             .BuildAnyLayout();


            Button       browseTopParticipations_button = new Button();
            ButtonLayout browseTopParticipations_layout = new ButtonLayout(browseTopParticipations_button, "Top " + this.maxNumTopParticipationsToShow);

            browseTopParticipations_button.Clicked += BrowseTopParticipations_Button_Clicked;

            Button       browseExtremeParticipations_button = new Button();
            ButtonLayout browseExtremeParticipations_layout = new ButtonLayout(browseExtremeParticipations_button, "" + this.maxNumTopParticipationsToShow + " best/worst");

            browseExtremeParticipations_button.Clicked += BrowseExtremeParticipations_button_Clicked;


            Button       seeGoodRandomParticipation_button = new Button();
            ButtonLayout seeGoodRandomParticipation_layout = new ButtonLayout(seeGoodRandomParticipation_button, "A random, probably good one");

            seeGoodRandomParticipation_button.Clicked += SeeGoodRandomParticipation_Clicked;

            Button       seeRandomParticipations_button = new Button();
            ButtonLayout seeRandomParticipations_layout = new ButtonLayout(seeRandomParticipations_button, "" + this.maxNumRandomActivitiesToShow + " (uniformly) random");

            seeRandomParticipations_button.Clicked += SeeRandomParticipations_button_Clicked;

            this.SubLayout = new Vertical_GridLayout_Builder()
                             .AddLayout(helpLayout)
                             .AddLayout(categoryBox)
                             .AddLayout(sinceDate_box)
                             .AddLayout(displayRatings_layout)
                             .AddLayout(requireComments_layout)
                             .AddLayout(requireSuccessful_layout)
                             .AddLayout(sortBy_layout)
                             .AddLayout(
                new Horizontal_GridLayout_Builder()
                .Uniform()
                .AddLayout(browseTopParticipations_layout)
                .AddLayout(browseExtremeParticipations_layout)
                .AddLayout(seeGoodRandomParticipation_layout)
                .AddLayout(seeRandomParticipations_layout)
                .BuildAnyLayout()
                )
                             .Build();
            this.randomGenerator = new Random();
        }
 public SearchActivities_Feature(ActivityDatabase activityDatabase, ProtoActivity_Database protoActivity_database)
 {
     this.activityDatabase       = activityDatabase;
     this.protoActivity_database = protoActivity_database;
 }
 public AddedMetric_Feature(ActivityDatabase activityDatabase)
 {
     this.activityDatabase = activityDatabase;
 }
 public ProtoActivity_LayoutBuilder(ProtoActivity_Database protoActivity_Database, ActivityDatabase activityDatabase, LayoutStack layoutStack)
 {
     this.protoActivity_database = protoActivity_Database;
     this.activityDatabase       = activityDatabase;
     this.layoutStack            = layoutStack;
 }
Exemple #30
0
 public RequestSuggestionFromCategory_Feature(ActivityDatabase activityDatabase)
 {
     this.activityDatabase = activityDatabase;
 }