Re: Lots of bind/notify classes

2010-05-28 Thread Richard Mason
Hi Greg,

I hear your pain and reflect it.

You could probably set up a method using PostSharp to automatically create
the necessary setter code, but that's provided you can introduce PostSharp
into your process.

The best I've managed is to set up a Visual Studio code snippet to help
create them quickly. I deferred doing that for a long time, but recently got
around to it and it does make things much less painful. But unfortunately
still far from ideal. Just grab the existing 'prop' code snippet and expand
it out from there. 'tis fairly simple to do and well worth the effort.

ciao, Richard

On Fri, May 28, 2010 at 4:18 PM, Greg Keogh g...@mira.net wrote:

  *Look Dave, I can see you're really upset about this. I honestly think
 you ought to sit down calmly, take a stress pill, and think things over* –
 HAL (2001)



 I was wondering if anyone has found a nice way of creating/managing lots of
 classes that are suitable for binding and implement INotifyPropertyChanged.
 As you know, you have to keep coding properties like this:



 public string CompanyName

 {

 get {return this.companyNameValue;}



 set

 {

 if (value != this.companyNameValue)

 {

 this.companyNameValue = value;

 NotifyPropertyChanged(CompanyName);

 }

 }

 }



 You can create a  simple base class to factor out the event, but not much
 else, as there is no way I know of to intercept any arbitrary property
 setter and add custom processing. Is that right?! Coding the above skeleton
 dozens or hundreds of times gets tedious and I’m hoping there’s a better
 way. I did consider using a T4 generator to spit out the classes, but that’s
 an obtuse way around the problem and will require extra research time (but I
 see others have done it already).



 I have dozens of existing classes with dozens of properties and I’d like to
 use them for binding, but I’d have to expand every property to be like the
 same above, which would be hell.



 Greg



 ___
 ozsilverlight mailing list
 ozsilverlight@ozsilverlight.com
 http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight


___
ozsilverlight mailing list
ozsilverlight@ozsilverlight.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight


RE: Lots of bind/notify classes

2010-05-28 Thread Steven Nagy
Check out Post#:
http://www.sharpcrafters.com/postsharp/documentation/getting-started

Example:
http://ruskin-dantra.blogspot.com/2009/03/inotifypropertychanged-made-easier.html
Not sure if this works in Silverlight land though.
Steven Nagy
Readify | Senior Developer
M: +61 404 044 513 | E: steven.n...@readify.netsip:steven.n...@readify.net | 
B: azure.snagy.namehttp://azure.snagy.name/

From: ozsilverlight-boun...@ozsilverlight.com 
[mailto:ozsilverlight-boun...@ozsilverlight.com] On Behalf Of Greg Keogh
Sent: Friday, 28 May 2010 4:18 PM
To: 'ozSilverlight'
Subject: Lots of bind/notify classes

Look Dave, I can see you're really upset about this. I honestly think you ought 
to sit down calmly, take a stress pill, and think things over - HAL (2001)

I was wondering if anyone has found a nice way of creating/managing lots of 
classes that are suitable for binding and implement INotifyPropertyChanged. As 
you know, you have to keep coding properties like this:

public string CompanyName
{
get {return this.companyNameValue;}

set
{
if (value != this.companyNameValue)
{
this.companyNameValue = value;
NotifyPropertyChanged(CompanyName);
}
}
}

You can create a  simple base class to factor out the event, but not much else, 
as there is no way I know of to intercept any arbitrary property setter and add 
custom processing. Is that right?! Coding the above skeleton dozens or hundreds 
of times gets tedious and I'm hoping there's a better way. I did consider using 
a T4 generator to spit out the classes, but that's an obtuse way around the 
problem and will require extra research time (but I see others have done it 
already).

I have dozens of existing classes with dozens of properties and I'd like to use 
them for binding, but I'd have to expand every property to be like the same 
above, which would be hell.

Greg

___
ozsilverlight mailing list
ozsilverlight@ozsilverlight.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight


Re: Lots of bind/notify classes

