Exemplo n.º 1
0
        public void Clone_ScrollLayout()
        {
            var layout = new ScrollLayout()
            {
                Size             = new Vector2(20, 30),
                Position         = new Point(40, 50),
                Horizontal       = HorizontalAlignment.Center,
                Vertical         = VerticalAlignment.Center,
                Scale            = 0.5f,
                ScrollPosition   = new Vector2(60, 70),
                TransitionObject = new WipeTransitionObject(TransitionWipeType.PopTop),
                MaxScroll        = new Vector2(80, 90),
                MinScroll        = new Vector2(100, 200),
            };

            var clone = layout.DeepCopy() as ScrollLayout;

            Assert.AreEqual(20, clone.Size.X);
            Assert.AreEqual(30, clone.Size.Y);
            Assert.AreEqual(40, clone.Position.X);
            Assert.AreEqual(50, clone.Position.Y);
            Assert.AreEqual(HorizontalAlignment.Center, clone.Horizontal);
            Assert.AreEqual(VerticalAlignment.Center, clone.Vertical);
            Assert.AreEqual(.5f, clone.Scale);
            Assert.AreEqual(TransitionWipeType.PopTop, (clone.TransitionObject as WipeTransitionObject).WipeType);
            Assert.AreEqual(100, clone.MinScroll.X);
            Assert.AreEqual(200, clone.MinScroll.Y);
            Assert.AreEqual(80, clone.MaxScroll.X);
            Assert.AreEqual(90, clone.MaxScroll.Y);
        }
Exemplo n.º 2
0
        public ActivitySuggestion_Explanation_Layout(ActivitySuggestion_Explanation explanation)
        {
            this.explanation = explanation;
            ActivitySuggestion          suggestion = explanation.Suggestion;
            Vertical_GridLayout_Builder builder    = new Vertical_GridLayout_Builder();

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

            Button explainQuality_button = new Button();

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

            this.SubLayout = ScrollLayout.New(builder.Build());
        }
Exemplo n.º 3
0
        private void calculate()
        {
            List <Activity> activities = this.engine.ActivitiesSortedByAverageRating;
            List <string>   texts      = new List <string>();

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

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

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

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

                LayoutChoice_Set newLayout = ScrollLayout.New(gridBuilder.Build());
                this.layoutStack.AddLayout(newLayout, "Preferences");
            });
        }
Exemplo n.º 4
0
    private Vector2 GetChatHeight(object data)
    {
        ScrollLayout referScrollLayout = scrollSystem.GetOriginPrefab("Chat").GetComponent <ScrollLayout>();
        var          height            = referScrollLayout.GetHeightByStr((data as ChatData).msg);

        return(new Vector2(-1, height));
    }
        private void ShrunkenListView_SelectedActivities(string name, List <Activity> activities)
        {
            ActivityListView fullListView = new ActivityListView(name, activities, true);

            fullListView.SelectedActivity += ListView_SelectedActivity;
            this.SetContent(ScrollLayout.New(fullListView));
        }
Exemplo n.º 6
0
        public override SpecificLayout GetBestLayout(LayoutQuery query)
        {
            if (this.text == null)
            {
                if (this.textProvider == null)
                {
                    this.text = "Reading logs on this platform is not supported. Sorry";
                }
                else
                {
                    this.text = textProvider.Get().ReadToEnd();
                }

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

                this.SubLayout = ScrollLayout.New(builder.BuildAnyLayout());
            }
            return(base.GetBestLayout(query));
        }
        public Customize_ScoringRules_Layout(UserPreferences_Database userPreferencesDatabase, LayoutStack layoutStack)
        {
            this.userPreferencesDatabase = userPreferencesDatabase;
            this.layoutStack             = layoutStack;

            this.viewLayout     = new View_ScoringRules_Layout(userPreferencesDatabase);
            this.newRule_layout = new New_ScoringRule_Layout(userPreferencesDatabase);

            BoundProperty_List rowHeights = new BoundProperty_List(2);

            rowHeights.BindIndices(0, 1);
            rowHeights.SetPropertyScale(0, 7);
            rowHeights.SetPropertyScale(1, 1);
            GridLayout grid = GridLayout.New(rowHeights, new BoundProperty_List(1), LayoutScore.Zero);

            grid.AddLayout(this.viewLayout);


            Button newRuleButton = new Button();

            newRuleButton.Clicked += NewRuleButton_Clicked;
            grid.AddLayout(new ButtonLayout(newRuleButton, "New Rule"));

            this.SubLayout = ScrollLayout.New(grid);
        }
