0

以下のコードでPluginManagerViewのインスタンスを表示しようとしています。

このXAMLファイルは、同じ名前空間、同じプロジェクトにあります。mainwindow.Show();しかし、私はそれを言っている行でエラーが発生しました

Error 1 'PluginManager.PluginManagerView' does not contain a definition for 'Show' and no extension method 'Show' accepting a first argument of type 'PluginManager.PluginManagerView' could be found (are you missing a using directive or an assembly reference?) Blah procedyre .cs  30  24  PluginManager

誰かが問題が何であるかについて教えてもらえますか?また、MainWindowの以前の使用でエラーがスローされないのはなぜですか?

using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Windows;
using System.ComponentModel.Composition.Hosting;

namespace PluginManager
{
    public class PublicProcedures : Application
    {
        public static void ShowPlugins()
        {
            var mainwindow = new PluginManagerView();

            //An aggregate catalog that combines multiple catalogs

            var catalog = new AggregateCatalog();
            //Adds all the parts found in the same assembly as the Program class
            //catalog.Catalogs.Add(new AssemblyCatalog(this.GetType().Assembly));
            catalog.Catalogs.Add(new DirectoryCatalog("./Plugins/"));

            var container = new CompositionContainer(catalog);

            var modules = container.GetExportedValues<IPlugin>();


            mainwindow.DataContext = modules;
            mainwindow.Show();
        }

    }


}
4

2 に答える 2

1

Window.Show(これはあなたがやりたいことだと思います)を呼び出すには、PluginManagerViewをクラスWindowから派生させる必要があり、そのXAMLは次のようになります。

<Window x:Class="PluginManager.PluginManagerView" ...>
    ...
</Window>
于 2012-05-16T07:38:27.783 に答える
0

PluginManagerViewそれが何であれ、メソッドがないことを訴えています( 「メインウィンドウ」と呼ばれるShowインスタンスで呼び出そうとしています)。PluginManagerView

于 2012-05-15T22:58:57.230 に答える