2010-05-28 Thread Miguel Madero
I just saw everyone was alredy talking about PostSharp. Sorry I should read
the thread before replying.
BTW, it doesn't affect Blendability.

I can live with what Steven suggested, of having that extra line bit of code
for each property, but it gets a bit messy when you have derived properties.


On Fri, May 28, 2010 at 5:09 PM, Miguel Madero m...@miguelmadero.com wrote:

 For the VMs I'm using an AOP (using CastleDynamicProxy for Debug and
 PostSharp for Release) to automatically do this for me. Jonas 
 bloggedhttp://jonas.follesoe.no/AutomaticINPCUsingDynamicProxyAndNinject.aspxabout
  this approach. For PostSharp, I don't have a link, but I could send
 you a code that works for VS08 and SL3.

 Also in a somewhat related topic you might want to have a look at
 MicroModels http://www.paulstovell.com/micromodels-introduction.


  On Fri, May 28, 2010 at 4:18 PM, Greg Keogh g...@mira.net wrote:

*Look Dave, I can see you're really upset about this. I honestly think
 you ought to sit down calmly, take a stress pill, and think things over*– 
 HAL (2001)



 I was wondering if anyone has found a nice way of creating/managing lots
 of classes that are suitable for binding and implement
 INotifyPropertyChanged. As you know, you have to keep coding properties like
 this:



 public string CompanyName

 {

 get {return this.companyNameValue;}



 set

 {

 if (value != this.companyNameValue)

 {

 this.companyNameValue = value;

 NotifyPropertyChanged(CompanyName);

 }

 }

 }



 You can create a  simple base class to factor out the event, but not much
 else, as there is no way I know of to intercept any arbitrary property
 setter and add custom processing. Is that right?! Coding the above skeleton
 dozens or hundreds of times gets tedious and I’m hoping there’s a better
 way. I did consider using a T4 generator to spit out the classes, but that’s
 an obtuse way around the problem and will require extra research time (but I
 see others have done it already).



 I have dozens of existing classes with dozens of properties and I’d like
 to use them for binding, but I’d have to expand every property to be like
 the same above, which would be hell.



 Greg



 ___
 ozsilverlight mailing list
 ozsilverlight@ozsilverlight.com
 http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight




 --
 Miguel A. Madero Reyes
 www.miguelmadero.com (blog)
 m...@miguelmadero.com




-- 
Miguel A. Madero Reyes
www.miguelmadero.com (blog)
m...@miguelmadero.com
___
ozsilverlight mailing list
ozsilverlight@ozsilverlight.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight


RE: Lots of bind/notify classes

2010-05-28 Thread Greg Keogh
Chaps, I have decided that snippets are the quickest way out of this at the
moment. It doesn't modularise or reduce the property code, but at least it
means I can create them faster.

 

Actually, I forgot how good snippets are. For some reason I neglected them
for the last couple of years, now I'm all invigorated about them again and
I'm building my own fresh collection.

 

Greg

___
ozsilverlight mailing list
ozsilverlight@ozsilverlight.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight


Re: Images invisible

2010-05-28 Thread Stephen Price
It may fail for you from home too. I just tried it on my machine and it
didn't work. Pinging somesite.com is actually resolving to a real looking IP
address. I'm wondering if either someone is now using it for real?!

it now resolves to 82.98.86.175. I started to think i had the wrong url but
google showed me that somesite.com should resolve to 127.0.0.1. Ah well you
can always put it in your local hosts file. Strange that it doesn't work
anymore.

The main thing is that fiddler needs to be tricked into monitoring local
traffic by using your local loopback of 127.0.0.1. It should be an option in
fiddler but isn't.

