コード例 #1
0
ファイル: StatusRegister.cs プロジェクト: vaulthunter/sledge
        public Task OnInitialise()
        {
            foreach (var si in _statusItems.OrderBy(x => OrderHintAttribute.GetOrderHint(x.Value.GetType())))
            {
                Add(si.Value);
            }

            // Subscribe to context changes
            Oy.Subscribe <IContext>("Context:Changed", ContextChanged);

            return(Task.FromResult(0));
        }
コード例 #2
0
        public Task OnStartup()
        {
            // Register the exported sidebar components
            foreach (var export in _sidebarComponents)
            {
                var ty   = export.Value.GetType();
                var hint = OrderHintAttribute.GetOrderHint(ty);
                Add(export.Value, hint);
                Log.Debug("Sidebar", "Loaded: " + export.Value.GetType().FullName);
            }

            // Subscribe to context changes
            Oy.Subscribe <IContext>("Context:Changed", ContextChanged);
            return(Task.CompletedTask);
        }
コード例 #3
0
        public async Task OnStartup()
        {
            // Register the exported tools
            foreach (var export in _tools.OrderBy(x => OrderHintAttribute.GetOrderHint(x.Value.GetType())))
            {
                Log.Debug(nameof(ToolRegister), "Loaded: " + export.Value.GetType().FullName);
                _components.Add(export.Value);
            }

            // Subscribe to context changes
            Oy.Subscribe <IContext>("Context:Changed", ContextChanged);

            Oy.Subscribe <string>("ActivateTool", async x =>
            {
                await ActivateTool(_components.FirstOrDefault(t => t.Name == x));
            });
            Oy.Subscribe <ITool>("ActivateTool", ActivateTool);
        }