public DetalhesDoPerfil_Page (GerenciarPerfisViewModel viewModel) { BindingContext = viewModel; gerenciarPerfis = (GerenciarPerfisViewModel)BindingContext; ToolbarItems.Add (toolbarSave); toolbarSave.Command = new Command (ToolbarCommand); entryName.SetBinding (Entry.TextProperty, "Name", BindingMode.TwoWay); expirationDatePicker.SetBinding (DatePicker.DateProperty, "ExpireDate", BindingMode.TwoWay); switchAutomovel.SetBinding (SwitchCell.OnProperty, "IsAutoMovel", BindingMode.TwoWay); switchPedestre.SetBinding (SwitchCell.OnProperty, "IsPedestre", BindingMode.TwoWay); var configTable = new TableView { Intent = TableIntent.Settings, BackgroundColor = Color.Default, Root = new TableRoot { new TableSection ("Nome") { new ViewCell { View = entryName } }, new TableSection ("Data de validade") { new ViewCell{ View = expirationDatePicker } }, new TableSection ("Tipo de portao acessivel") { switchAutomovel, switchPedestre }, new TableSection () { hoursCell } } }; var stack = new StackLayout { Padding = new Thickness (0, 0, 0, 0), Spacing = 0, Children = { configTable } }; var absoluteLayout = new AbsoluteLayout (); var background = new Image { Style = Styles.BackgroundImage }; absoluteLayout.Children.Add (background, new Rectangle (0, 0, 1, 1), AbsoluteLayoutFlags.All); absoluteLayout.Children.Add (stack, new Rectangle (0, 0, 1, 1), AbsoluteLayoutFlags.All); Content = absoluteLayout; hoursCell.Tapped += HoursCell_Tapped; }
// Button saveButton = new Button { Text = "Salvar", Style = Styles.GrayButtons, VerticalOptions = LayoutOptions.End, HorizontalOptions = LayoutOptions.FillAndExpand }; // ToolbarItem toolbarSave = new ToolbarItem { Text = "Salvar" }; public HorariosAssociados_Page (GerenciarPerfisViewModel viewModel) { BindingContext = viewModel; BackgroundColor = Colors.BackgroundDefault; gerenciarPerfis = (GerenciarPerfisViewModel)BindingContext; listHorariosDisponiveis.ItemTemplate = new DataTemplate (typeof(HorariosDisponiveisCell)); listHorariosAdicionados.ItemTemplate = new DataTemplate (typeof(HorariosDisponiveisCell)); listHorariosAdicionados.ItemsSource = viewModel.listHorariosAdicionados; listHorariosDisponiveis.ItemsSource = viewModel.listHorariosDisponiveis; viewModel.listHorariosAdicionados.OrderBy (or => or.IsSelected).OrderBy (order => order.IsSelected); viewModel.listHorariosDisponiveis.OrderBy (or => or.IsSelected).OrderBy (order => order.IsSelected); //listHorariosAdicionados.ItemTapped += listHorariosAdicionados_ItemTapped; listHorariosDisponiveis.ItemTapped += listHorariosDisponiveis_ItemTapped; if (gerenciarPerfis.AccessProfileEdit != new Repository<AccessProfiles> ().GetAllAsync ().Result.FirstOrDefault (any => any.UserId == Settings.user_Id)) Content = listHorariosDisponiveis; else Content = listHorariosAdicionados; }
public GerenciarPerfisView(GerenciarPerfisViewModel viewModel) { Title = "Perfis"; BindingContext = viewModel; listPerfis.ItemTemplate = new DataTemplate(typeof(ProfileCell)); listPerfis.ItemsSource = viewModel.ListProfiles; listPerfis.ItemSelected += async (sender, args) => { AccessProfiles perfil = (AccessProfiles)args.SelectedItem; if (perfil.IsEditable) { var action = await DisplayActionSheet(null, "Editar", null, "Remover", null, "Cancelar"); if (action == "Remover") { await ((GerenciarPerfisViewModel)BindingContext).Remove(perfil); OnAppearing(); } else if (action == "Editar") { await Navigation.PushAsync( new DetalhesDoPerfil_Page(new GerenciarPerfisViewModel(this.Navigation, perfil))); } } else await DisplayAlert("MySafety", "Perfil não pode ser editado.", "OK"); }; FloatButton.AnimateWithAction(); FloatButton.Clicked += FloatButton_Clicked; var stack = new StackLayout { Padding = new Thickness(0, 20, 0, 0), Spacing = 30, Orientation = StackOrientation.Vertical, VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Color.FromHex("#ECEFF1"), Children = { listPerfis } }; var absoluteLayout = new AbsoluteLayout { VerticalOptions = LayoutOptions.FillAndExpand, }; //var background = new Image { Source = Images.Background, Aspect = Aspect.Fill }; //absoluteLayout.Children.Add (background, new Rectangle (0, 0, 1, 1), AbsoluteLayoutFlags.All); //AbsoluteLayout.SetLayoutFlags(background, AbsoluteLayoutFlags.All); //AbsoluteLayout.SetLayoutBounds(background, new Rectangle(0, 0, 1, 1)); //absoluteLayout.Children.Add (stack, new Rectangle (0, 0, 1, 1), AbsoluteLayoutFlags.All); AbsoluteLayout.SetLayoutFlags(stack, AbsoluteLayoutFlags.All); AbsoluteLayout.SetLayoutBounds(stack, new Rectangle(0, 0, 1, 1)); //absoluteLayout.Children.Add (Add, new Rectangle (0.85, 0.85, 0.185, 0.1), AbsoluteLayoutFlags.All); AbsoluteLayout.SetLayoutFlags(FloatButton, AbsoluteLayoutFlags.PositionProportional); AbsoluteLayout.SetLayoutBounds(FloatButton, new Rectangle(0.99f, 0.98f, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize)); //absoluteLayout.Children.Add(background); absoluteLayout.Children.Add(stack); absoluteLayout.Children.Add(FloatButton); Content = absoluteLayout; }