On Fri, May 28, 2010 at 3:21 PM, Miguel Madero m...@miguelmadero.com wrote:

 If you have another proxy the 127.0.0.1. (see the . at the end) trick
 doesn't work. Try using the computer name instead.

 @Stehpen, I didn't know about the somesite.com trick. Hwoever, it doesn't
 work from my machine, I'll try  it at home.

 On Fri, May 28, 2010 at 2:22 PM, Greg Keogh g...@mira.net wrote:

  I tried to set the web app hosting my Silverlight app to run from the
 localhost IIS websever, but it continues to run from the file system.
 Fiddler will be useless until I can get it over HTTP. So now I have another
 roadblock on the way to diagnosing my roadblock – Greg

 ___
 ozsilverlight mailing list
 ozsilverlight@ozsilverlight.com
 http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight




 --
 Miguel A. Madero Reyes
 www.miguelmadero.com (blog)
 m...@miguelmadero.com

 ___
 ozsilverlight mailing list
 ozsilverlight@ozsilverlight.com
 http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight


___
ozsilverlight mailing list
ozsilverlight@ozsilverlight.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight


Re: Images invisible (SOLVED)

2010-05-28 Thread Stephen Price
Yay me :)

I think the setting that does that is related to the Use Local IIS Web
server. I do the same, tell it to use IIS. I think if you select a
Silverlight unit test project it generates a test page and launches that via
the file system path by default. It's fine for a unit test but not for your
app.

Glad you sorted that one out. Nice before a weekend, you can relax a bit
now. :)

cheers,
Stephen

p.s. you going to Remix next week? I'll be there. If you will be there be
good to catch up. (goes for anyone on the list, come say hi!)

On Fri, May 28, 2010 at 12:28 PM, Greg Keogh g...@mira.net wrote:

  Stephen, I own you a bottle of champagne, as you accidentally pointed out
 what was wrong with my project.



 Why was it using the file system I don’t do that, I prefer to use HTTP
 as it’s more realistic. I didn’t notice the file system path in the web
 browser.



 So sometime over the last couple of days, some configuration of my project
 has changed, some defaults I dunno what, but by carefully putting all my
 project settings back according to those of another working SL3 project it
 has come good. VS has been crashing a lot, and I had to purge all the hidden
 solution files recently, so that’s probably broken my defaults.



 So it couldn’t load the images because I was running from the file system.
 There’s a warning for you!!



 Greg

 ___
 ozsilverlight mailing list
 ozsilverlight@ozsilverlight.com
 http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight


___
ozsilverlight mailing list
ozsilverlight@ozsilverlight.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight


Re: Lots of bind/notify classes

2010-05-28 Thread Miguel Madero
+1 for live templates. I like that it u can use a convention to name  
ur fields with the camelcase version of ur prop name.


The other thing consider is using an expression for the  
propertychanged method instead of passing a string. That makes  
refactoring easier.

RaisePropertyChanged(()=LastName);



Sent from my iPhone

On 28/05/2010, at 6:19 PM, Stephen Price step...@littlevoices.com  
wrote:


+1 Resharper. That's exactly my process for creating those  
properties. One day I'll actually write a propOp live template to do  
the rest of it for me. I think that everytime I create a property...


On Fri, May 28, 2010 at 2:32 PM, Steven Nagy  
steven.n...@readify.net wrote:
I might add, that even if you don’t want to introduce Post# then the 
 simple base class + Resharper combination is pretty good.


For example, your base class has some methods for raising property  
changed events. Then your ViewModel needs a property for first name.


You use the “prop” code snippet, this expands out very quickly to:



public string FirstName { get; set; }



Then ALT+Enter with Resharper lets you convert to backing field in  
total 3 keystrokes:




private string _firstName;

public string FirstName

{

get { return _firstName; }

set { _firstName = value; }

}



Then a single call to property changed:



private string _firstName;

public string FirstName

{

get { return _firstName; }

set { _firstName = value; PropertyChanged(FirstName); }

}



Not so bad, very minimal keystrokes.

Steven Nagy
Readify | Senior Developer

M: +61 404 044 513 | E: steven.n...@readify.net | B: azure.snagy.name



From: ozsilverlight-boun...@ozsilverlight.com [mailto:ozsilverlight- 
boun...@ozsilverlight.com] On Behalf Of Steven Nagy

