Example #1
0
        internal void LoadPlugin(LPath pluginAssemblyPath)
        {
            try
            {
                var plugin = PluginProvider2.LoadPlugin(pluginAssemblyPath, this.hagen.Context, Paths.BinDir);

                foreach (var i in plugin.SelectMany(_ => _.GetActionSources()))
                {
                    actionSource.Add(i);
                }
            }
            catch (Exception ex)
            {
                log.Error($"Failed to load {pluginAssemblyPath}.", ex);
            }
        }
Example #2
0
        void InitUserInterface()
        {
            dockPanel = new DockPanel()
            {
                Dock                     = DockStyle.Fill,
                DocumentStyle            = DocumentStyle.DockingMdi,
                DocumentTabStripLocation = DocumentTabStripLocation.Top,
                Theme                    = new VS2015LightTheme(),
                TabIndex                 = 0
            };
            this.IsMdiContainer = true;
            this.Controls.Add(dockPanel);
            this.WindowState = FormWindowState.Maximized;


            InitializeComponent();

            EnableDragAndDropFromInternetExplorer();

            hagen.Context.MainMenu     = this.MainMenuStrip;
            hagen.Context.NotifyAction = text => this.Invoke(() => notifyIcon.ShowBalloonTip(10000, "hagen Alert", text, ToolTipIcon.Info));
            hagen.Context.TagsSource   = () => searchBox.Query.Tags as IReadOnlyCollection <string>;

            this.IsMdiContainer = true;
            // this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;

            jobListView = new JobListView()
            {
                Text = "Jobs"
            };

            hagen.Context.AddJob = this.jobListView.JobList.Jobs.Add;

            var pluginProvider = new PluginProvider2(hagen.Context, Paths.BinDir);

            actionSource = new Composite(pluginProvider.GetActionSources().ToArray());

            searchBox = new SearchBox(this.hagen.Context, actionSource)
            {
                Text = "Search",
            };
            searchBox.ItemsActivated += new EventHandler(searchBox_ItemsActivated);

            AddPanel(searchBox);
            AddPanel(jobListView);

            DragEnter += new DragEventHandler(Main_DragEnter);
            DragDrop  += new DragEventHandler(Main_DragDrop);

            this.AllowDrop = true;
            this.Load     += new EventHandler(Main_Load);

            this.KeyDown   += new KeyEventHandler(Main_KeyDown);
            this.KeyPreview = true;

            var binding = hotkeyBinder.Bind(Shortcut.Modifiers.Alt | Shortcut.Modifiers.Control, Keys.Space);

            binding.To(Popup);

            this.reportsToolStripMenuItem.DropDownItems.AddRange(GetTextReportMenuItems().ToArray());
        }