示例#1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            ISharedPreferences       prefs  = PreferenceManager.GetDefaultSharedPreferences(this);
            ISharedPreferencesEditor editor = prefs.Edit();

            if (prefs.GetBoolean("default_settings", true))
            {
                editor.PutInt("bestsellers_quantity", 5);
                editor.PutInt("bestsellers_amount", 5);
                editor.PutInt("keywords_dashboard", 3);
                editor.PutInt("keywords_stats", 5);
                editor.PutString("sales_format", "Integer");
                editor.Apply();
            }

            SetContentView(Resource.Layout.configurations);

            SupportActionBar.SetDisplayHomeAsUpEnabled(true);

            SupportActionBar.SetDisplayShowHomeEnabled(false);

            Configs = FindViewById <ListView>(Resource.Id.configs_list);

            mAdapter = new SeparatedListAdapter(this);

            InitializeConfigs(prefs);

            Configs.ItemClick += Configs_ItemClick;

            Configs.Adapter = mAdapter;
        }
示例#2
0
        SeparatedListAdapter CreateAdapter <T>(Dictionary <string, List <T> > sortedObjects)
            where T : IHasLabel, IComparable <T>
        {
            var adapter = new SeparatedListAdapter(this);

            foreach (var e in sortedObjects.OrderBy(de => de.Key))
            {
                var label   = e.Key;
                var section = e.Value;
                adapter.AddSection(label, new ArrayAdapter <T>(this, Resource.Layout.ListItem, section));
            }
            return(adapter);
        }
示例#3
0
 protected void InitializeConfigs(ISharedPreferences prefs)
 {
     mAdapter = new SeparatedListAdapter(this);
     mAdapter.AddSectionHeaderItem("Sale Values Settings");
     mAdapter.AddItem("Number of Bestsellers by Quantity: " + prefs.GetInt("bestsellers_quantity", 5));
     mAdapter.AddItem("Number of Bestsellers by Amount:" + prefs.GetInt("bestsellers_amount", 5));
     mAdapter.AddSectionHeaderItem("Dashboard Settings");
     mAdapter.AddItem("Number of Popular Keywords: " + prefs.GetInt("keywords_dashboard", 3));
     mAdapter.AddItem("Sale Values in " + prefs.GetString("sales_format", "Integer"));
     mAdapter.AddSectionHeaderItem("Statistics Settings");
     mAdapter.AddItem("Number of Popular Keywords: " + prefs.GetInt("keywords_stats", 5));
     Configs.Adapter = mAdapter;
 }
示例#4
0
        private async Task UpdateValues()
        {
            mAdapter = new SeparatedListAdapter(this);
            ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(this);

            mAdapter.AddSectionHeaderItem("Popular Keywords");
            var Keywords = await api.GetPopularKeywords(prefs.GetInt("keywords_stats", 5));

            for (int i = 0; i < prefs.GetInt("keywords_stats", 5); i++)
            {
                mAdapter.AddItem(Keywords[i].Keyword);
            }

            mAdapter.AddSectionHeaderItem("Registered Users");

            var WeekCustomers = await api.GetCustomerCountByTime(7);

            var TwoWeeksCustomers = await api.GetCustomerCountByTime(14);

            var MonthCustomers = await api.GetCustomerCountByTime(30);

            var YearCustomers = await api.GetCustomerCountByTime(365);

            mAdapter.AddItem("Last 7 Days: " + WeekCustomers);
            mAdapter.AddItem("Last 14 Days: " + TwoWeeksCustomers);
            mAdapter.AddItem("Last Month: " + MonthCustomers);
            mAdapter.AddItem("Last Year: " + YearCustomers);

            mAdapter.AddSectionHeaderItem("Total Sales");
            var WeekSales = await api.GetTotalSalesByTime(7);

            var TwoWeeksSales = await api.GetTotalSalesByTime(14);

            var MonthSales = await api.GetTotalSalesByTime(30);

            var YearSales = await api.GetTotalSalesByTime(365);

            var Currency = await api.GetCurrency();

            mAdapter.AddItem("Last 7 Days: " + WeekSales.ToString("0.0#") + " " + Currency);
            mAdapter.AddItem("Last 14 Days: " + TwoWeeksSales.ToString("0.0#") + " " + Currency);
            mAdapter.AddItem("Last Month: " + MonthSales.ToString("0.0#") + " " + Currency);
            mAdapter.AddItem("Last Year: " + YearSales.ToString("0.0#") + " " + Currency);

            StatsList.Adapter = mAdapter;
            dialog.Dismiss();
        }
示例#5
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.misc_stats);

            SupportActionBar.SetDisplayHomeAsUpEnabled(true);

            SupportActionBar.SetDisplayShowHomeEnabled(false);

            StatsList = FindViewById <ListView>(Resource.Id.misc_stats_list);

            mAdapter = new SeparatedListAdapter(this);
            dialog   = ProgressDialog.Show(this, "", "Loading. Please wait... ", true);
            var Task = UpdateValues();

            StatsList.Adapter = mAdapter;
        }