Sent: Friday, 28 May 2010 4:25 PM
To: ozSilverlight
Subject: RE: Lots of bind/notify classes



Check out Post#:

http://www.sharpcrafters.com/postsharp/documentation/getting-started



Example:

http://ruskin-dantra.blogspot.com/2009/03/inotifypropertychanged-made-easier.html

Not sure if this works in Silverlight land though.

Steven Nagy
Readify | Senior Developer

M: +61 404 044 513 | E: steven.n...@readify.net | B: azure.snagy.name



From: ozsilverlight-boun...@ozsilverlight.com [mailto:ozsilverlight- 
boun...@ozsilverlight.com] On Behalf Of Greg Keogh

Sent: Friday, 28 May 2010 4:18 PM
To: 'ozSilverlight'
Subject: Lots of bind/notify classes



Look Dave, I can see you're really upset about this. I honestly  
think you ought to sit down calmly, take a stress pill, and think  
things over – HAL (2001)




I was wondering if anyone has found a nice way of creating/managing  
lots of classes that are suitable for binding and implement  
INotifyPropertyChanged. As you know, you have to keep coding  
properties like this:




public string CompanyName

{

get {return this.companyNameValue;}



set

{

if (value != this.companyNameValue)

{

this.companyNameValue = value;

NotifyPropertyChanged(CompanyName);

}

}

}



You can create a  simple base class to factor out the event, but not  
much else, as there is no way I know of to intercept any arbitrary  
property setter and add custom processing. Is that right?! Coding  
the above skeleton dozens or hundreds of times gets tedious and I’m  
hoping there’s a better way. I did consider using a T4 generator to  
spit out the classes, but that’s an obtuse way around the problem an 
d will require extra research time (but I see others have done it al 
ready).




I have dozens of existing classes with dozens of properties and I’d  
like to use them for binding, but I’d have to expand every property  
to be like the same above, which would be hell.




Greg




___
ozsilverlight mailing list
ozsilverlight@ozsilverlight.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight


___
ozsilverlight mailing list
ozsilverlight@ozsilverlight.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
___
ozsilverlight mailing list
ozsilverlight@ozsilverlight.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight


Re: Long running animation

2010-05-28 Thread Miguel Madero
Greg,

You could probably use a simple DoubleAnimation using an EasingFunction.

On Tue, May 18, 2010 at 10:40 AM, Greg Keogh g...@mira.net wrote:

  Folks, I want to create a sort of screen saver effect where a shape moves
 slowly around a control. The path it follows is calculated at start time by
 mixing random Sin/Cos functions, then the shape will follow the (x,y)
 coordinates of the function over time. It’s like a moving parametric plot.



 I’m just not sure what coding technique to use for this effect. I’m
 guessing I’ll need a frame-based animation, which I’ve never used before. It
 looks like it “pushes” events to you and you respond and move your elements,
 but it’s not clear how you control the timing.



 I just want to run this idea past someone who’s done it before and can
 confirm if I’m on the right track or not. I’ll keep reading about
 frame-based animations in the meantime.



 Greg

 ___
 ozsilverlight mailing list
 ozsilverlight@ozsilverlight.com
 http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight




-- 
Miguel A. Madero Reyes
www.miguelmadero.com (blog)
m...@miguelmadero.com
___
ozsilverlight mailing list
ozsilverlight@ozsilverlight.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight


RE: Long running animation

2010-05-28 Thread Greg Keogh
Coincidentally, I woke up early this morning and I decided to do some
mental health coding. Just for fun I expanded my proof of concept app from
last week to animate more elements and have some configuration controls for
size, counts and speed. I'm pleased with the great animation effect produced
by a relatively small amount of core code. Imagine how far you could take
this and create some really mind-boggling animations with perspective 3D,
shading and complex shapes.

 

http://www.orthogonal.com.au/computers/hypno/index.htm

 

Cheers,

Greg

___
ozsilverlight mailing list
ozsilverlight@ozsilverlight.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight