Ejemplo n.º 1
0
        public FilesPage(ASECloudFileShare fileShare)
        {
            InitializeComponent();
            BindingContext = new FilesViewModel(Navigation, UserDialogs.Instance, fileShare);

            Title = fileShare.FileShareName;
            ViewModel.LoadFilesCommand.Execute(false);

            if (Device.RuntimePlatform == Device.Android)
            {
                ToolbarItems.Add(new ToolbarItem
                {
                    Order   = ToolbarItemOrder.Secondary,
                    Text    = "Add File",
                    Command = vm.AddFileCommand
                });
                ToolbarItems.Add(new ToolbarItem
                {
                    Order   = ToolbarItemOrder.Secondary,
                    Text    = "Delete File Share",
                    Command = vm.DeleteFileShareCommand
                });
            }
            else if (Device.RuntimePlatform == Device.iOS)
            {
                ToolbarItems.Add(new ToolbarItem
                {
                    Text    = "More",
                    Icon    = "toolbar_overflow.png",
                    Command = new Command(async() =>
                    {
                        string[] items = new[] { "Add File", "Delete File Share" };

                        var action = await DisplayActionSheet("Options", "Cancel", null, items);
                        if (action == items[0])
                        {
                            vm.AddFileCommand.Execute(null);
                        }
                        else if (action == items[1])
                        {
                            vm.DeleteFileShareCommand.Execute(null);
                        }
                    })
                });
            }

            lvFiles.ItemSelected += (sender, e) =>
            {
                lvFiles.SelectedItem = null;
            };
        }
Ejemplo n.º 2
0
 public FilesViewModel(INavigation navigation, IUserDialogs userDialogs, ASECloudFileShare fileShare) : base(navigation, userDialogs)
 {
     FileShare           = fileShare;
     NoFilesFoundMessage = "No Files Found";
 }