コード例 #1
0
        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;
        }
コード例 #2
0
        async void OnGetFileListButtonClicked(object sender, EventArgs e)
        {
            var fileList = await AzureStorage.GetFilesListAsync(ContainerType.Text);

            listView.ItemsSource = fileList;
            //	editor.Text = string.Empty;
            deleteButton.IsEnabled = false;
        }
コード例 #3
0
        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
                }
            };
        }
コード例 #4
0
        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;
        }
コード例 #5
0
        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;
        }
コード例 #6
0
        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));
        }
コード例 #7
0
        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();
            }
        }
コード例 #8
0
        async void OnDeleteButtonClicked(object sender, EventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(fileName))
            {
                bool isDeleted = await AzureStorage.DeleteFileAsync(ContainerType.Image, fileName);

                if (isDeleted)
                {
                    OnGetFileListButtonClicked(sender, e);
                }
            }
        }
コード例 #9
0
        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;
            }
        }
コード例 #10
0
        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();
        }
コード例 #11
0
        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;
            }
        }
コード例 #12
0
        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;
            }
        }
コード例 #13
0
        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();
        }
コード例 #14
0
        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);
            }
        }
コード例 #15
0
        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();
        }
コード例 #16
0
        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
                    }
                }
            };
        }
コード例 #17
0
        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
                }
            };
        }