Exemple #1
0
        private void ShowShellContextMenu(FileInfoWrapper item, FrameworkElement frameworkElement)
        {
            if (!SystemConfigFlagsWrapper.Instance().ShelContextMenu)
            {
                return;
            }

            var formsHost = (Control)ShellHostPopupWnd.FindName("ShellMenuHost");
            var pos       = new Point((int)ShellHostPopupWnd.HorizontalOffset, (int)ShellHostPopupWnd.VerticalOffset);

            var path     = item.Path;
            var fullName = item.FullName;

            var newItems = new List <ShellMenuItem>
            {
                new ShellMenuItem("Open Containing Folder in Explorer", 1,
                                  () => {
                    Process.Start(path);           // Opens the folder in Windows Explorer.
                }),
                new ShellMenuItem("Copy Path to Clipboard", 2, () => Clipboard.SetText(path)),
                new ShellMenuItem("Copy Full Path to Clipboard", 3, () => Clipboard.SetText(item.FullName)),
                new ShellMenuItem("Copy Filename to Clipboard", 4, () => Clipboard.SetText(item.Name)),
                new ShellMenuItem("Rename", 5, () => Rename(frameworkElement))
            };

            var replaceItems = new List <ShellMenuItem> // Replace actions of items if needed.
            {
                new ShellMenuItem("Open", 0, () => OpenFileDefault(item.FullName))
            };

            ShellHostPopupWnd.IsOpen = true;
            var shelMenuManager = new ShellMenuManager(formsHost, fullName, pos, newItems, replaceItems);

            shelMenuManager.Show();
        }
Exemple #2
0
        private void InitPart1()
        {
            dispatcher = Application.Current.Dispatcher;

            DateFrom = DateTime.Now.AddDays(-30);
            DateTo   = DateTime.Now;

            excludeHiddenAndSystem = false;
            UseRegex = false;

            if (SystemConfigFlagsWrapper.Instance().CallWatchChanges)
            {
                dispatcherTimer          = new DispatcherTimer();
                dispatcherTimer.Tick    += CheckUpdatesOnTimerTick;
                dispatcherTimer.Interval = new TimeSpan(0, 0, 5);
                dispatcherTimer.Start();
            }
        }
Exemple #3
0
        private void MainWindow_OnClosing(object sender, CancelEventArgs cancelEventArgs)
        {
            Log.Instance.Debug("MainWindow_OnClosing called.");

            UserSettings.Instance.Save(this);

            if (SystemConfigFlagsWrapper.Instance().PipeManager)
            {
                Visibility = Visibility.Collapsed;
                if (Equals(Application.Current.MainWindow, this))
                {
                    cancelEventArgs.Cancel = true;
                }
            }

            if (folderDialog != null)
            {
                folderDialog.Dispose();
            }
        }
Exemple #4
0
 private void ShowDebugLogWndCanExecute(object sender, CanExecuteRoutedEventArgs e)
 {
     e.CanExecute = debugLogWnd == null && SystemConfigFlagsWrapper.Instance().ShowDebugLogWindow;
 }
        private void App_Startup(object sender, StartupEventArgs e)
        {
            var exeDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            Directory.SetCurrentDirectory(exeDir);

            Log.Instance.Debug("App_Startup called. Starting application.");

            AppDomain.CurrentDomain.UnhandledException += AppDomainOnUnhandledException;
            CmdArgumentsParser.Init(e);

            try
            {
                // Ensure the current culture passed into bindings is the OS culture.
                // By default, WPF uses en-US as the culture, regardless of the system settings.
                FrameworkElement.LanguageProperty.OverrideMetadata(
                    typeof(FrameworkElement),
                    new FrameworkPropertyMetadata(
                        XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag)));
            }
            catch (Exception ex)
            {
                Log.Instance.Error("LanguageProperty.OverrideMetadata throw exception: " + ex.Message);
            }

            if (SystemConfigFlagsWrapper.Instance().PipeManager)
            {
                ShutdownMode = ShutdownMode.OnExplicitShutdown;
                CreateAndStartPipeManager(e);
            }
            else
            {
                ShutdownMode = ShutdownMode.OnMainWindowClose;
            }

            try
            {
                var startInfo = new System.Diagnostics.ProcessStartInfo("GUP.exe")
                {
                    WorkingDirectory = "updater"
                };

                System.Diagnostics.Process.Start(startInfo);
            }
            catch (Exception ex)
            {
                Log.Instance.Error("Checking for update failed: " + ex.Message);
            }

            if (AppAlreadyRuns)
            {
                return;
            }

            if (SystemConfigFlagsWrapper.Instance().TrayIcon)
            {
                TrayIconManager.CreateIcon();
            }

            if (SystemConfigFlagsWrapper.Instance().ShowDebugLogWindow)
            {
                var wnd = new DebugLogWindow();
                wnd.Show();
            }

            var visibility = Visibility.Visible;

            if (e.Args.Length > 0 && e.Args[0] == "-scheduled")
            {
                visibility = Visibility.Collapsed;
            }

            Helper.OpenNewIndexerWnd(visibility);
        }