示例#1
0
        private void openProc(string path = null)
        {
            WindowState = WindowState.Minimized;
            //TEMP
            NTFSRead.createDBPreferences();


            if (path == null)
            {
                _ResultList item = (_ResultList)resultsList.SelectedItem;
                path = item.pathf.ToString();
            }
            NTFSRead.insertProcess(path);
            try
            {
                ProcessStartInfo pInfo = new ProcessStartInfo(path);
                Process.Start(pInfo);
            }
            catch (Win32Exception ex)
            {
                if (ex.ErrorCode == -2147467259)
                //ErrorCode for No application is associated with the specified file for
                //this operation
                {
                    Process.Start("rundll32.exe", string.Format(" shell32.dll,OpenAs_RunDLL \"{0}\"", path));
                }
            }
        }
示例#2
0
        private void itemSelected(object sender, SelectionChangedEventArgs e)
        {
            //  Debug.Write(resultsList.SelectedIndex);


            item = (_ResultList)resultsList.SelectedItem;

            string[] stringArray = { ".pdf", ".txt", ".jpg", ".png", ".html", ".php", ".xml" };
            string[] audioArray  = { ".mp3", ".ogg", ".wav" };
            string[] videoArray  = { ".mp4", ".avi", ".wmv" };

            try
            {
                Debug.Write("Index: " + resultsList.SelectedIndex.ToString() + " index2:" + item.FileName + "\n");


                SharedVar.extension = Path.GetExtension(item.Title);
                filetype            = item.type;

                if (stringArray.Any(SharedVar.extension.Contains) || filetype == "folder")
                {
                    //if is a supported extension or folder
                    SharedVar.typeView = "v1";
                    changeDesign("withResultKnownSelected");
                    browseContent.Source = new Uri("Templates/BrowserView.xaml", UriKind.Relative);
                }
                else if (videoArray.Any(SharedVar.extension.Contains))//(Array.IndexOf(videoArray, SharedVar.extension) > 0) //
                {
                    changeDesign("withResultKnownSelected");
                    SharedVar.typeView   = "v3";
                    browseContent.Source = new Uri("Templates/VPlayerView.xaml", UriKind.Relative);
                }
                else if (audioArray.Any(SharedVar.extension.Contains))//(Array.IndexOf(audioArray, SharedVar.extension) > 0)
                {
                    changeDesign("withResultKnownSelected");
                    SharedVar.typeView   = "v4";
                    browseContent.Source = new Uri("Templates/SPlayerView.xaml", UriKind.Relative);
                }
                else if (Array.IndexOf(stringArray, SharedVar.extension) == -1)
                {
                    changeDesign("withResultUnknownSelected");

                    SharedVar.typeView   = "v2";
                    browseContent.Source = new Uri("Templates/GenericView.xaml", UriKind.Relative);
                }
                else
                {
                    SharedVar.typeView = "v5";
                    changeDesign("outSelected");
                }
            }
            catch
            {
                //
            }
        }
示例#3
0
        private void openFolder()
        {
            _ResultList item = (_ResultList)resultsList.SelectedItem;

            try
            {
                ProcessStartInfo pInfo = new ProcessStartInfo(item.pathf.Replace(item.FileName, ""));
                Process.Start(pInfo);
            }
            catch (Win32Exception ex)
            {
                if (ex.ErrorCode == -2147467259)
                //ErrorCode for No application is associated with the specified file for
                //this operation
                {
                    Process.Start("rundll32.exe", string.Format(" shell32.dll,OpenAs_RunDLL \"{0}\"", item.pathf.Replace(item.FileName, "")));
                }
            }
        }
示例#4
0
        private void search_PreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
        {
            try
            {
                if (e.Key == Key.Enter)
                {
                    var listBoxIteme =
                        resultsList.ItemsSource.GetEnumerator();
                    listBoxIteme.MoveNext();
                    _ResultList listBoxItem = (_ResultList)listBoxIteme.Current;


                    openProc(listBoxItem.pathf.ToString());
                    //                   listBoxItem.Focus();
                }
                else if (e.Key == Key.Down)
                {
                    resultsList.Focus();



                    var listBoxItem =
                        (ListBoxItem)resultsList
                        .ItemContainerGenerator
                        .ContainerFromItem(resultsList.SelectedItem);

                    listBoxItem.Focus();
                }
                else if (e.Key == Key.Tab)
                {
                    search.Text = SharedVar.autoItem;
                }
            }
            catch {
            }
        }