嗨,我有一個由C#Windows窗體編程和偉大工程。我提出這個應用程序的所有代碼WPF項目,但在WPF的功能有一個錯誤轉換形式應用到WPF應用程序發出錯誤
的應用我宣佈這個功能,你看到CA:
[System.Runtime.InteropServices.DllImport("MNPR.dll")]
unsafe private static extern int LP_Initialize(char* security_code, byte log_level, IntPtr hwndMsg);
並稱之爲這裏
public MainForm()
{
InitializeComponent();
unsafe
{
string security_code = "TSF";
char[] security_code_p = new char[40];
for (int i = 0; i < security_code.Length; i++)
security_code_p[i] = security_code[i];
fixed (char* p = &security_code_p[0])
{
LP_Initialize(p, 1, Handle);
}
}
LP_SetParams(10, 7, 20, 15, 1100, show_car_image ? (byte)2 : (byte)1, 0);
}
我將所有這些代碼的WPF項目,你可以看到:
public MainViewModel()
{
string publicKey = "<?xml version=\"1.0\" encoding=\"utf-16\"?>\r\n<RSAParameters xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\r\n <Exponent>AQAB</Exponent>\r\n <Modulus>x2U1misu3xXuLCAf79dVzUc8b1XcRJUL24gSSc41i2sY5c7nI7s5XUceuMU0o7YwHaLEp2upRI9B8PWAQzIeumFGxnui4sdJBTcY9loP7/+N85PL5MWuxBn6e3ejjwTQUEZ0QS7CgJk8jyF4Ae2M/bpWED6ZHmNs2PgYnHNQEqv3Zb5kuof4JL1C+rK9qnT5HNreF/N322uE7HbazZIPGqCnO4bO4RQupd15ztV8O4S7g5dtSucG7AxYbRl+RpxXZA1GQy2dA29wA8kaFtFoe0D4DCF+Ohfg+ySMdgZSw2BRqkOQc+r5I4ETo4KA+/9Yrm4IdHk++KxWQ5CwapRgIQ==</Modulus>\r\n</RSAParameters>";
secureString = Utility.ConvertToSecureString(publicKey);
publicKey = string.Empty;
timerCallWS = new System.Timers.Timer(30000);
this.timerCallWS.Elapsed += new ElapsedEventHandler(this.timerCallWS_Tick);
NewCarReceiption = new MainModel();
SaveCommand = new MCR.Commands.RelayCommand(Save, CanSave);
ClearCommand = new MCR.Commands.RelayCommand(Clear);
CaptureCommand = new MCR.Commands.RelayCommand(Capture);
PreviewCommand = new Commands.RelayCommand(Preview);
WindowLoadEvent = new DelegateCommand<object>(Load);
CancelAsyncCommand = new MCR.Commands.RelayCommand(CancelAsync);
IncorrectRecognitionCommand = new MCR.Commands.RelayCommand(IncorrectRecognition);
CorrectRecognitionCommand = new MCR.Commands.RelayCommand(CorrectRecognition);
cmbVehicleTypeChangedEvent = new DelegateCommand<object>(VehicleTypeChangedEvent);
cmbVehicleSystemChangedEvent = new DelegateCommand<object>(VehicleSystemChangedEvent);
controlGotFocusEvent = new DelegateCommand<object>(ControlGotFocusEvent);
this.PLQRecognitionBtnVisibilityStatus = false;
CancelAsyncVisibility = false;
MainWrapPanel = false;
unsafe
{
//MessageBox.Show("HID = " + LP_GetHID().ToString());
string security_code = "TSF";
char[] security_code_p = new char[40];
for (int i = 0; i < security_code.Length; i++)
security_code_p[i] = security_code[i];
fixed (char* p = &security_code_p[0])
{
LP_Initialize(p, 1,Handle);
}
}
//it is not required to call LP_SetParams with default params, but if you want to change them, you must call it
LP_SetParams(10, 7, 20, 15, 1100, show_car_image ? (byte)2 : (byte)1, 0);
string info = "آستانهی تشخیص ورود خودرو\n" +
"برای تصاویر شب، مقدار 7 و برای روز مقدار 20 مناسب است\n" +
"مقدار بزرگتر حساسیت کمتری دارد و خودروی کمتری تشخیص می دهد";
}
正如你可以看到這部分LP_Initialize(p, 1,Handle);
Handle
我應該使用,而不是手柄WPF。什麼?
Upvoted單獨的用戶名。 :) –
@MichaelGunter :)))))) –