Exemplo n.º 8
0
        public override async Task LoadContent()
        {
            await base.LoadContent();

            var stack = GetStack();

            //create the scroll layout and add the stack
            var scroll = new ScrollLayout()
            {
                Horizontal = HorizontalAlignment.Center,
                Vertical   = VerticalAlignment.Center,
                Size       = new Vector2(350, 512),
                Position   = Resolution.ScreenArea.Center
            };

            scroll.AddItem(stack);
            AddItem(scroll);

            var stack1 = GetStack();

            stack1.Position = new Point(Resolution.ScreenArea.Center.X / 2, Resolution.ScreenArea.Top);
            AddItem(stack1);

            AddCancelButton();
        }
Exemplo n.º 9
0
 private void update()
 {
     if (this.protoActivity_database.ProtoActivities.Count() < 1)
     {
         this.SubLayout = new TextblockLayout("No protoactivities!");
     }
     else
     {
         GridLayout_Builder   builder         = new Vertical_GridLayout_Builder().Uniform();
         List <ProtoActivity> protoActivities = new List <ProtoActivity>(protoActivity_database.ProtoActivities);
         protoActivities.Reverse();
         if (this.startIndex < 0)
         {
             this.startIndex = 0;
         }
         if (startIndex >= protoActivities.Count)
         {
             startIndex = protoActivities.Count - 1;
         }
         int endIndex = Math.Min(startIndex + this.pageCount, protoActivities.Count);
         if (this.startIndex > 0)
         {
             builder.AddLayout(this.prevButtonLayout);
         }
         for (int i = startIndex; i < endIndex; i++)
         {
             builder.AddLayout(this.summarize(protoActivities[i]));
         }
         if (endIndex < protoActivities.Count)
         {
             builder.AddLayout(this.nextButtonLayout);
         }
         this.SubLayout = ScrollLayout.New(builder.BuildAnyLayout());
     }
 }
Exemplo n.º 10
0
        private void initialize(bool showRatings)
        {
            List <Participation> participations = new List <Participation>(this.participations);

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

            Vertical_GridLayout_Builder gridBuilder = new Vertical_GridLayout_Builder();

            foreach (Participation participation in participations)
            {
                ParticipationView v = new ParticipationView(participation, this.scoreSummarizer, this.layoutStack, this.engine, showRatings);
                v.AddParticipationComment += Child_AddParticipationComment;
                gridBuilder.AddLayout(v);
            }
            if (!showRatings)
            {
                Button showRatings_button = new Button();
                showRatings_button.Clicked += ShowRatings_button_Clicked;
                showRatings_button.Text     = "Show Ratings";
                ButtonLayout showRatings_layout = new ButtonLayout(showRatings_button);
                gridBuilder.AddLayout(showRatings_layout);
            }
            this.SubLayout = ScrollLayout.New(gridBuilder.BuildAnyLayout());
        }
Exemplo n.º 11
0
        public void Init(IQFrameworkContainer container)
        {
            var frameworkData    = mPackageDatas.Find(packageData => packageData.Name == "Framework");
            var frameworkVersion = string.Format("QFramework:{0}", frameworkData.Version);

            mEGORootLayout = new VerticalLayout();


            var frameworkInfoLayout = new HorizontalLayout("box")
                                      .AddTo(mEGORootLayout);

            new EGO.Framework.LabelView(frameworkVersion)
            .Width(150)
            .FontBold()
            .FontSize(12)
            .AddTo(frameworkInfoLayout);

            new ToggleView(LocaleText.VersionCheck, VersionCheck)
//                .FontSize(12)
//                .FontBold()
            .AddTo(frameworkInfoLayout)
            .Toggle.Bind(newValue => VersionCheck = newValue);

            new ToolbarView(ToolbarIndex)
            .Menus(ToolbarNames.ToList())
            .AddTo(mEGORootLayout)
            .Index.Bind(newIndex => ToolbarIndex = newIndex);


            new HeaderView()
            .AddTo(mEGORootLayout);

            var packageList = new VerticalLayout("box")
                              .AddTo(mEGORootLayout);

            var scroll = new ScrollLayout()
                         .Height(240)
                         .AddTo(packageList);

            new EGO.Framework.SpaceView(2).AddTo(scroll);

            mOnToolbarIndexChanged = () =>
            {
                scroll.Clear();

                foreach (var packageData in SelectedPackageType)
                {
                    new EGO.Framework.SpaceView(2).AddTo(scroll);
                    new PackageView(packageData).AddTo(scroll);
                }
            };

            foreach (var packageData in SelectedPackageType)
            {
                new EGO.Framework.SpaceView(2).AddTo(scroll);
                new PackageView(packageData).AddTo(scroll);
            }
        }
Exemplo n.º 12
0
        public void OnDispose()
        {
            BindKit.ClearBindingSet(this);

            mScrollLayout           = null;
            mCategoriesSelectorView = null;
            mPackageManagerApp.Dispose();
            mPackageManagerApp = null;
        }
Exemplo n.º 13
0
        // public ToDoListFinishedView(AbsViewController ctrl) : base(ctrl)
        // {
        //  Init();
        // }

        private void Init()
        {
            Add(new SpaceView());
            var scrollLayout = new ScrollLayout();

            todosParent = new VerticalLayout();
            scrollLayout.Add(todosParent);
            Add(scrollLayout);
        }
Exemplo n.º 14
0
        public ToDoListProductView(AbsViewController _ctrl) : base(_ctrl, "box")
        {
            var scrollLayout = new ScrollLayout().AddTo(this);

            productViews = new VerticalLayout("box").AddTo(scrollLayout);
            detailViews  = new VerticalLayout("box").AddTo(scrollLayout);

            // Rebuild();
        }
        private void Button_Clicked(object sender, EventArgs e)
        {
            string summary = this.lifeSummarizer.Summarize(this.StartDate, DateTime.Now);
            // Show the summary in a text box so the user can copy the text. If the user wants to change the text, that's ok too
            Editor textBox = new Editor();

            textBox.Text = summary;
            this.layoutStack.AddLayout(ScrollLayout.New(new TextboxLayout(textBox), true), "Summary");
        }
Exemplo n.º 16
0
        public void OnDispose()
        {
            TypeEventSystem.UnRegister <PackageManagerViewUpdate>(OnRefresh);

            mScrollLayout           = null;
            mCategoriesSelectorView = null;
            mPackageManagerApp.Dispose();
            mPackageManagerApp = null;
        }
        private void regenerateEntries()
        {
            List <Inheritance> unchosenInheritances          = this.findUnchosenInheritances();
            List <Inheritance> immediatelyUsableInheritances = this.selectUsableInheritances(unchosenInheritances);

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

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

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

                this.SubLayout = ScrollLayout.New(gridBuilder.Build());
            }
        }
Exemplo n.º 18
0
        public ToDoListNoteView(AbsViewController ctrl) : base(ctrl, "box")
        {
            titleLabelView = new LabelView("欢迎来到笔记界面")
                             .TextMiddleCenter()
                             .FontBold()
                             .FontSize(40).AddTo(this);
            createButtonView = new ButtonView("创建笔记", () => CreateNewEditor(), true).FontSize(25).Height(30).AddTo(this);
            //closeButtonView = new ButtonView("关闭", () => CreateNewEditor(), true).AddTo(this);
            editorView           = new ToDoListNoteEditorView(SaveAction, CloseAction).AddTo(this);
            noteListScrollLayout = new ScrollLayout().AddTo(this);

            editorView.Hide();
        }
        public void UpdateLayout()
        {
            Vertical_GridLayout_Builder builder        = new Vertical_GridLayout_Builder();
            List <TextRule>             TextPredicates = this.userPreferencesDatabase.ScoringRules;

            foreach (TextRule rule in TextPredicates)
            {
                string text       = rule.ToString();
                Button ruleButton = new Button();
                ruleButton.Clicked += RuleButton_Clicked;
                ButtonLayout buttonLayout = new ButtonLayout(ruleButton, text, 16);
                builder.AddLayout(buttonLayout);
            }
            this.SubLayout = ScrollLayout.New(builder.Build());
        }
Exemplo n.º 20
0
        private void showResults(Activities_HappinessContributions contributions, DateTime start, DateTime end)
        {
            // title
            string title = "" + (contributions.Best.Count + contributions.Worst.Count) + " Activities adding or subtracting the most happiness from " + start + " to " + end;

            BoundProperty_List heights = new BoundProperty_List(4);

            heights.BindIndices(1, 3);
            GridLayout grid = GridLayout.New(heights, new BoundProperty_List(1), LayoutScore.Zero);

            grid.AddLayout(new TextblockLayout(title));

            // contents
            GridLayout_Builder topBuilder = new Vertical_GridLayout_Builder().Uniform();

            // Show the top activities from best to worst
            for (int i = 0; i < contributions.Best.Count; i++)
            {
                ActivityHappinessContribution item = contributions.Best[i];
                topBuilder.AddLayout(this.renderContribution("top " + (i + 1) + ": ", item, start));
            }
            grid.AddLayout(ScrollLayout.New(topBuilder.BuildAnyLayout()));

            // Use the help button as the divider between the best and worst activities
            LayoutChoice_Set helpWindow = new HelpWindowBuilder()
                                          .AddMessage("Activities that you like more than average are accompanied by positive numbers.")
                                          .AddMessage("Activities that you like less than average are accompanied by negative numbers.")
                                          .AddMessage("Activities that you participated in for more total time are accompanied by numbers that are further from 0.")
                                          .AddMessage("Specifically, each of these numbers is calculated by looking at all of the participations in that activity during this time, " +
                                                      "computing the difference between the happiness of that participation and your overall average happiness, " +
                                                      "multiplying each by the duration of its participation, and adding up the results.")
                                          .Build();

            grid.AddLayout(new HelpButtonLayout("?", helpWindow, this.layoutStack));

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

            // Show the bottom activities, also from best to worst
            for (int i = contributions.Worst.Count - 1; i >= 0; i--)
            {
                bottomBuilder.AddLayout(this.renderContribution("bottom " + (i + 1) + ": ", contributions.Worst[i], start));
            }
            grid.AddLayout(bottomBuilder.BuildAnyLayout());

            this.layoutStack.AddLayout(grid, "Significant Activities");
        }
Exemplo n.º 21
0
        private void showPosts()
        {
            List <AnalyzedPost>         posts       = new List <AnalyzedPost>(this.analyzedPosts);
            Vertical_GridLayout_Builder gridBuilder = new Vertical_GridLayout_Builder();

            gridBuilder.AddLayout(this.downloadStatus_container);

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

            int maxCountToShow = 30;

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

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

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

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

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

            this.resultsLayout.SubLayout = scrollLayout;
        }
Exemplo n.º 22
0
        void OnRefresh(QF.PackageKit.State state)
        {
            mRootLayout = new VerticalLayout();

            var treeNode = new TreeNode(true, LocaleText.FrameworkPackages).AddTo(mRootLayout);

            var verticalLayout = new VerticalLayout("box");

            treeNode.Add2Spread(verticalLayout);

            new ToolbarView(ToolbarIndex)
            .Menus(ToolbarNames.ToList())
            .AddTo(verticalLayout)
            .Index.Bind(newIndex => ToolbarIndex = newIndex);


            new HeaderView()
            .AddTo(verticalLayout);

            var packageList = new VerticalLayout("box")
                              .AddTo(verticalLayout);

            var scroll = new ScrollLayout()
                         .Height(240)
                         .AddTo(packageList);

            new SpaceView(2).AddTo(scroll);

            mOnToolbarIndexChanged = () =>
            {
                scroll.Clear();

                foreach (var packageData in SelectedPackageType(state.PackageDatas))
                {
                    new SpaceView(2).AddTo(scroll);
                    new PackageView(packageData).AddTo(scroll);
                }
            };

            foreach (var packageData in SelectedPackageType(state.PackageDatas))
            {
                new SpaceView(2).AddTo(scroll);
                new PackageView(packageData).AddTo(scroll);
            }
        }
        private void setupDrawing()
        {
            this.textA      = new Editor();
            this.textA.Text = this.protoA.Text;
            this.textB      = new Editor();
            this.textB.Text = this.protoB.Text;
            TextblockLayout description = new TextblockLayout("Split into two protoactivities, then go back");

            BoundProperty_List rowHeights = new BoundProperty_List(3);

            rowHeights.BindIndices(0, 2);
            GridLayout grid = GridLayout.New(rowHeights, new BoundProperty_List(1), LayoutScore.Zero);

            grid.AddLayout(ScrollLayout.New(new TextboxLayout(this.textA)));
            grid.AddLayout(description);
            grid.AddLayout(ScrollLayout.New(new TextboxLayout(this.textB)));
            this.SubLayout = grid;
        }
        private void updateLayout()
        {
            Vertical_GridLayout_Builder largeFont_builder = new Vertical_GridLayout_Builder();
            Vertical_GridLayout_Builder smallFont_builder = new Vertical_GridLayout_Builder();

            foreach (string url in this.FeedUrls)
            {
                Button feedButton = new Button();
                feedButton.Clicked += FeedButton_Clicked;
                largeFont_builder.AddLayout(new ButtonLayout(feedButton, url, 24, true, false, false, true));
                smallFont_builder.AddLayout(new ButtonLayout(feedButton, url, 16, true, false, false, true));
            }

            LayoutChoice_Set topLayout = ScrollLayout.New(new LayoutUnion(largeFont_builder.Build(), smallFont_builder.Build()));

            this.SubLayout = new Vertical_GridLayout_Builder()
                             .AddLayout(topLayout)
                             .AddLayout(this.newFeedsLayout)
                             .Build();
        }
