void Init(Statuses statuses) { InitializeComponent(); Xamarin.Forms.PlatformConfiguration.iOSSpecific.Page.SetUseSafeArea(this, true); this.statuses = statuses; BindingContext = new StatusesViewModel(); if (statuses.Id > 0) { Title = "Edit Flash"; } else { Title = "Post Flash"; } var cancel = new ToolbarItem { Text = "Save", Command = new Command(async() => { await ExecuteStatusesEditAsync(); }) }; ToolbarItems.Add(cancel); if (Device.Android == Device.RuntimePlatform) { cancel.Icon = "menu_send.png"; } this.editorContent.Text = statuses.Content; }
void Init(Statuses statuses) { this.statuses = statuses; InitializeComponent(); BindingContext = new StatusesViewModel(); if (statuses.Id > 0) { Title = "编辑闪存"; } else { Title = "发布闪存"; } var cancel = new ToolbarItem { Text = "保存", Command = new Command(async() => { await ExecuteStatusesEditAsync(); }) }; ToolbarItems.Add(cancel); if (Device.Android == Device.RuntimePlatform) { cancel.Icon = "menu_send.png"; } this.editorContent.Text = statuses.Content; }
public IActionResult AdminPanel() { var totalUsersCount = this.userServices.GetAllUsers().Count(); var adminsCount = this.adminServices.GetAllAdmins().Count(); var bannedCount = this.adminServices.GetAllBannedUsers().Count(); var ordinaryCount = this.adminServices.GetAllOrinaryUsers().Count(); var usersStatus = new UserStatusViewModel() { Count = totalUsersCount, AdminsCount = adminsCount, BannedCount = bannedCount, OrdinaryCount = ordinaryCount }; var carsCount = this.carServices.GetAllCars().Count(); var carsStatus = new CarStatusViewModel() { Count = carsCount, InPrcessCount = carsCount, ReadyCount = 0, // TODO WaitingCount = 0 // TODO }; var statusesViewModel = new StatusesViewModel() { UsersStatus = usersStatus, CarsStatus = carsStatus }; return(this.View(statusesViewModel)); }
public StatusesPage(int position = 0) : base() { InitializeComponent(); Xamarin.Forms.PlatformConfiguration.iOSSpecific.Page.SetUseSafeArea(this, true); BindingContext = new StatusesViewModel(position); var cancel = new ToolbarItem { Text = "添加", Command = new Command(async() => { if (UserTokenSettings.Current.HasExpiresIn()) { MessagingService.Current.SendMessage(MessageKeys.NavigateLogin); } else { await NavigationService.PushAsync(Navigation, new StatusesEditPage(new Statuses(), new Action <Statuses>(OnResult))); } }) }; ToolbarItems.Add(cancel); if (Device.Android == Device.RuntimePlatform) { cancel.Icon = "toolbar_add.png"; } this.StatusesListView.ItemSelected += async delegate { var statuses = StatusesListView.SelectedItem as Statuses; if (statuses == null) { return; } var statusesDetails = new StatusesDetailsPage(statuses); if (statuses.Id > 0) { await NavigationService.PushAsync(Navigation, statusesDetails); } this.StatusesListView.SelectedItem = null; }; ViewModel.GetClientStatusesAsync(); }
protected override void OnAppearing() { base.OnAppearing(); if (!hasInitialization) { BindingContext = new StatusesViewModel(position); var cancel = new ToolbarItem { Text = "添加", Command = new Command(async() => { if (UserTokenSettings.Current.HasExpiresIn()) { MessagingService.Current.SendMessage(MessageKeys.NavigateLogin); } else { await NavigationService.PushAsync(Navigation, new StatusesEditPage(new Statuses(), new Action <Statuses>(OnResult))); } }), Icon = "toolbar_add.png" }; ToolbarItems.Add(cancel); this.StatusesListView.HasFloatingView = true; this.StatusesListView.ItemSelected += async delegate { var statuses = StatusesListView.SelectedItem as Statuses; this.StatusesListView.SelectedItem = null; if (statuses == null) { return; } var statusesDetails = new StatusesDetailsPage(statuses); if (statuses.Id > 0) { await NavigationService.PushAsync(Navigation, statusesDetails); } }; var floatingView = new FloatingView(); this.StatusesListView.FloatingChanged += delegate(object sender, bool floating) { if (Device.RuntimePlatform == Device.Android) { if (floating) { floatingView.ToggleFloatingView = true; } else { floatingView.ToggleFloatingView = false; } } }; if (Device.RuntimePlatform == Device.Android) { floatingView.Image = "toolbar_add.png"; floatingView.ButtonColor = Color.FromHex("#E64A19"); AbsoluteLayout.SetLayoutBounds(floatingView, new Rectangle(1, .9, 80, 90)); AbsoluteLayout.SetLayoutFlags(floatingView, AbsoluteLayoutFlags.PositionProportional); floatingView.Clicked += async delegate(object sender, EventArgs e) { if (UserTokenSettings.Current.HasExpiresIn()) { MessagingService.Current.SendMessage(MessageKeys.NavigateLogin); } else { await NavigationService.PushAsync(this.Navigation, new StatusesEditPage(new Statuses())); } }; this.AbsoluteLayout.Children.Add(floatingView); } ViewModel.GetClientStatusesAsync(); hasInitialization = true; } UpdatePage(); }
public StatusesPage() { InitializeComponent(); BindingContext = _viewModel = new StatusesViewModel(); }