Good day all
I wrote the following method:
private void RegisterEvent(object targetObject, string eventName, string methodName)
{
EventInfo eventInfo = targetObject.GetType().GetEvent(eventName);
MethodInfo method = eventInfo.EventHandlerType.GetMethod("Invoke");
IEnumerable<Type> types = method.GetParameters().Select(param...
In dotNET with C# 4.0, How can I ensure that event that happens on an arbitrary thread X will call handlers in the same thread (or synchronization context) as the subscribing thread A, B, or C.
I am trying to avoid having to put in threading-related code into handler method or event site.
It would be really great if I wouldn't have to ...
Hi,
I have a viewmodel named EmployeeViewModel which is inherited from ViewModelBase. here is the implementation of ViewModelBase.
public event PropertyChangedEventHandler PropertyChanged;
public void FirePropertyChanged(string propertyname)
{
var handler = PropertyChanged;
if (handler != null)
ha...
Hi,
I have created a sprite as below:
var arrowHeadRight:Sprite = new Sprite();
with(arrowHeadRight.graphics){
beginFill(0xDDDDDD, 1);
moveTo(50,0);
lineTo(0,50);
lineTo(50,100);
lineTo(50,0);
endFill();
}
On Mouse Over, I wish to change the color of the fill on this shape?
Can this be done or do I have to re-...
Hi,
I just start developping on android and i'm missing the EventHandler from c#. As a learning process, I started to write an EventHandler in java. It's almost good execept the method:
getSlider_WantedValueChangedMethod()
I need to get it through reflection, and the name is a String. So when you refactor, It will not change.
What do you...
A wcf service accessing an SQL database:
private void GetImagesDataFromDB(int imageIndex, int **extraParam**)
{
ServiceReference1.DbServiceClient webService =
new ServiceReference1.DbServiceClient();
webService.GetSeriesImagesCompleted += new EventHandler<ServiceReference1.GetSeriesImagesCompletedEven...
I hate EventHandler. I hate that I have to cast the sender if I want to do anything with it. I hate that I have to make a new class inheriting from EventArgs to use EventHandler<T>.
I've always been told that EventHandler is the tradition and blah, blah...whatever. But I can't find a reason why this dogma is still around.
Is there a re...
I've got a UIPickerViewModel that's supposed to fire an event when its selected value changes, but by the time Selected is called, the EventHandler is null. Code (somewhat simplified):
public class MyPickerViewModel: UIPickerViewModel {
public event EventHandler SelectionChanged;
public void PrintWhetherSelectionChangedIsNull()...
What's the difference between this two:
_btnAddNew.Click += OnAddNewClick;
_btnAddNew.Click += new RoutedEventHandler(OnAddNewClick);
Thank you!!
...
Hi.
This isn't a crucial piece of knowledge for me, but I would still like to know what exactly is happening here.
This is a .NET 3.5 Web Forms application. One of the pages has 3 server-side inputs with type 'submit'. Each one of these inputs has the following JavaScript handlers assigned to them with jQuery:
$('.button').mouseov...
Code:
$('#Inputfield').keyup(function(e)
{
if(e.which == 13)
{
functionXyz();
}
else
{
functionZyx();
}
});
$(document).keyup(function(exit) {
if (exit.keyCode == 27) { functionZzy(); }
});
Question:...
I wasn't expecting to come across this error. I imagine I'm doing something wrong somewhere else.
I have an MVVM application.
My model can serialise its self using a BinaryFormatter. This was working fine.
Today I added in an event handler to my model, and the viewmodel that contains the model subscribes to this event.
Now when I try...
I wish to create a custom EventHandler that can have any number of objects as its parameters and the objects it gets isn't known in advance.
I know I can pass it an Object[] but what I would like is something similar to
MyEventHandler someCustomEvent(Object obj1, Object obj2, Object obj3)
where the number of objects can be 0 or 10 if...
In my asp.net page codebehind,I am creating a button dynamically and adding a event handler to it.But when i set a breakpoint on the button click event(which i added in codebehind),its not hitting.Any idea why ?
My code is here
ASP.NET PAGE
<form runat="Server" id="frm1">
<div id="divPaymentOptions" runat="Server"> </div>
</form> ...
Given the following HTML file:
<!DOCTYPE html5>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#form').submit(function(e) {
// put your breakpoint here to look at e
alert('Whic...
Hi, i am working on application in WP7 , i would like to pass a list box as parameter to client_DownloadStringCompleted method.
My code looks like below ,
WebClient client = new WebClient();
client.DownloadStringCompleted += new DownloadStringCompletedEventHandler(client_DownloadStringCompleted);
...