Exemplo n.º 25
0
        public void Init(IQFrameworkContainer container)
        {
// view
            mRootLayout = new VerticalLayout();
            var treeNode = new TreeNode(true, LocaleText.FrameworkPackages).AddTo(mRootLayout);

            var verticalLayout = new VerticalLayout("box");

            treeNode.Add2Spread(verticalLayout);


            mCategoriesSelectorView = new ToolbarView(0)
                                      .AddTo(verticalLayout);

            mCategoriesSelectorView.Index.Bind(newIndex =>
            {
                TypeEventSystem.Send <IEditorStrangeMVCCommand>(new PackageManagerSelectCategoryCommand()
                {
                    CategoryIndex = newIndex
                });
            });

            new HeaderView()
            .AddTo(verticalLayout);

            var packageList = new VerticalLayout("box")
                              .AddTo(verticalLayout);

            mScrollLayout = new ScrollLayout()
                            .Height(240)
                            .AddTo(packageList);

            TypeEventSystem.Register <PackageManagerViewUpdate>(OnRefresh);

            // 执行
            TypeEventSystem.Send <IEditorStrangeMVCCommand>(new PackageManagerStartUpCommand());

            var bindingSet = BindKit.CreateBindingSet(this, new PackageManagerViewModel());
        }
Exemplo n.º 26
0
        public void Init(IQFrameworkContainer container)
        {
            Container = container;

            PackageManagerApp.Send <PackageManagerInitCommand>();

            mRootLayout = new VerticalLayout();
            var treeNode = new TreeNode(true, LocaleText.FrameworkPackages).AddTo(mRootLayout);

            var verticalLayout = new VerticalLayout("box");

            treeNode.Add2Spread(verticalLayout);

            var searchView = new HorizontalLayout("box")
                             .AddTo(verticalLayout);

            searchView.AddChild(new LabelView("搜索:")
                                .FontBold()
                                .FontSize(12)
                                .Width(40));

            searchView.AddChild(
                new TextView().Height(20)
                .Do(search =>
            {
                search.Content
                .Bind(key => { PackageManagerApp.Send(new SearchCommand(key)); }).AddTo(mDisposableList);
            })
                );

            mAccessRightView = new ToolbarView()
                               .Menus(new List <string>()
            {
                "all", PackageAccessRight.Public.ToString(), PackageAccessRight.Private.ToString()
            })
                               .AddTo(verticalLayout)
                               .Do(self =>
            {
                self.Index.Bind(value =>
                {
                    PackageManagerState.AccessRightIndex.Value = value;
                    PackageManagerApp.Send(new SearchCommand(PackageManagerState.SearchKey.Value));
                }).AddTo(mDisposableList);
            });

            mCategoriesSelectorView = new ToolbarView()
                                      .AddTo(verticalLayout)
                                      .Do(self =>
            {
                self.Index.Bind(value =>
                {
                    PackageManagerState.CategoryIndex.Value = value;
                    PackageManagerApp.Send(new SearchCommand(PackageManagerState.SearchKey.Value));
                }).AddTo(mDisposableList);
            });

            new PackageListHeaderView()
            .AddTo(verticalLayout);

            var packageList = new VerticalLayout("box")
                              .AddTo(verticalLayout);

            mRepositoryList = new ScrollLayout()
                              .Height(240)
                              .AddTo(packageList);

            PackageManagerState.Categories.Bind(value => { Categories = value; }).AddTo(mDisposableList);

            PackageManagerState.PackageRepositories
            .Bind(list => { this.PackageRepositories = list; }).AddTo(mDisposableList);
        }
