async Task ExecuteTapFileShareCommandAsync(ASECloudFileShare fileShare)
        {
            if (fileShare == null)
            {
                return;
            }


            MessagingService.Current.Subscribe <MessageArgsDeleteFileShare>(MessageKeys.DeleteFileShare, async(m, argsDeleteFileShare) =>
            {
                Navigation.PopAsync();
                IProgressDialog deletingDialog = UserDialogs.Loading("Deleting FileShare");
                deletingDialog.Show();
                try
                {
                    var aseFileShare = FileShares.Where(fs => fs.FileShareName == argsDeleteFileShare.FileShareName &&
                                                        fs.StorageAccountName == argsDeleteFileShare.StorageAccountName).FirstOrDefault();
                    if (aseFileShare == null)
                    {
                        return;
                    }

                    await aseFileShare.BaseFileShare.DeleteAsync();

                    App.Logger.Track(AppEvent.DeleteFileShare.ToString());

                    FileShares.Remove(aseFileShare);
                    SortFileShares();
                    var realm = App.GetRealm();
                    await realm.WriteAsync(temprealm =>
                    {
                        temprealm.Remove(temprealm.All <RealmCloudFileShare>()
                                         .Where(fs => fs.FileShareName == argsDeleteFileShare.FileShareName &&
                                                fs.StorageAccountName == argsDeleteFileShare.StorageAccountName).First());
                    });
                }
                catch (Exception ex)
                {
                    Logger.Report(ex, "Method", "HandleMessageArgsDeleteFileShare");
                    MessagingService.Current.SendMessage(MessageKeys.Error, ex);
                }
                finally
                {
                    if (deletingDialog != null)
                    {
                        if (deletingDialog.IsShowing)
                        {
                            deletingDialog.Hide();
                        }
                        deletingDialog.Dispose();
                    }
                }
            });

            var filesPage = new FilesPage(fileShare);

            App.Logger.TrackPage(AppPage.Files.ToString());
            await NavigationService.PushAsync(Navigation, filesPage);
        }
        public MainWindow(
            ILogger <MainWindow> logger,
            SimulatorPage simulatorPage,
            TrainerPage trainerPage,
            FilesPage filesPage)
        {
            logger.LogError("This is for testing");

            InitializeComponent();

            Logger        = logger ?? throw new ArgumentNullException();
            MainContainer = Frm_mainContainer ?? throw new ArgumentNullException();
            SimulatorPage = simulatorPage ?? throw new ArgumentNullException();
            TrainerPage   = trainerPage ?? throw new ArgumentNullException();
            FilesPage     = filesPage ?? throw new ArgumentNullException();
        }
 public FilesPageViewModel()
 {
     _syncedFolderService       = new SyncedFoldersService();
     UploadItemCommand          = new DelegateCommand(async() => await UploadFilesAsync());
     RefreshCommand             = new DelegateCommand(async() => await WebDavNavigationService.ReloadAsync());
     AddToSyncCommand           = new DelegateCommand <object>(async parameter => await RegisterFolderForSync(parameter));
     DownloadCommand            = new DelegateCommand <DavItem>(async item => await DownloadFilesAsync(FilesPage.GetSelectedItems(item)));
     DeleteCommand              = new DelegateCommand <DavItem>(async item => await DeleteItems(FilesPage.GetSelectedItems(item)));
     SwitchSelectionModeCommand = new DelegateCommand(() => SelectionMode = SelectionMode == ListViewSelectionMode.Multiple ? ListViewSelectionMode.Single : ListViewSelectionMode.Multiple);
     ShowPropertiesCommand      = new DelegateCommand <DavItem>(async item => await NavigationService.NavigateAsync(typeof(DetailsPage), item, new SuppressNavigationTransitionInfo()));
     AddFolderCommand           = new DelegateCommand(async() => await CreateFolderAsync());
     HomeCommand = new DelegateCommand(async() => await WebDavNavigationService.NavigateAsync(new DavItem {
         EntityId = Configuration.ServerUrl
     }));
     MoveCommand   = new DelegateCommand <DavItem>(async item => await NavigationService.NavigateAsync(typeof(SelectFolderPage), FilesPage.GetSelectedItems(item), new SuppressNavigationTransitionInfo()));
     RenameCommand = new DelegateCommand <DavItem>(async item => await Rename(item));
     OpenCommand   = new DelegateCommand <DavItem>(async item => await OpenFileAsync(item));
 }