Beispiel #1
0
        private LayoutChoice_Set summarize(ProtoActivity protoActivity)
        {
            TextblockLayout option1 = new TextblockLayout(protoActivity.Text, true, 16);
            TextblockLayout option2 = new TextblockLayout(protoActivity.Text, 30);

            return(new LayoutUnion(option1, option2));
        }
        public StackEntry Get()
        {
            ProtoActivity protoActivity         = new ProtoActivity(null, DateTime.Now, Distribution.Zero);
            ProtoActivity_Editing_Layout layout = new ProtoActivity_Editing_Layout(protoActivity, this.protoActivity_database, this.activityDatabase, this.layoutStack);

            return(new StackEntry(layout, "Proto", layout));
        }
 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();
 }
        private void putAutocomplete(List <Activity> activities, List <ProtoActivity> protoActivities)
        {
            bool changed = true;

            if (activities.Count == this.activitiesByButton.Count && protoActivities.Count == this.protoActivities_byButton.Count)
            {
                changed = false;
                foreach (Activity activity in this.activitiesByButton.Values)
                {
                    if (!activities.Contains(activity))
                    {
                        changed = true;
                        break;
                    }
                }
                foreach (ProtoActivity protoActivity in this.protoActivities_byButton.Values)
                {
                    if (!protoActivities.Contains(protoActivity))
                    {
                        changed = true;
                        break;
                    }
                }
            }
            if (!changed)
            {
                return;
            }
            this.activitiesByButton       = new Dictionary <Button, Activity>();
            this.protoActivities_byButton = new Dictionary <Button, ProtoActivity>();

            for (int i = 0; i < activities.Count; i++)
            {
                Activity activity = activities[i];
                this.ensureButtonLayout(i);

                Button button = this.buttons[i];
                this.activitiesByButton[button] = activity;

                this.showResult(activity.ToString(), i);
            }
            for (int i = 0; i < protoActivities.Count; i++)
            {
                int           y             = i + activities.Count;
                ProtoActivity protoActivity = protoActivities[i];
                this.ensureButtonLayout(y);

                Button button = this.buttons[y];
                this.protoActivities_byButton[button] = protoActivity;
                this.showResult("ProtoActivity: " + protoActivity.Summarize(), y);
            }
            for (int i = activities.Count + protoActivities.Count; i < this.largeFont_autocomplete_gridLayout.NumRows; i++)
            {
                this.largeFont_autocomplete_gridLayout.PutLayout(null, 0, i);
                this.smallFont_autocomplete_gridLayout.PutLayout(null, 0, i);
            }
        }
        private void OkButton_Clicked(object sender, EventArgs e)
        {
            ProtoActivity protoActivity = this.ProtoActivity;

            if (protoActivity != null)
            {
                ProtoActivity_Editing_Layout layout = new ProtoActivity_Editing_Layout(protoActivity, this.protoactivityDatabase, this.activityDatabase, this.layoutStack);
                this.layoutStack.AddLayout(layout, "Proto", layout);
            }
        }
        private void updateButtonText()
        {
            ProtoActivity protoActivity = this.ProtoActivity;
            string        summary       = "";

            if (protoActivity != null)
            {
                summary = protoActivity.Summarize();
            }
            this.okButton.Text = summary;
        }
Beispiel #7
0
        private LayoutChoice_Set summarize(ProtoActivity protoActivity)
        {
            Button button = new Button();

            button.Clicked += Button_Clicked;

            string summary = protoActivity.Summarize();

            this.protoActivities_by_button[button] = protoActivity;
            return(new ButtonLayout(button, summary, 16));
        }
Beispiel #8
0
        private void SplitButton_Clicked(object sender, EventArgs e)
        {
            DateTime      now    = DateTime.Now;
            ProtoActivity child1 = new ProtoActivity(this.textBox.Text, now, this.protoActivity.Ratings);
            ProtoActivity child2 = new ProtoActivity(this.textBox.Text, now, this.protoActivity.Ratings);

            this.textBox.Text      = null;
            this.skipWhenGoingBack = true;

            ProtoActivity_Splitting_Layout splitter = new ProtoActivity_Splitting_Layout(child1, child2, this.database, this.layoutStack);
            StackEntry entry = new StackEntry(splitter, "Split", splitter);

            entry.Listeners.Add(this);
            this.layoutStack.AddLayout(entry);
        }
        private void Button_Click(object sender, EventArgs e)
        {
            Button button = sender as Button;

            if (button != null)
            {
                Activity activity;
                if (this.activitiesByButton.TryGetValue(button, out activity))
                {
                    this.choseActivity(activity);
                }
                else
                {
                    ProtoActivity protoActivity = this.protoActivities_byButton[button];

                    ProtoActivity_Editing_Layout layout = new ProtoActivity_Editing_Layout(protoActivity, this.protoActivity_database, this.activityDatabase, this.layoutStack);
                    this.layoutStack.AddLayout(layout, "Proto", layout);
                }
            }
        }
Beispiel #10
0
        private void edit(ProtoActivity protoActivity)
        {
            ProtoActivity_Editing_Layout layout = new ProtoActivity_Editing_Layout(protoActivity, this.protoActivity_database, this.activityDatabase, this.layoutStack);

            this.layoutStack.AddLayout(layout, "Proto", layout);
        }
Beispiel #11
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();
        }