Exemplo n.º 27
0
        public override async Task LoadContent()
        {
            await base.LoadContent();

            AddCancelButton();

            //add the scroll options
            var scroll = new MenuEntry("Scroll Up", Content);

            scroll.OnClick += ((object obj, ClickEventArgs e) =>
            {
                var scrollPos = _layout.ScrollPosition;
                scrollPos.Y -= _scrollDelta;
                _layout.ScrollPosition = scrollPos;
            });
            AddMenuEntry(scroll);

            scroll          = new MenuEntry("Scroll Down", Content);
            scroll.OnClick += ((object obj, ClickEventArgs e) =>
            {
                var scrollPos = _layout.ScrollPosition;
                scrollPos.Y += _scrollDelta;
                _layout.ScrollPosition = scrollPos;
            });
            AddMenuEntry(scroll);

            scroll          = new MenuEntry("Scroll Left", Content);
            scroll.OnClick += ((object obj, ClickEventArgs e) =>
            {
                var scrollPos = _layout.ScrollPosition;
                scrollPos.X -= _scrollDelta;
                _layout.ScrollPosition = scrollPos;
            });
            AddMenuEntry(scroll);

            scroll          = new MenuEntry("Scroll Right", Content);
            scroll.OnClick += ((object obj, ClickEventArgs e) =>
            {
                var scrollPos = _layout.ScrollPosition;
                scrollPos.X += _scrollDelta;
                _layout.ScrollPosition = scrollPos;
            });
            AddMenuEntry(scroll);

            //create the stack layout and add some labels
            var stack = new StackLayout()
            {
                Alignment  = StackAlignment.Top,
                Horizontal = HorizontalAlignment.Left,
                Vertical   = VerticalAlignment.Top
            };

            var label  = new Label("buttnuts", Content, FontSize.Small);
            var button = new RelativeLayoutButton()
            {
                HasOutline    = true,
                HasBackground = false
            };

            button.Size = new Vector2(label.Rect.Width, label.Rect.Height);
            button.AddItem(label);
            button.OnClick += ((object obj, ClickEventArgs e) =>
            {
                ExitScreen();
            });
            stack.AddItem(button);

            label  = new Label("catpants", Content, FontSize.Small);
            button = new RelativeLayoutButton()
            {
                HasOutline    = true,
                HasBackground = false
            };
            button.Size = new Vector2(label.Rect.Width, label.Rect.Height);
            button.AddItem(label);
            button.OnClick += ((object obj, ClickEventArgs e) =>
            {
                ExitScreen();
            });
            stack.AddItem(button);

            label  = new Label("foo", Content, FontSize.Small);
            button = new RelativeLayoutButton()
            {
                HasOutline    = true,
                HasBackground = false
            };
            button.Size = new Vector2(label.Rect.Width, label.Rect.Height);
            button.AddItem(label);
            button.OnClick += ((object obj, ClickEventArgs e) =>
            {
                ExitScreen();
            });
            stack.AddItem(button);

            label  = new Label("bleh", Content, FontSize.Small);
            button = new RelativeLayoutButton()
            {
                HasOutline    = true,
                HasBackground = false
            };
            button.Size = new Vector2(label.Rect.Width, label.Rect.Height);
            button.AddItem(label);
            button.OnClick += ((object obj, ClickEventArgs e) =>
            {
                ExitScreen();
            });
            stack.AddItem(button);

            //create the scroll layout and add the stack
            _layout = new ScrollLayout()
            {
                Horizontal = HorizontalAlignment.Right,
                Vertical   = VerticalAlignment.Bottom,
                Size       = new Vector2(label.Rect.Width, label.Rect.Height)
            };
            _layout.Position = new Point(ResolutionBuddy.Resolution.ScreenArea.Right, ResolutionBuddy.Resolution.ScreenArea.Bottom);

            _layout.AddItem(stack);
            AddItem(_layout);
        }
