Example #1
0
        /// The methods provided in this section are simply used to allow
        /// NavigationHelper to respond to the page's navigation methods.
        ///
        /// Page specific logic should be placed in event handlers for the
        /// <see cref="Common.NavigationHelper.LoadState"/>
        /// and <see cref="Common.NavigationHelper.SaveState"/>.
        /// The navigation parameter is available in the LoadState method
        /// in addition to page state preserved during an earlier session.

        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            files file = e.Parameter as files;

            pageTitle.Text  = file.getFilename();
            enableComponent = false;
            image.Source    = await users.downloadImage(file.getFilename(), file.getHost());

            enableComponent = true;
            navigationHelper.OnNavigatedTo(e);
        }
Example #2
0
        public static async Task <bool> deleteFile(files file, linking link, accessKeys key)
        {
            try
            {
                CloudStorageAccount storageAccount = CloudStorageAccount.Parse(connection.getConnectionString());
                CloudBlobClient     blobClient     = storageAccount.CreateCloudBlobClient();
                CloudBlobContainer  container      = blobClient.GetContainerReference(helper.getUsername());
                await container.CreateIfNotExistsAsync();

                CloudBlockBlob blockBlob = container.GetBlockBlobReference(file.getFilename());
                await blockBlob.DeleteIfExistsAsync();

                files temp = await fetchFile(helper.getUsername(), file.getFilename());

                if (temp != null)
                {
                    await updateFileCount(Convert.ToDouble(temp.size), 1);
                    await deleteFileOnline(temp);

                    await helper.deleteFileDataLocal(temp.getFilename());

                    if (link != null)
                    {
                        await removerLink(link);
                    }
                    if (key != null)
                    {
                        await deleteKey(key);
                    }
                }

                return(true);
            }
            catch { }
            return(false);
        }