private async void InitializeSideMenu(ISharedPreferences prefs) { var Store = FindViewById <TextView>(Resource.Id.storename); var Name = FindViewById <TextView>(Resource.Id.welcomebackname); var CName = await api.GetFullName(prefs.GetString("current_user", "Error")); Name.Text = CName; Store.Text = await api.GetStoreName(); var options = FindViewById <ListView>(Resource.Id.sidemenuoptions); options.Adapter = new SideMenuAdapter(this, Resources.GetStringArray(Resource.Array.side_menu_options), Resources.ObtainTypedArray(Resource.Array.options_icons)); GetAssociatedStores(prefs); }
private async Task InitializeStore() { var Current = ""; if (ChangeStore) { ResetValues(); UserSettings.Remove("current_url"); UserSettings.Add("current_url", StoreUrl); UserSettings.Remove("current_user"); UserSettings.Add("current_user", UserName); } UserSettings.TryGetValue("current_user", out Current); SideMenu.Header = await api.GetStoreName(); SideMenu.Header = SideMenu.Header.ToString().ToLower(); AdminName.Text = await api.GetFullName(Current); if (!ChangeStore) { foreach (KeyValuePair <string, object> url in UserSettings) { if (url.Key.StartsWith("store_url_")) { var Name = url.Key.Substring(10); UrlsMap.Add(new KeyValuePair <String, String>(Name, (string)url.Value)); urls.Add(Name); } } MyStoresList.ItemsSource = urls; } var Currency = await api.GetCurrency(); var SaleValuesIn = settings.GetValueOrDefault <int>(SaleValuesDash, 0); var PendingV = await api.GetStats(3); var CompleteV = await api.GetStats(2); var CancelledV = await api.GetStats(1); if (SaleValuesIn == 0) { PendingSales.Text = PendingV + " " + Currency;; CompleteSales.Text = CompleteV + " " + Currency;; CancelledSales.Text = CancelledV + " " + Currency;; } else { PendingSales.Text = PendingV.ToString("0.0#") + " " + Currency;; CompleteSales.Text = CompleteV.ToString("0.0#") + " " + Currency;; CancelledSales.Text = CancelledV.ToString("0.0#") + " " + Currency;; } var PendingOrdersCount = await api.GetPendingOrdersCount(); var CartsCount = await api.GetCartsCount(); var WishlistCount = await api.GetWishlistCount(); PendingOrders.Text = PendingOrdersCount.ToString(); Carts.Text = CartsCount.ToString(); Wishlists.Text = WishlistCount.ToString(); var VisitorsCount = await api.GetOnlineCount(); var RegisteredCount = await api.GetRegisteredCustomersCount(); var VendorsCount = await api.GetVendorsCount(); Visitors.Text = VisitorsCount.ToString(); Registered.Text = RegisteredCount.ToString(); Vendors.Text = VendorsCount.ToString(); var NPopWords = settings.GetValueOrDefault <int>(KeywordsInDash, 3); var PopularWords = await api.GetPopularKeywords(NPopWords); WordsHolder.Children.Clear(); foreach (KeywordDTO word in PopularWords) { var Sp = new StackPanel(); var WordBlock = new TextBlock(); WordBlock.Text = word.Keyword; WordBlock.FontSize = 20; Sp.Background = new SolidColorBrush(Colors.Gray); WordBlock.Margin = new System.Windows.Thickness { Left = 5, Right = 5 }; Sp.HorizontalAlignment = System.Windows.HorizontalAlignment.Center; Sp.VerticalAlignment = System.Windows.VerticalAlignment.Center; Sp.Margin = new System.Windows.Thickness { Left = 5 }; Sp.Children.Add(WordBlock); WordsHolder.Children.Add(Sp); } var BestAmount = await api.GetBestsellerByAmount(); BestsellerAmount.Text = BestAmount.First().Product.Name; var BestQuantity = await api.GetBestsellerByQuantity(); BestsellerQuantity.Text = BestQuantity.First().Product.Name; var WeekCustomers = await api.GetCustomerCountByTime(7); var TwoWeeksCustomers = await api.GetCustomerCountByTime(14); var MonthCustomers = await api.GetCustomerCountByTime(30); var YearCustomers = await api.GetCustomerCountByTime(365); var registered = new int[4] { WeekCustomers, TwoWeeksCustomers, MonthCustomers, YearCustomers }; RegisteredUsersGraph Graph = new RegisteredUsersGraph(registered, true); RegisteredPlot.Model = Graph.MyModel; ChangeStore = false; }