예제 #1
0
        //Open the selected file with the corresponding program
        private void Row_DoubleClick(object sender, MouseButtonEventArgs e)
        {
            if (e.ChangedButton == MouseButton.Left)
            {
                FileDetails  fl = FileList.SelectedItem as FileDetails;
                ImageDetails Il = FileList.SelectedItem as ImageDetails;
                WordDetails  Wl = FileList.SelectedItem as WordDetails;
                PDFdetails   Pl = FileList.SelectedItem as PDFdetails;
                VideoDetails Vl = FileList.SelectedItem as VideoDetails;
                AudioDetails Al = FileList.SelectedItem as AudioDetails;
                OtherDetails Ol = FileList.SelectedItem as OtherDetails;
                try
                {
                    if (fl != null)
                    {
                        System.Diagnostics.Process.Start(fl.path.ToString());
                    }
                    if (Il != null)
                    {
                        System.Diagnostics.Process.Start(Il.Path.ToString());
                    }

                    if (Wl != null)
                    {
                        System.Diagnostics.Process.Start(Wl.path.ToString());
                    }

                    if (Pl != null)
                    {
                        System.Diagnostics.Process.Start(Wl.path.ToString());
                    }
                    if (Vl != null)
                    {
                        System.Diagnostics.Process.Start(Vl.path.ToString());
                    }
                    if (Al != null)
                    {
                        System.Diagnostics.Process.Start(Al.path.ToString());
                    }
                    if (Ol != null)
                    {
                        System.Diagnostics.Process.Start(Ol.path.ToString());
                    }
                }
                catch (Exception ex)
                {
                    System.Windows.MessageBox.Show("Imposible d'ouvir le fichier" + ex.Message);
                }
            }
        }
예제 #2
0
        //Open the directory of the selected file
        private void Row_RightClick(object sender, RoutedEventArgs e)
        {
            FileDetails  fl = FileList.SelectedItem as FileDetails;
            ImageDetails Il = FileList.SelectedItem as ImageDetails;
            WordDetails  Wl = FileList.SelectedItem as WordDetails;
            PDFdetails   Pl = FileList.SelectedItem as PDFdetails;
            VideoDetails Vl = FileList.SelectedItem as VideoDetails;
            AudioDetails Al = FileList.SelectedItem as AudioDetails;
            OtherDetails Ol = FileList.SelectedItem as OtherDetails;


            if (fl != null)
            {
                var test = fl.folderPath;
                Process.Start("explorer.exe", fl.folderPath.ToString());
            }
            if (Il != null)
            {
                Process.Start("explorer.exe", Il.folderPath.ToString());
            }

            if (Wl != null)
            {
                Process.Start("explorer.exe", Wl.folderPath.ToString());
            }

            if (Pl != null)
            {
                Process.Start("explorer.exe", Pl.folderPath.ToString());
            }
            if (Vl != null)
            {
                Process.Start("explorer.exe", Vl.folderPath.ToString());
            }
            if (Al != null)
            {
                Process.Start("explorer.exe", Al.folderPath.ToString());
            }
            if (Ol != null)
            {
                Process.Start("explorer.exe", Ol.folderPath.ToString());
            }
        }
