コード例 #1
0
ファイル: CategoriesPage.cs プロジェクト: romap0/DFFBudget
        private static void Refresh()
        {
            Global.PrepareCategories();

            var section = new Section();

            foreach (Category cCategory in Global.Categories)
            {
                section.Add(new StringElement(cCategory.Title, delegate
                {
                    CategoryPage(cCategory, delegate
                    {
                        Refresh();
                    });
                }));
            }

            root.Clear();
            root.Add(section);

            if (root.Count == 0)
            {
                root.Add(new Section("Нет записей"));
            }
        }
コード例 #2
0
            void GroupByDate()
            {
                if (Global.Incomes != null)
                {
                    root.Clear();

                    //Global.Incomes = Global.Incomes.OrderByDescending(op => op.Datetime).ToList();
                    var groups = Global.Incomes.GroupBy(op => op.Datetime).ToList();

                    foreach (var cGroup in groups.OrderByDescending(op => op.Key).ToList())
                    {
                        root.Add(new Section(cGroup.Key.ToString("dd MMMM yyyy")));

                        foreach (var cOp in cGroup.OrderBy(op => op.Datetime).ToList())
                        {
                            root.Last().Add(new StringElement(cOp.Sum.ToString() + "руб.", () => OperationPage(cOp, () =>
                            {
                                GroupByDate();
                            }, "income")));
                        }
                    }
                }
                else
                {
                    root.Add(new Section("Нет записей"));
                }
            }
コード例 #3
0
            private void MakeStatistics()
            {
                root.Clear();

                if (Global.Outcomes != null)
                {
                    Section opSection = new Section("null");

                    var finishDate = DateTime.Now.AddMonths(-6);

                    for (DateTime cDate = DateTime.Now; cDate > finishDate; cDate = cDate.AddMonths(-1))
                    {
                        int incomes  = 0;
                        int outcomes = 0;
                        foreach (var cOutcome in Global.Outcomes)
                        {
                            if (cOutcome.Datetime.Year == cDate.Year && cOutcome.Datetime.Month == cDate.Month)
                            {
                                outcomes += cOutcome.Sum;
                            }
                        }
                        foreach (var cIncome in Global.Incomes)
                        {
                            if (cIncome.Datetime.Year == cDate.Year && cIncome.Datetime.Month == cDate.Month)
                            {
                                incomes += cIncome.Sum;
                            }
                        }

                        if (incomes + outcomes != 0)
                        {
                            opSection = new Section(String.Format("{0} {1}", Month[cDate.Month], cDate.Year))
                            {
                                new StringElement("Расходы", outcomes.ToString()),
                                new StringElement("Доходы", incomes.ToString()),
                                new StringElement("Баланс", (incomes - outcomes).ToString())
                            };
                            root.Add(opSection);
                        }
                    }
                }
                else
                {
                    root.Add(new Section("Нет записей"));
                }
            }
コード例 #4
0
ファイル: TwitterScreen.cs プロジェクト: zjxjr/mobile-samples
        /// <summary>
        /// This could get called from main thread or background thread.
        /// Remember to InvokeOnMainThread if required
        /// </summary>
        void PopulateData()
        {
            if (TwitterFeed.Count == 0)
            {
                var section = new Section("Network unavailable")
                {
                    new StyledStringElement("Twitter not available. Try again later.")
                };
                Root = new RootElement("Twitter")
                {
                    section
                };
            }
            else
            {
                Section section;
                UI.CustomElements.TweetElement twitterElement;

                // create a root element and a new section (MT.D requires at least one)
                Root    = new RootElement("Twitter");
                section = new Section();

                // for each tweet, add a custom TweetElement to the MT.D elements collection
                foreach (var tw in TwitterFeed)
                {
                    var currentTweet = tw;
                    twitterElement = new UI.CustomElements.TweetElement(currentTweet, splitView);
                    section.Add(twitterElement);
                }

                Root.Clear();
                // add the section to the root
                Root.Add(section);
            }
            base.StopLoadingScreen();                   // hide the 'loading' animation (from base)
            ReloadComplete();
        }
コード例 #5
0
 public override void Reset()
 {
     RootElement.Clear();
     InspectorElement?.Dispose();
 }