Exemple #1
0
 public void ActivateTab(string tabpluginname)
 {
     OcrDemo.Controls.TabItemWrapper[] tabItems = ctlTabMain.
                                                  Items.
                                                  Cast <OcrDemo.Controls.TabItemWrapper>().ToArray();
     OcrDemo.Controls.TabItemWrapper tabMatch = tabItems.
                                                FirstOrDefault(t => (string)t.Plugin.Metadata[OcrDemo.Contracts.Constants.MEF_ATTRIBUTE_PLUGINNAME] == tabpluginname);
     if (tabMatch == null)
     {
         MessageBox.Show($"No tab with plugin name:{tabpluginname} was found");
         return;
     }
     ctlTabMain.SelectedItem = tabMatch;
 }
Exemple #2
0
        private void LoadTabbedPlugins()
        {
            foreach (var plugin in _hostMef.TabbedViews)
            {
                var tItem = new OcrDemo.Controls.TabItemWrapper();
                tItem.Plugin = plugin;
                tItem.Header = plugin.Metadata[OcrDemo.Contracts.Constants.MEF_ATTRIBUTE_PLUGIN_TAB_TITLE];
                ctlTabMain.Items.Add(tItem);

                /*
                 * TabItem tItem = new TabItem();
                 * Type tyPlugin=Type.GetType(plugin.TypeName, false, false);
                 * Object ctl=Activator.CreateInstance(tyPlugin);
                 * if (ctl == null)
                 * {
                 *  MessageBox.Show($" Could not load plugin View:{tItem}");
                 * }
                 * tItem.Content = ctl;
                 * tItem.Header = plugin.TabTitle;
                 * ctlTabMain.Items.Add(tItem);
                 */
            }
        }