예제 #3
0
        //Creates the datalist model
        public void makeList()
        {
            listFile = RetrieveList.myList.ToList();

            if (RetrieveList.RadiobuttonKeep.Contains("Word"))
            {
                if (RetrieveList.mywordList != null)
                {
                    RetrieveList.mywordList.Clear();
                }
                wordFile.Clear();
                foreach (var list in listFile)
                {
                    if (list.filename.ToString().ToLower().Contains(".doc"))
                    {
                        WordDetails id = new WordDetails()
                        {
                            content    = GetWord(list.path.ToString()),
                            name       = list.filename,
                            path       = list.path,
                            folderPath = list.folderPath
                        };
                        wordFile.Add(id);
                    }
                }
                IEnumerable <WordDetails> sansDoublonWord = wordFile.Distinct();
                int num = wordFile.Count();
                CountElement(num);
                RetrieveList.mywordList = wordFile.ToObservableCollection();
            }

            if (RetrieveList.RadiobuttonKeep.Contains("PDF"))
            {
                if (RetrieveList.mypdfList != null)
                {
                    RetrieveList.mypdfList.Clear();
                }
                PDFFile.Clear();
                foreach (var list in listFile)
                {
                    if (list.filename.ToString().ToLower().Contains(".pdf"))
                    {
                        PDFdetails id = new PDFdetails()
                        {
                            content    = GetPDF(list.path.ToString()),
                            name       = list.filename,
                            path       = list.path,
                            folderPath = list.folderPath
                        };

                        PDFFile.Add(id);
                    }
                }
                IEnumerable <PDFdetails> sansDoublonPDF = PDFFile.Distinct();
                int num = sansDoublonPDF.Count();
                CountElement(num);
                RetrieveList.mypdfList = PDFFile.ToObservableCollection();
            }

            if (RetrieveList.RadiobuttonKeep.Contains("Images"))
            {
                if (RetrieveList.myimageList != null)
                {
                    RetrieveList.myimageList.Clear();
                }
                imageFile.Clear();
                foreach (var list in listFile)
                {
                    if (Extentions_Image.Any(list.filename.ToLower().Contains))
                    {
                        ImageDetails id = new ImageDetails()
                        {
                            FileName   = list.filename,
                            Path       = list.path,
                            folderPath = list.folderPath
                        };

                        imageFile.Add(id);
                    }
                }
                IEnumerable <ImageDetails> sansDoublonImage = imageFile.Distinct();
                int num = sansDoublonImage.Count();
                CountElement(num);
                RetrieveList.myimageList = imageFile.ToObservableCollection();
            }

            if (RetrieveList.RadiobuttonKeep.Contains("Audio"))
            {
                if (RetrieveList.myaudioList != null)
                {
                    RetrieveList.myaudioList.Clear();
                }

                audioFile.Clear();
                foreach (var list in listFile)
                {
                    if (Extentions_Audio.Any(list.filename.ToLower().Contains))
                    {
                        AudioDetails id = new AudioDetails()
                        {
                            FileName   = list.filename,
                            path       = list.path,
                            folderPath = list.folderPath
                        };

                        audioFile.Add(id);
                    }
                }
                IEnumerable <AudioDetails> sansDoublonAudio = audioFile.Distinct();
                int num = sansDoublonAudio.Count();
                CountElement(num);
                RetrieveList.myaudioList = audioFile.ToObservableCollection();
            }

            if (RetrieveList.RadiobuttonKeep.Contains("Vidéos"))
            {
                if (RetrieveList.myvideoList != null)
                {
                    RetrieveList.myvideoList.Clear();
                }
                videoFile.Clear();
                foreach (var list in listFile)
                {
                    if (Extentions_Video.Any(list.filename.ToString().ToLower().Contains))
                    {
                        VideoDetails id = new VideoDetails
                        {
                            FileName   = list.filename,
                            path       = list.path,
                            folderPath = list.folderPath
                        };

                        videoFile.Add(id);
                    }
                }
                IEnumerable <VideoDetails> sansDoublonVideo = videoFile.Distinct();
                int num = sansDoublonVideo.Count();
                CountElement(num);
                RetrieveList.myvideoList = videoFile.ToObservableCollection();
            }

            if (RetrieveList.RadiobuttonKeep.Contains("Autres"))
            {
                if (RetrieveList.myotherList != null)
                {
                    RetrieveList.myotherList.Clear();
                }
                otherFile.Clear();

                foreach (var list in listFile)
                {
                    if (!Extentions_All.Any(list.filename.ToString().ToLower().Contains))
                    {
                        OtherDetails id = new OtherDetails
                        {
                            FileName   = list.filename,
                            path       = list.path,
                            folderPath = list.folderPath
                        };

                        otherFile.Add(id);
                    }
                }
                IEnumerable <OtherDetails> sansDoublonOther = otherFile.Distinct();
                int num = sansDoublonOther.Count();
                CountElement(num);
                RetrieveList.myotherList = otherFile.ToObservableCollection();
            }
        }