"Implement Interface Members" is missing?


(mtiede) #1

I created a project and added a new class. Then I made it Public Class( ICommand ). In the past, I’m pretty sure I just right clicked on the ICommand and there was a choice to “Implement Interface Members” which filled out stubs for that interface. It didn’t do it this time. Did that get taken away or am I not doing something right? That feature was a great timesaver as it made all the right parameters, types, etc.

… moments pass …

I just noticed that if I hovered over the ICommand, it says “unknown type ICommand”. It compiles, so I would think it was known. Here is what I have after completing the interface members manually:

namespace InsteonViewmodels.Commands;

interface
   
   uses
      Insteon.Viewmodels,
      System.Windows.Input, 
      System.Windows;

   type
      DeleteSelectedSceneDevicesCommand = public class( ICommand )
         private
           fViewmodel : InsteonViewmodel;
         protected
         public
            constructor Create( viewmodel : InsteonViewmodel );
         
            function  CanExecute( parameter : Object ) : Boolean; 
            procedure Execute( parameter : Object );

            event    CanExecuteChanged : EventHandler;
         end;

implementation

   constructor DeleteSelectedSceneDevicesCommand( viewmodel: InsteonViewmodel );
      begin
      fViewmodel := viewmodel;
      end;

   method DeleteSelectedSceneDevicesCommand.CanExecute(parameter: object): Boolean;
      begin
      result := true;
      end;

   method DeleteSelectedSceneDevicesCommand.Execute( parameter : Object );
      begin
      fViewmodel.DeleteSelectedSceneDevices;
      end;


end.

(marc hoffman) #2

Which IDE is this in? where is ICommand defined, by the framework, or yourself?


(mtiede) #3

VS Pro 2017 version 15.9.6. This is .net and ICommand, I think, is in PresentationFramework. (I was having trouble figuring out WHERE ICommand was when I searched the Microsoft documentation. After adding PresentationFramework, it at least compiled. They listed a half dozen assemblies, but I wasn’t sure if that was for different environments or what. So it is defined by the framework)


(marc hoffman) #4

Ok, but CC & Co were still ken even after adding the PresentationFramework reference? If not, I guess that’s the problem?


(mtiede) #5

“CC & CO”? “ken”? I’m not sure what you are asking. PresentationFramework reference was added and that was what allowed it to compile to something that ran correctly.

As long as your “Implement Interface Members” should still be there, then probably I am just missing some other assembly that allows it to work properly. I’ll poke around here some more and see what I come up with.

… time passes …

If CC is CodeCompletion, then yes, that is still working.

After poking a little more, I don’t see any assemblies that I could guess I need that are allowed to be added and solve the problem (some things I tried to add it said were duplicate. could have been from other projects in the solution, or something)

… time passes …

Maybe the thing causing the issue is that it has .NetStandard as the target framework?

Even though I added System.Windows.Input, which I think allowed it to compile, if I do System.Windows.Input.ICommand, it says ICommand is an unknown type when compiled.


(marc hoffman) #6

Code Completion & "related functionality’ (ie Go To Definition, and "hovering over ran identifier to see “uknown type”)

typo/bad auto-correct, that was supposed to be “working”

I was referring to

I just noticed that if I hovered over the ICommand, it says “unknown type ICommand”. It compiles, so I would think it was known.

I was asking if this error was before you added the PresentationFramework (which would make sense) or after.


(marc hoffman) #7

Probably, yes. I don’t believe WPF is available under .NET Standard.