Exemplo n.º 28
0
        public void Init(IQFrameworkContainer container)
        {
            PackageKitModel.Subject
            .StartWith(PackageKitModel.State)
            .Subscribe(state =>
            {
//                    var frameworkData = PackageInfosRequestCache.Get().PackageDatas.Find(packageData => packageData.Name == "Framework");
//                    var frameworkVersion = string.Format("QFramework:{0}", frameworkData.Version);

                mRootLayout = new VerticalLayout();

                var treeNode = new TreeNode(true, LocaleText.FrameworkPackages).AddTo(mRootLayout);


                var verticalLayout = new VerticalLayout("box");


                treeNode.Add2Spread(verticalLayout);

//                    var frameworkInfoLayout = new HorizontalLayout("box")
//                        .AddTo(mEGORootLayout);

//                    new EGO.Framework.LabelView(frameworkVersion)
//                        .Width(150)
//                        .FontBold()
//                        .FontSize(12)
//                        .AddTo(frameworkInfoLayout);

//                    new ToggleView(LocaleText.VersionCheck, state.VersionCheck)
//                        .AddTo(frameworkInfoLayout)
//                        .Toggle
//                        .Bind(newValue => state.VersionCheck = newValue);

                new ToolbarView(ToolbarIndex)
                .Menus(ToolbarNames.ToList())
                .AddTo(verticalLayout)
                .Index.Bind(newIndex => ToolbarIndex = newIndex);


                new HeaderView()
                .AddTo(verticalLayout);

                var packageList = new VerticalLayout("box")
                                  .AddTo(verticalLayout);

                var scroll = new ScrollLayout()
                             .Height(240)
                             .AddTo(packageList);

                new EGO.Framework.SpaceView(2).AddTo(scroll);

                mOnToolbarIndexChanged = () =>
                {
                    scroll.Clear();

                    foreach (var packageData in SelectedPackageType(state.PackageDatas))
                    {
                        new EGO.Framework.SpaceView(2).AddTo(scroll);
                        new PackageView(packageData).AddTo(scroll);
                    }
                };

                foreach (var packageData in SelectedPackageType(state.PackageDatas))
                {
                    new EGO.Framework.SpaceView(2).AddTo(scroll);
                    new PackageView(packageData).AddTo(scroll);
                }
            });
        }
Exemplo n.º 29
0
        public void Init(IQFrameworkContainer container)
        {
            var bindingSet = BindKit.CreateBindingSet(this, new PackageManagerViewModel()
                                                      .InjectSelfWithContainer(mPackageManagerApp.Container)
                                                      .Init());

            mRootLayout = new VerticalLayout();
            var treeNode = new TreeNode(true, LocaleText.FrameworkPackages).AddTo(mRootLayout);

            var verticalLayout = new VerticalLayout("box");

            treeNode.Add2Spread(verticalLayout);


            var searchView = new HorizontalLayout("box")
                             .AddTo(verticalLayout);

            searchView.AddChild(new LabelView("搜索:")
                                .FontBold()
                                .FontSize(12)
                                .Width(40));

            searchView.AddChild(
                new TextView().Height(20)
                .Do(search =>
            {
                bindingSet.Bind(search.Content)
                .For(v => v.OnValueChanged)
                .To(vm => vm.Search)
                .CommandParameter(search.Content);
            })
                );

            mAccessRightView = new ToolbarView()
                               .Menus(new List <string>()
            {
                "all", PackageAccessRight.Public.ToString(), PackageAccessRight.Private.ToString()
            })
                               .AddTo(verticalLayout)
                               .Do(self =>
            {
                bindingSet.Bind(self.Index).For(v => v.Value, v => v.OnValueChanged)
                .To(vm => vm.AccessRightIndex);
            });

            mCategoriesSelectorView = new ToolbarView()
                                      .AddTo(verticalLayout)
                                      .Do(self =>
            {
                bindingSet.Bind(self.Index).For(v => v.Value, v => v.OnValueChanged)
                .To(vm => vm.CategoryIndex);
            });

            new HeaderView()
            .AddTo(verticalLayout);

            var packageList = new VerticalLayout("box")
                              .AddTo(verticalLayout);

            mScrollLayout = new ScrollLayout()
                            .Height(240)
                            .AddTo(packageList);

            // 执行
            TypeEventSystem.Send <IEditorStrangeMVCCommand>(new PackageManagerStartUpCommand());

            bindingSet.Bind().For((v) => v.PackageDatas)
            .To(vm => vm.PackageDatas);

            bindingSet.Bind().For(v => v.Categories)
            .To(vm => vm.Categories);

            bindingSet.Build();
        }
Exemplo n.º 30
0
 public void Setup()
 {
     _layout = new ScrollLayout();
 }