From: SteveR on
Feel like I'm taking baby steps here...

Ok, I was able to define the interface and args like:

namespace clsVideo
{
public interface IVideo
{
event EventHandler<PlayStateArgs> PlayStateEvent;
}

public class PlayStateArgs : EventArgs
{
public string strData;
}

}

Then in the class that's using the interface I have:

using clsVideo;
namespace VideoVLC

{

public class clsVideoVLC : clsVideo.IVideo

{
...
But now I'm getting two errors:
`VideoVLC.clsVideoVLC' does not implement interface member
`clsVideo.IVideo.PlayStateEvent.add' (CS0535)

`VideoVLC.clsVideoVLC' does not implement interface member
`clsVideo.IVideo.PlayStateEvent.remove' (CS0535)

Have I done something wrong... or not done something I should have?

sr


"Peter Duniho" wrote:

> Steve Ricketts wrote:
> > I tried that first: event EventHandler<PlayStateArgs> PlayStateEvent;
> > but it says PlayStateArgs could not be found. I tried adding "class
> > PlayStateArgs : EventArgs" but couldn't get the syntax right. What
> > would be the syntax for specifying the PlayStateArgs?
>
> The PlayStateArgs type needs to be visible to the assembly declaring the
> interface itself. Either declare it in that interface (which is
> probably the best approach, since presumably the EventArgs type is
> closely tied to the interface type in which the event must be
> implemented), or have that assembly reference the assembly where the
> PlayStateArgs is defined.
>
> Pete
> .
>
From: Willem van Rumpt on
On 21-5-2010 18:26, SteveR wrote:

> But now I'm getting two errors:
> `VideoVLC.clsVideoVLC' does not implement interface member
> `clsVideo.IVideo.PlayStateEvent.add' (CS0535)
>
> `VideoVLC.clsVideoVLC' does not implement interface member
> `clsVideo.IVideo.PlayStateEvent.remove' (CS0535)
>
> Have I done something wrong... or not done something I should have?
>
> sr
>

Without seeing the actual source code it's impossible to know.

Just as a quick test, you can select "implement interface" from the
context menu when the caret is at the "clsVideo.IVideo" of the class
declaration. If after that, the compiler still complains, some actual
source code would be nice so we can properly analyse what's going on.

--
Willem van Rumpt
From: sloan on

Make a clean break from old naming conventions.

//
namespace clsVideo
{
//

That is uber confusing. You're using a VB6 hungarian notation for a
cls....for a c# namespace.... (???)
Break with the old....start today would be my advice.



http://msdn.microsoft.com/en-us/library/893ke618%28VS.71%29.aspx


The general rule for naming namespaces is to use the company name followed
by the technology name and optionally the feature and design as follows.

CompanyName.TechnologyName[.Feature][.Design]





"SteveR" <SteveR(a)discussions.microsoft.com> wrote in message
news:B298452D-D4B0-49F7-AE9C-ED41EAB8A4E0(a)microsoft.com...
> Feel like I'm taking baby steps here...
>
> Ok, I was able to define the interface and args like:
>
> namespace clsVideo
> {
> public interface IVideo
> {
> event EventHandler<PlayStateArgs> PlayStateEvent;
> }
>
> public class PlayStateArgs : EventArgs
> {
> public string strData;
> }
>
> }
>
> Then in the class that's using the interface I have:
>
> using clsVideo;
> namespace VideoVLC
>
> {
>
> public class clsVideoVLC : clsVideo.IVideo
>
> {
> ...
> But now I'm getting two errors:
> `VideoVLC.clsVideoVLC' does not implement interface member
> `clsVideo.IVideo.PlayStateEvent.add' (CS0535)
>
> `VideoVLC.clsVideoVLC' does not implement interface member
> `clsVideo.IVideo.PlayStateEvent.remove' (CS0535)
>
> Have I done something wrong... or not done something I should have?
>
> sr
>
>
> "Peter Duniho" wrote:
>
>> Steve Ricketts wrote:
>> > I tried that first: event EventHandler<PlayStateArgs> PlayStateEvent;
>> > but it says PlayStateArgs could not be found. I tried adding "class
>> > PlayStateArgs : EventArgs" but couldn't get the syntax right. What
>> > would be the syntax for specifying the PlayStateArgs?
>>
>> The PlayStateArgs type needs to be visible to the assembly declaring the
>> interface itself. Either declare it in that interface (which is
>> probably the best approach, since presumably the EventArgs type is
>> closely tied to the interface type in which the event must be
>> implemented), or have that assembly reference the assembly where the
>> PlayStateArgs is defined.
>>
>> Pete
>> .
>>


From: Steve Ricketts on
Point well taken. These were a VB6 conversion and since I'm the only one
writing code, I never gave it much thought. Your suggestion is a good one
and I'll start paying more attention to the namespaces.

sr

"sloan" <sloan(a)ipass.net> wrote in message
news:#6lJe8Q#KHA.3880(a)TK2MSFTNGP04.phx.gbl...
>
> Make a clean break from old naming conventions.
>
> //
> namespace clsVideo
> {
> //
>
> That is uber confusing. You're using a VB6 hungarian notation for a
> cls....for a c# namespace.... (???)
> Break with the old....start today would be my advice.
>
>
>
> http://msdn.microsoft.com/en-us/library/893ke618%28VS.71%29.aspx
>
>
> The general rule for naming namespaces is to use the company name followed
> by the technology name and optionally the feature and design as follows.
>
> CompanyName.TechnologyName[.Feature][.Design]
>
>
>
>
>
> "SteveR" <SteveR(a)discussions.microsoft.com> wrote in message
> news:B298452D-D4B0-49F7-AE9C-ED41EAB8A4E0(a)microsoft.com...
>> Feel like I'm taking baby steps here...
>>
>> Ok, I was able to define the interface and args like:
>>
>> namespace clsVideo
>> {
>> public interface IVideo
>> {
>> event EventHandler<PlayStateArgs> PlayStateEvent;
>> }
>>
>> public class PlayStateArgs : EventArgs
>> {
>> public string strData;
>> }
>>
>> }
>>
>> Then in the class that's using the interface I have:
>>
>> using clsVideo;
>> namespace VideoVLC
>>
>> {
>>
>> public class clsVideoVLC : clsVideo.IVideo
>>
>> {
>> ...
>> But now I'm getting two errors:
>> `VideoVLC.clsVideoVLC' does not implement interface member
>> `clsVideo.IVideo.PlayStateEvent.add' (CS0535)
>>
>> `VideoVLC.clsVideoVLC' does not implement interface member
>> `clsVideo.IVideo.PlayStateEvent.remove' (CS0535)
>>
>> Have I done something wrong... or not done something I should have?
>>
>> sr
>>
>>
>> "Peter Duniho" wrote:
>>
>>> Steve Ricketts wrote:
>>> > I tried that first: event EventHandler<PlayStateArgs> PlayStateEvent;
>>> > but it says PlayStateArgs could not be found. I tried adding "class
>>> > PlayStateArgs : EventArgs" but couldn't get the syntax right. What
>>> > would be the syntax for specifying the PlayStateArgs?
>>>
>>> The PlayStateArgs type needs to be visible to the assembly declaring the
>>> interface itself. Either declare it in that interface (which is
>>> probably the best approach, since presumably the EventArgs type is
>>> closely tied to the interface type in which the event must be
>>> implemented), or have that assembly reference the assembly where the
>>> PlayStateArgs is defined.
>>>
>>> Pete
>>> .
>>>
>
>
From: Steve Ricketts on
Here's all the code. I tried to strip everything but the essentials.
Getting the following error:

'Velocedge.CADE.Video.VLC.clsVideoVLC<PlayStateArgs>' does not implement
interface member 'Velocedge.CADE.Video.IVideo.PlayStateEvent'.
'Velocedge.CADE.Video.VLC.clsVideoVLC<PlayStateArgs>.PlayStateEvent' cannot
implement 'Velocedge.CADE.Video.IVideo.PlayStateEvent' because it does not
have the matching return type of
'System.EventHandler<Velocedge.CADE.Video.PlayStateArgs>'.


using System;
namespace Velocedge.CADE.Video
{
public interface IVideo
{
event EventHandler<PlayStateArgs> PlayStateEvent;
}

public class PlayStateArgs : EventArgs
{
private readonly string _strData;

public PlayStateArgs(string strData)
{
_strData = strData;
}
public string strData { get { return _strData; } }
}
}

using System;
using Velocedge.CADE.Video;

namespace Velocedge.CADE.Video.VLC
{
public class clsVideoVLC<PlayStateArgs> : IVideo
{

public clsVideoVLC ()
{
}

#region playState Event
public event EventHandler PlayStateEvent;

protected virtual void onPlayStateEvent(PlayStateArgs e)
{
EventHandler<PlayStateArgs> handler = PlayStateEvent;
if (handler != null)
{
handler(this, e);
}
}
public void doPlayState(string strData)
{
PlayStateArgs e = new PlayStateArgs(strData);
onPlayStateEvent(e);
}
#endregion

}
}



"Willem van Rumpt" <wdotvandotrumpt(a)skoutsoftdotcom> wrote in message
news:#60dGVQ#KHA.5464(a)TK2MSFTNGP05.phx.gbl...
> On 21-5-2010 18:26, SteveR wrote:
>
>> But now I'm getting two errors:
>> `VideoVLC.clsVideoVLC' does not implement interface member
>> `clsVideo.IVideo.PlayStateEvent.add' (CS0535)
>>
>> `VideoVLC.clsVideoVLC' does not implement interface member
>> `clsVideo.IVideo.PlayStateEvent.remove' (CS0535)
>>
>> Have I done something wrong... or not done something I should have?
>>
>> sr
>>
>
> Without seeing the actual source code it's impossible to know.
>
> Just as a quick test, you can select "implement interface" from the
> context menu when the caret is at the "clsVideo.IVideo" of the class
> declaration. If after that, the compiler still complains, some actual
> source code would be nice so we can properly analyse what's going on.
>
> --
> Willem van Rumpt