async void OnListViewItemSelected(object sender, SelectedItemChangedEventArgs e) { fileName = e.SelectedItem.ToString(); var imageData = await AzureStorage.GetFileAsync(ContainerType.Image, fileName); editor.Source = ImageSource.FromStream(() => new MemoryStream(imageData)); //deleteButton.IsEnabled = true; }
async void OnGetFileListButtonClicked(object sender, EventArgs e) { var fileList = await AzureStorage.GetFilesListAsync(ContainerType.Text); listView.ItemsSource = fileList; // editor.Text = string.Empty; deleteButton.IsEnabled = false; }
public TextFileBrowserPageCS() { var getFilesButton = new Button { Text = "Get Text File List" }; getFilesButton.Clicked += OnGetFileListButtonClicked; listView = new ListView(); listView.ItemSelected += async(sender, e) => { fileName = e.SelectedItem.ToString(); var imageData = await AzureStorage.GetFileAsync(ContainerType.Image, fileName); editor.Source = ImageSource.FromStream(() => new MemoryStream(imageData)); deleteButton.IsEnabled = true; }; deleteButton = new Button { Text = "Delete", IsEnabled = false }; deleteButton.Clicked += async(sender, e) => { if (!string.IsNullOrWhiteSpace(fileName)) { bool isDeleted = await AzureStorage.DeleteFileAsync(ContainerType.Text, fileName); if (isDeleted) { OnGetFileListButtonClicked(sender, e); } } }; Title = "Text File Browser"; Icon = "csharp.png"; Content = new StackLayout { Margin = new Thickness(20), Children = { new Label { Text = "Text File Browser", FontAttributes = FontAttributes.Bold, HorizontalOptions = LayoutOptions.Center }, getFilesButton, listView, new Label { Text = "Text file contents:" }, editor, deleteButton } }; }
async void OnListViewItemSelected(object sender, SelectedItemChangedEventArgs e) { fileName = e.SelectedItem.ToString(); var byteData = await AzureStorage.GetFileAsync(ContainerType.Text, fileName); var text = Encoding.UTF8.GetString(byteData); editor.Text = text; deleteButton.IsEnabled = true; }
async void OnUploadImageButtonClicked(object sender, EventArgs e) { activityIndicator.IsRunning = true; uploadedFilename = await AzureStorage.UploadFileAsync(ContainerType.Image, new MemoryStream(byteData)); uploadButton.IsEnabled = false; downloadButton.IsEnabled = true; activityIndicator.IsRunning = false; }
private async Task <bool> SignIn() { var account = new Account { Username = Username, Password = Password }; //return await AccountService.Instance.Login(account); return(await AzureStorage.verificaUtente(Username, Password)); }
async void Handle_SelectedIndexChanged(object sender, System.EventArgs e) { if (pickerList.SelectedIndex > -1) { DialogService.ShowLoading(Strings.Loading); fileName = pickerList.Items[pickerList.SelectedIndex]; var imageData = await AzureStorage.GetFileAsync(ContainerType.Image, fileName); editor.Source = ImageSource.FromStream(() => new MemoryStream(imageData)); DialogService.HideLoading(); } }
async void OnDeleteButtonClicked(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(fileName)) { bool isDeleted = await AzureStorage.DeleteFileAsync(ContainerType.Image, fileName); if (isDeleted) { OnGetFileListButtonClicked(sender, e); } } }
async void OnDownloadImageButtonClicked(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(uploadedFilename)) { activityIndicator.IsRunning = true; var imageData = await AzureStorage.GetFileAsync(ContainerType.Image, uploadedFilename); downloadedImage.Source = ImageSource.FromStream(() => new MemoryStream(imageData)); activityIndicator.IsRunning = false; } }
async void caricaLista() { DialogService.ShowLoading(Strings.Loading); pickerList.Items.Clear(); var fileList = await AzureStorage.GetFilesListAsync(ContainerType.Image); foreach (var items in fileList) { pickerList.Items.Add(items); } editor.Source = ""; DialogService.HideLoading(); }
async void OnUploadButtonClicked(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(uploadEditor.Text)) { activityIndicator.IsRunning = true; var byteData = Encoding.UTF8.GetBytes(uploadEditor.Text); uploadedFilename = await AzureStorage.UploadFileAsync(ContainerType.Text, new MemoryStream(byteData)); downloadButton.IsEnabled = true; activityIndicator.IsRunning = false; } }
async void OnDownloadButtonClicked(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(uploadedFilename)) { activityIndicator.IsRunning = true; var byteData = await AzureStorage.GetFileAsync(ContainerType.Text, uploadedFilename); var text = Encoding.UTF8.GetString(byteData); downloadEditor.Text = text; activityIndicator.IsRunning = false; } }
void AggiornaFileUtenti() { var stringaUtenti = ""; foreach (var items in pickerUser.Items) { var utente = items.Split(' '); stringaUtenti += utente[1] + ";" + utente[3] + ";" + utente[5] + "§"; } if (stringaUtenti != "") { var completato = AzureStorage.aggiornaFileUtenti(stringaUtenti); } getUtenti(); }
async void OnUploadImageButtonClicked(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(nomeFile.Text)) { DialogService.ShowLoading(Strings.AddImage); uploadedFilename = await AzureStorage.UploadFileAsync(ContainerType.Image, new MemoryStream(byteData), nomeFile.Text); uploadButton.IsEnabled = false; DialogService.HideLoading(); DialogService.ShowSuccess(Strings.MomentSent); } else { DialogService.ShowError(Strings.ErroreUploadImmagineNoText); } }
private async void getUtenti() { DialogService.ShowLoading(Strings.Loading); var test = await AzureStorage.getUtenti(); pickerUser.Items.Clear(); var fileList = test.Split('§'); foreach (var items in fileList) { var user = items.Split(';'); if (user.Length > 1) { pickerUser.Items.Add("username: "******" password: "******" admin: " + user[2] + " "); } } //editUtenti.Text = test.ToString(); DialogService.HideLoading(); }
public ImageFileUploaderPageCS() { var imageToUpload = new Image(); var downloadedImage = new Image(); var activityIndicator = new ActivityIndicator(); var downloadButton = new Button { Text = "Download Image", IsEnabled = false }; downloadButton.Clicked += async(sender, e) => { if (!string.IsNullOrWhiteSpace(uploadedFilename)) { activityIndicator.IsRunning = true; var imageData = await AzureStorage.GetFileAsync(ContainerType.Image, uploadedFilename); downloadedImage.Source = ImageSource.FromStream(() => new MemoryStream(imageData)); activityIndicator.IsRunning = false; } }; var uploadButton = new Button { Text = "Upload Image" }; uploadButton.Clicked += async(sender, e) => { activityIndicator.IsRunning = true; uploadedFilename = await AzureStorage.UploadFileAsync(ContainerType.Image, new MemoryStream(byteData)); uploadButton.IsEnabled = false; downloadButton.IsEnabled = true; activityIndicator.IsRunning = false; }; #if __IOS__ byteData = Convert.ToByteArray("FileUploader.iOS.waterfront.jpg"); #endif #if __ANDROID__ byteData = Convert.ToByteArray("FileUploader.Droid.waterfront.jpg"); #endif #if WINDOWS_UWP byteData = Convert.ToByteArray("FileUploader.UWP.waterfront.jpg"); #endif imageToUpload.Source = ImageSource.FromStream(() => new MemoryStream(byteData)); Title = "Upload Image"; Icon = "csharp.png"; Content = new ScrollView { Content = new StackLayout { Margin = new Thickness(20), Children = { new Label { Text = "Image Upload and Download", FontAttributes = FontAttributes.Bold, HorizontalOptions = LayoutOptions.Center }, imageToUpload, uploadButton, activityIndicator, downloadButton, downloadedImage } } }; }
public TextFileUploaderPageCS() { var uploadEditor = new Editor { HeightRequest = 100 }; var downloadEditor = new Editor { HeightRequest = 100, IsEnabled = false }; var activityIndicator = new ActivityIndicator(); var downloadButton = new Button { Text = "Download", IsEnabled = false }; downloadButton.Clicked += async(sender, e) => { if (!string.IsNullOrWhiteSpace(uploadedFilename)) { activityIndicator.IsRunning = true; var byteData = await AzureStorage.GetFileAsync(ContainerType.Text, uploadedFilename); var text = Encoding.UTF8.GetString(byteData); downloadEditor.Text = text; activityIndicator.IsRunning = false; } }; var uploadButton = new Button { Text = "Upload" }; uploadButton.Clicked += async(sender, e) => { if (!string.IsNullOrWhiteSpace(uploadEditor.Text)) { activityIndicator.IsRunning = true; var byteData = Encoding.UTF8.GetBytes(uploadEditor.Text); uploadedFilename = await AzureStorage.UploadFileAsync(ContainerType.Text, new MemoryStream(byteData), ""); downloadButton.IsEnabled = true; activityIndicator.IsRunning = false; } }; Title = "Upload Text"; Icon = "csharp.png"; Content = new StackLayout { Margin = new Thickness(20), Children = { new Label { Text = "Text Upload and Download", FontAttributes = FontAttributes.Bold, HorizontalOptions = LayoutOptions.Center }, new Label { Text = "Enter text:" }, uploadEditor, uploadButton, activityIndicator, downloadButton, downloadEditor } }; }