English 中文(简体)
处理具有遗产的跨项目活动
原标题:Handling events cross-project with Inheritance

I ve got 2 projects; - My application written in C++ with some project files set to use /clr - My C# WPF control library which contains some forms

在C++申请中,我装上了C# dll的表格,并显示其为STAThread,而我则在背景中掌握了其他一些本土的 st。

我愿在我的C++申请中处理C#形式的事件。 我在此提出表格的代码;

using namespace System::Windows;
using namespace System::Windows::Controls;
using namespace MyProject::Interface::Views;

public ref class MyProjectApplication : public Application
{
};

[STAThread]
void ManagedMain()
{
    CLILicenseView^ winLicenseAgreement = gcnew CLILicenseView();

    MyProjectApplication^ MyProjectCLI = gcnew MyProjectApplication();
    MyProjectCLI->Run(winLicenseAgreement);
}

我的原始形式叫作“License.xaml”,我试图继承它并压倒一切的事件,因为我认为这可能有助于我处理这些事件,但我不知道我做什么。

using namespace System;
using namespace System::Windows;
using namespace System::Windows::Controls;
using namespace MyProject::Interface::Views;

namespace MyProject
{
    public class CLILicenseView : License
    {
        public void CLILicenseView()
        {
            //
        }
    }
}

这是最佳方式,如果不是,我如何从我的C++申请中处理形式事件(例如:纽扣)?

最佳回答

我认为,组成是这里正确的工具,而不是继承。 在“C++/CLI”项目中,Ive在(对一间图书馆进行修缮,没有“ID”)上工作,重新估价的班子通常拥有C++业务逻辑的无人驾驶人。 当用户希望与业务逻辑互动时,他们采用一种管理方法,然后通过点子将这种方法输入未经管理的代码。 在你的情况下,当表格想要与未管理的守则互动时,应将其重新编号为<代码>。 我的项目Application,转而将其称作不受管理的法典。

问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签