7

I have read already a few threads about this, but I still don't know how to solve it in my case. I come from Java and mostly new to C#

I want to attach listener when animation finishes:

myStoryBoard.Completed += new EventHandler(onMyStoryBoardCompleted);

And:

private void onMyStoryBoardCompleted(object sender, EventArgs e)
{       
}

And I get the error in the title. I tried:

 myStoryBoard.Completed += new EventHandler<object>(onMyStoryBoardCompleted);

But then I get:

no overload for 'onMyStoryBoardCompleted' matches delegate 'System.EventHandler<object>'

So it seems that the signature is not compatible with EventHandler<object> and I couldn't find how to make it compatible, I also don't know if this approach is correct.

I read

Understanding events and event handlers in C#

C# Dynamic template implicit conversion error from System.EventHandler to System.EventHandler<TEventArgs>

defining event handler for Tick event of DispatcherTimer in windows 8 app

But still don't find the solution for this case.

Thanks in advance.


yourls.org error creating table

I'm trying to install yourls.org url shortener software on my server in a subdirectory: http://[mydomain.tld]/y/admin/install.php. Numerous install attempts result in the following errors:

Error creating table 'y20130519_url'.
Error creating table 'y20130519_options'.
Error creating table 'y20130519_log'.
Error creating YOURLS tables.

File .htaccess successfully created/updated.

I've double-checked the db user and password. I even tried creating new ones. I've reinstalled a few times.

In phpMyAdmin, I verify that no tables have been added to the database, as suggested by the errors.

In the config file, I modified the following [sensitive info replaced generically here]:

define( 'YOURLS_DB_USER', '[my new db user name is here]' );

define( 'YOURLS_DB_PASS', '[my new db password is here]' );

define( 'YOURLS_DB_NAME', '[my new db name is here]' );

define( 'YOURLS_DB_PREFIX', 'y20130519_' );

define( 'YOURLS_SITE', 'http://[mydomain.tld]/y' );

define( 'YOURLS_HOURS_OFFSET', -5 ); 

define( 'YOURLS_COOKIEKEY', '[I typed random characters here]' );

$yourls_user_passwords = array(
'[I created new user]' => '[I created new password]',
'[I created another new user]' => '[I created another new password]'    // You can have one or more 'login'=>'password' lines
);

Any ideas?

4

1 に答える 1

10

試す:

private void onMyStoryBoardCompleted(object sender, object e)
{ }

そして、ジェネリックを使用してサブスクライブしますEventHandler<object>:

myStoryBoard.Completed += new EventHandler<object>(onMyStoryBoardCompleted);

もちろん、これは、イベント ハンドラーの 2 番目の引数をインスタンスEventArgs(またはその派生クラス) にする必要があるという .NET Framework の規則に反します。Windows 8 Metro など、署名付きのイベントをTimeline定義するクラスを持つ別のフレームワークで実行していると想定しています。CompletedEventHandler<object>

于 2013-05-19T16:27:15.840 に答える