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)); } } }
private void OnLoaded(object sender, RoutedEventArgs e) { // notifyIcon.Visible = true; search.Focusable = true; search.Focus(); //inizialize db only if not exist if (!File.Exists(SharedVar.dbpath)) { nread = new NTFSRead(); initDB(); } else if (!nread.checkDB(false)) { Debug.Write("Corrupted Database Found, starting rebuild."); nread.deleteDB(); initDB(); } else { onNormalStart(); SharedVar.isIndexing = false; changeDesign("endLoading"); } }
public MainWindow() { InitializeComponent(); //check if launced as admin waysearch nread = new NTFSRead(); nread.getPriv(); timerupdate = new SetTimer(); timerupdate.startTimer(30); mainw.Topmost = true; this.ShowInTaskbar = true; WindowState = WindowState.Normal; this.Left = (SystemParameters.PrimaryScreenWidth / 2) - mainw.Width / 2; this.Top = (SystemParameters.PrimaryScreenHeight / 4); //event handler browseContent.LoadCompleted += MainFrame_ContentRendered; resultsList.MouseDoubleClick += new System.Windows.Input.MouseButtonEventHandler(ListBoxItem_MouseDoubleClick); resultsList.MouseDown += new System.Windows.Input.MouseButtonEventHandler(ListBoxItem_MouseDown); resultsList.KeyDown += new System.Windows.Input.KeyEventHandler(ListBoxItem_KeyDown); resultsList.SelectionChanged += new SelectionChangedEventHandler(itemSelected); resultsList.MouseLeftButtonUp += new MouseButtonEventHandler(ListBoxItem_Selected); SourceChord.FluentWPF.SystemTheme.ThemeChanged += this.SystemTheme_ThemeChanged; search.PreviewKeyDown += search_PreviewKeyDown; this.Dispatcher.UnhandledException += OnDispatcherUnhandledException; Loaded += OnLoaded; StateChanged += OnStateChanged; // register the event that is fired after the key press. hook.KeyPressed += new EventHandler <KeyPressedEventArgs>(hook_KeyPressed); //DESIGN CHANGE changeDesign("small"); // register the controls hook.RegisterHotKey(ModifierKeys.Alt, Keys.Space); }