Example #1
0
        // use async factory pattern to instantiate a new instance...

        public static async Task <PluginsSheet> Create(SettingsProvider provider, IRibbonUI ribbon)
        {
            var sheet = new PluginsSheet(provider, ribbon);
            await sheet.Initialize();

            return(sheet);
        }
Example #2
0
        private async void Navigate(object sender, TreeViewEventArgs e)
        {
            SheetBase sheet;

            if (sheets.ContainsKey(e.Node.Index))
            {
                sheet = sheets[e.Node.Index];
            }
            else
            {
                switch (e.Node.Index)
                {
                case 0: sheet = new ContextMenuSheet(provider); break;

                case 1: sheet = new FavoritesSheet(provider, ribbon); break;

                case 2: sheet = new HighlightsSheet(provider); break;

                case 3: sheet = await PluginsSheet.Create(provider, ribbon); break;

                case 4: sheet = new RibbonBarSheet(provider); break;

                case 5: sheet = new SearchEngineSheet(provider); break;

                default: sheet = new SnippetsSheet(provider, ribbon); break;
                }

                sheets.Add(e.Node.Index, sheet);
            }

            headerLabel.Text = sheet.Title;

            contentPanel.Controls.Clear();
            contentPanel.Controls.Add(sheet);
        }