Exemple #1
0
        private async void ShareOnClick(object sender, RoutedEventArgs routedEventArgs)
        {
            if (listView1.SelectedItems.Count <= 0)
            {
                ContentDialog noWifiDialog = new ContentDialog
                {
                    Title           = "Error",
                    Content         = "Please select file.",
                    CloseButtonText = "Ok"
                };
                ContentDialogResult result = await noWifiDialog.ShowAsync();
            }
            else
            {
                string text = await DesignUtil.InputTextDialogAsync("Email:");

                string text2 = "  ";

                if (String.IsNullOrEmpty(text) == true || String.IsNullOrEmpty(text2) == true)
                {
                    await new MessageDialog("Email or folder text is empty!", "Error").ShowAsync();
                }
                else
                {
                    try
                    {
                        File f        = (File)listView1.SelectedItems[0];
                        var  basePath = f.FilePath.Split(App.sub).First();
                        text2 = await DesignUtil.InputTextDialogAsync("Folder Name:",
                                                                      basePath + App.sub + "\\Shared\\");

                        string       destPath = App.sub + "\\Shared\\" + text2;
                        SettingsPage sp       = new SettingsPage();
                        await sp.sendEmailAsync(
                            App.given_name + " is sharing with you: " + basePath + App.sub + "\\Shared\\" + text2,
                            text);

                        FileUtil.CreateFolder(destPath);
                        FileUtil.ShareFiles(f.FilePath, destPath);
                    }
                    catch
                    {
                        // ignored
                    }
                }
            }
        }
Exemple #2
0
 private async void DeleteOnClick(object sender, RoutedEventArgs routedEventArgs)
 {
     if (listView1.SelectedItems.Count > 0)
     {
         File f = (File)listView1.SelectedItems[0];
         FileUtil.DeleteFile(f.FilePath);
         InitListAsync(currentPath);
     }
     else
     {
         ContentDialog noWifiDialog = new ContentDialog
         {
             Title           = "Error",
             Content         = "Please select file.",
             CloseButtonText = "Ok"
         };
         ContentDialogResult result = await noWifiDialog.ShowAsync();
     }
 }
Exemple #3
0
        private async void MetadataOnClick(object sender, RoutedEventArgs routedEventArgs)
        {
            string path = "";

            if (listView1.SelectedItems.Count > 0)
            {
                File f = (File)listView1.SelectedItems[0];
                path = f.FilePath;
            }
            else
            {
                ContentDialog noWifiDialog = new ContentDialog
                {
                    Title           = "Error",
                    Content         = "Please select file.",
                    CloseButtonText = "Ok"
                };
                ContentDialogResult result = await noWifiDialog.ShowAsync();
            }

            ImageInfo info = await FileUtil.GetImageInfo(path);

            ContentDialog informationalDialog = new ContentDialog
            {
                Title           = "Information",
                CloseButtonText = "Ok"
            };

            if (info == null)
            {
                informationalDialog.Content = "There is no information found.";
            }
            else
            {
                informationalDialog.Content = info.Message + "\n" + info.Location;
            }


            await informationalDialog.ShowAsync();
        }
Exemple #4
0
        private async void InitListAsync(string folder)
        {
            try
            {
                listView1.Items.Clear();
                files.Clear();
                PathDisplay.Text = currentPath;

                var paths = await FileUtil.GetFileList(folder);

                foreach (var p in paths)
                {
                    var    fileName      = p.Split(folder + "\\")[1];
                    string fileExtention = "";
                    if (fileName.Contains('.'))
                    {
                        fileExtention = fileName.Split('.')[1];
                    }

                    File f = new File
                    {
                        Content     = "",
                        Coordinates = "",
                        FileName    = fileName,
                        TypeImage   = DesignUtil.SelectExtentionImage(fileExtention),
                        FilePath    = p,
                        FileType    = DesignUtil.SetFileType(fileExtention)
                    };
                    files.Add(f);
                    listView1.Items.Add(f);
                }
            }

            catch
            {
                // ignored
            }
        }