예제 #1
0
        public static IEnumerator <object> AutoShowConfiguration(string[] argv)
        {
            bool    show = false;
            IFuture f;

            if (argv.Contains("--configure"))
            {
                show = true;
            }
            else
            {
                {
                    var iter = new TaskEnumerator <TagDatabase.Folder>(Database.GetFolders());
                    f = Scheduler.Start(iter.GetArray());
                }

                yield return(f);

                if (((TagDatabase.Folder[])f.Result).Length == 0)
                {
                    show = true;
                }
                else
                {
                    {
                        var iter = new TaskEnumerator <TagDatabase.Filter>(Database.GetFilters());
                        f = Scheduler.Start(iter.GetArray());
                    }

                    yield return(f);

                    if (((TagDatabase.Filter[])f.Result).Length == 0)
                    {
                        show = true;
                    }
                }
            }

            if (show)
            {
#if !MONO
                using (var dialog = new ConfigurationDialog(Database))
                    if (dialog.ShowDialog() != DialogResult.OK)
                    {
                        yield return(ExitTask());
                    }
#else
                Console.WriteLine("Configuration required :-(");
                yield return(ExitTask());
#endif
            }
        }
예제 #2
0
        public static void InitUI()
        {
            #if !MONO
            HotkeyWindow = new NativeWindow();
            HotkeyWindow.CreateHandle(new CreateParams {
                Caption = "NDexer Hotkey Window",
                X = 0,
                Y = 0,
                Width = 0,
                Height = 0,
                Style = 0,
                ExStyle = 0x08000000,
                Parent = new IntPtr(-3)
            });

            Icon_Monitoring = Icon.FromHandle(Properties.Resources.database_monitoring.GetHicon());
            Icon_Working_1 = Icon.FromHandle(Properties.Resources.database_working_1.GetHicon());
            Icon_Working_2 = Icon.FromHandle(Properties.Resources.database_working_2.GetHicon());

            ContextMenu = new ContextMenuStrip();
            ContextMenu.Items.Add(
                "&Search", null,
                (e, s) => {
                    Scheduler.Start(ShowFullTextSearchTask(), TaskExecutionPolicy.RunAsBackgroundTask);
                }
            );
            ContextMenu.Items.Add("-");
            ContextMenu.Items.Add(
                "&Configure", null,
                (e, s) => {
                    using (var dialog = new ConfigurationDialog(Database))
                        if ((dialog.ShowDialog() == DialogResult.OK) && (dialog.NeedRestart))
                            Scheduler.Start(RestartTask(), TaskExecutionPolicy.RunAsBackgroundTask);
                }
            );
            ContextMenu.Items.Add(
                "&Rebuild Index", null,
                (e, s) => {
                    Scheduler.Start(ConfirmRebuildIndexTask(), TaskExecutionPolicy.RunAsBackgroundTask);
                }
            );
            ContextMenu.Items.Add("-");
            ContextMenu.Items.Add(
                "E&xit", null,
                (e, s) => {
                    Scheduler.Start(ExitTask(), TaskExecutionPolicy.RunAsBackgroundTask);
                }
            );

            NotifyIcon = new NotifyIcon();
            NotifyIcon.ContextMenuStrip = ContextMenu;
            NotifyIcon.DoubleClick += (EventHandler)((s, e) => {
                Scheduler.Start(ShowFullTextSearchTask(), TaskExecutionPolicy.RunAsBackgroundTask);
            });

            Scheduler.Start(
                RefreshTrayIcon(),
                TaskExecutionPolicy.RunAsBackgroundTask
            );
            #endif
        }
예제 #3
0
        public static IEnumerator<object> AutoShowConfiguration(string[] argv)
        {
            bool show = false;
            IFuture f;

            if (argv.Contains("--configure")) {
                show = true;
            } else {
                {
                    var iter = new TaskEnumerator<TagDatabase.Folder>(Database.GetFolders());
                    f = Scheduler.Start(iter.GetArray());
                }

                yield return f;

                if (((TagDatabase.Folder[])f.Result).Length == 0) {
                    show = true;
                } else {
                    {
                        var iter = new TaskEnumerator<TagDatabase.Filter>(Database.GetFilters());
                        f = Scheduler.Start(iter.GetArray());
                    }

                    yield return f;

                    if (((TagDatabase.Filter[])f.Result).Length == 0)
                        show = true;
                }
            }

            if (show) {
            #if !MONO
                using (var dialog = new ConfigurationDialog(Database))
                    if (dialog.ShowDialog() != DialogResult.OK)
                        yield return ExitTask();
            #else
                Console.WriteLine("Configuration required :-(");
                yield return ExitTask();
            #endif
            }
        }
예제 #4
0
        public static void InitUI()
        {
#if !MONO
            HotkeyWindow = new NativeWindow();
            HotkeyWindow.CreateHandle(new CreateParams {
                Caption = "NDexer Hotkey Window",
                X       = 0,
                Y       = 0,
                Width   = 0,
                Height  = 0,
                Style   = 0,
                ExStyle = 0x08000000,
                Parent  = new IntPtr(-3)
            });

            Icon_Monitoring = Icon.FromHandle(Properties.Resources.database_monitoring.GetHicon());
            Icon_Working_1  = Icon.FromHandle(Properties.Resources.database_working_1.GetHicon());
            Icon_Working_2  = Icon.FromHandle(Properties.Resources.database_working_2.GetHicon());

            ContextMenu = new ContextMenuStrip();
            ContextMenu.Items.Add(
                "&Search", null,
                (e, s) => {
                Scheduler.Start(ShowFullTextSearchTask(), TaskExecutionPolicy.RunAsBackgroundTask);
            }
                );
            ContextMenu.Items.Add("-");
            ContextMenu.Items.Add(
                "&Configure", null,
                (e, s) => {
                using (var dialog = new ConfigurationDialog(Database))
                    if ((dialog.ShowDialog() == DialogResult.OK) && (dialog.NeedRestart))
                    {
                        Scheduler.Start(RestartTask(), TaskExecutionPolicy.RunAsBackgroundTask);
                    }
            }
                );
            ContextMenu.Items.Add(
                "Res&can", null,
                (e, s) => {
                Scheduler.Start(ScanFiles(), TaskExecutionPolicy.RunAsBackgroundTask);
            }
                );
            ContextMenu.Items.Add(
                "&Rebuild Index", null,
                (e, s) => {
                Scheduler.Start(ConfirmRebuildIndexTask(), TaskExecutionPolicy.RunAsBackgroundTask);
            }
                );
            ContextMenu.Items.Add("-");
            ContextMenu.Items.Add(
                "E&xit", null,
                (e, s) => {
                Scheduler.Start(ExitTask(), TaskExecutionPolicy.RunAsBackgroundTask);
            }
                );

            NotifyIcon = new NotifyIcon();
            NotifyIcon.ContextMenuStrip = ContextMenu;
            NotifyIcon.DoubleClick     += (EventHandler)((s, e) => {
                Scheduler.Start(ShowFullTextSearchTask(), TaskExecutionPolicy.RunAsBackgroundTask);
            });

            Scheduler.Start(
                RefreshTrayIcon(),
                TaskExecutionPolicy.RunAsBackgroundTask
                );
#endif
        }