iscivanomar
asked on
Method in type does not have an implementation
I created the method, added the Interface, and called it in other class.
but I am getting the following error. What am I doing wrong?
TypeLoadException occured:
Method 'GetBatteryChargerForOpera tionCheckE nabling' in type 'LgvManager.Core.Model' from assembly 'LgvManager.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.
IModel.cs
Model.cs
BatteryMission.cs
Thank you
but I am getting the following error. What am I doing wrong?
TypeLoadException occured:
Method 'GetBatteryChargerForOpera
IModel.cs
public abstract IDictionary<int, IBatteryCharger> GetBatteryChargerForOperationCheckEnabling(IStation Station);
Model.cs
public IDictionary<int, IBatteryCharger> GetBatteryChargerForOperationCheckEnabling(int st)
{
var ret = (from bc in _batteryChargers.Values
where (bc.Disabled == false && bc.Fault == false && bc.LogicalPresence == false && bc.Ftc == false &&
bc.Station != null && bc.Station.LgvStations.Count() > 0 && !bc.Station.Disabled
&& bc.Charged == false
&& bc.StationId == st
)
orderby bc.ChargerId
select bc).ToDictionary(x => x.ChargerId);
return ret;
}
BatteryMission.cs
IBatteryCharger currentBatteryChargerfull = Model.GetBattetyChargerFromStation(CurrentJob.Station.StationId);
Thank you
ASKER
sorry, this is the method that I am using
Not this:
The difference is only the name.
IDictionary<int, IBatteryCharger> fullBatteryChargerListE = Model.GetBatteryChargerForOperationCheckEnabling(CurrentJob.Station.StationId);
Not this:
Model.GetBattetyChargerFromStation(CurrentJob.Station.StationId);
The difference is only the name.
My response is the same. Can you provide the first line of the function definition (i.e. the one that has the name and parameters)?
ASKER
This is the IStation interface:
IModel.cs
using System;
using System.Collections.Generic;
namespace LgvManager.Core.Interfaces
{
public interface IStation
{
#region Methods
bool Save();
void CheckStatus();
IList<ITrackingInfo> GetLoadUnits();
IList<ITrackingInfo> GetLoadUnitsByRow(int row);
IList<ITrackingInfo> GetLoadUnitsByRow(int row, int level);
IList<ITrackingInfo> GetLoadUnitsByPosition(int pos);
IList<ITrackingInfo> GetLoadUnitsByPosition(int pos, int level);
#endregion
#region Properties
bool Active { get; set; }
bool Full { get; set; }
int Priority { get; set; }
int? ActiveCallTypeId { get; set; }
DateTime? CallTime { get; set; }
int Depth { get; set; }
string Description { get; set; }
bool Disabled { get; set; }
int LgvType { get; set; }
int MaxLevels { get; set; }
int MinRecallTime { get; set; }
string Name { get; set; }
Int16 CheckpointId { get; set; }
Int16 StationId { get; set; }
int StationTypeId { get; set; }
int PalletType { get; set; }
string ToString();
int Width { get; set; }
int PalletCount { get; }
int MissionCount { get; }
int LoadMissionCount { get; }
int UnloadMissionCount { get; }
int FreePositions { get; }
int LastOccupiedPosition { get; }
int LastOccupiedLevel { get; }
bool IsStackable { get; }
int FirstFreePosition { get; }
int FirstLevelWithFreePosition { get; }
IStationProperty this[string propertyName] { get; }
bool LoadEnabled { get; }
bool UnloadEnabled { get; }
bool IsSelectable { get; }
#endregion
#region Navigation Properties
IStationType StationType { get; set; }
ICallType ActiveCallType { get; set; }
ILgv BatteryStationForLgv { get; set; }
ILgv MaintenanceStationForLgv { get; set; }
ILgv LgvAssigned { get; set; }
IList<ILgvStation> LgvStations { get; set; }
IPlcStation PlcStation { get; set; }
Matrix3D<IStationPosition> Positions { get; set; }
IDictionary<string, IStationProperty> Properties { get; set; }
IList<Pair<IStation, ISearchRule>> Destinations { get; set; }
IList<Pair<IStation, ISearchRule>> Sources { get; set; }
IList<ILgvEncumbrance> Encumbrances { get; set; }
IList<IZone> Zones { get; set; }
IDictionary<int, double> Distances { get; set; }
#endregion
}
}
IModel.cs
using System;
using System.Collections.Generic;
using System.Text;
using Elettric80.CarrierManager;
using Elettric80.Data;
namespace LgvManager.Core.Interfaces
{
public abstract class IModel
{
#region Events
public abstract event EventHandler<MessageNotificationEventArgs> OnMessageNotification;
public abstract event EventHandler<ChangeNotificationEventArgs> OnChangeNotification;
public abstract event EventHandler<MissionPluginNotifyEventArgs> OnMissionPluginNotify;
public abstract event EventHandler<TrackingRemovedPluginNotifyEventArgs> OnTrackingRemovedNotifyPlugin;
public abstract event EventHandler<KeyEventArgs<int, IMission>> OnMissionAdded;
public abstract event EventHandler<KeyEventArgs<int, IMission>> OnMissionRemoved;
#endregion
#region Singleton pattern
protected static IModel singleton;
public static IModel GetInstance()
{
return singleton;
}
#endregion
#region Methods
public abstract int CleanInactiveMissions();
public abstract int CleanInactiveOrders();
public abstract int GetAvailableLgvs(ILgvType lgvType);
public abstract int GetRunningMissions(ILgvType lgvType);
public abstract int GetRunningBatteryMissions(); // IODSS 05-23-2012
public abstract IList<IMission> GetRelatedMissions(int index, int ik, int lgv);
public abstract IList<IStation> GetCallingStations(ILgvType lgvType, EDirection direction, IList<IZone> zones, int? requestedUnits, int? requesterdPalletType);
public abstract IList<IStation> GetBusyStations(bool excludeJobDone);
public abstract IList<ILgvType> GetBusyLgvTypes();
public abstract IList<ILgv> GetBusyLgvs();
public abstract IList<ISemaphore> GetIOCrossingOccupiedRequests(Int16[] outputs, EClusterType clusterType); // IODSS 05-23-2012
public abstract IList<ISemaphore> GetIOCrossingRequests(Int16[] outputs, EClusterType clusterType); // IODSS 05-23-2012
public abstract IList<ISemaphore> GetIOOccupied(Int16[] outputs, EClusterType clusterType); // IODSS 05-23-2012
public abstract IList<ISemaphore> GetCrossingRequests(Int16[] outputs);
public abstract IList<ISemaphore> GetOccupiedSemaphores(Int16[] outputs);
public abstract IList<ILgv> GetLgvsWaitingSemaphore();
public abstract IList<IStation> GetDestinations(IStation source);
public abstract IList<IStation> GetDestinations(IStation source, bool onRecalculate);
public abstract IList<IStation> GetSources(IStation destination);
public abstract bool GetBatteryChargerEncumbranceStatus(); // IODSS 05-23-2012
public abstract IDictionary<int, IBatteryCharger> GetBatteryChargerForOperation(ILgvType lgvType, EJobType jobType); // IODSS 05-23-2012
public abstract IBatteryCharger GetBattetyChargerFromStation(int stationId); // IODSS 05-23-2012
public abstract IDictionary<int, IBatteryCharger> GetBatteryChargerForOperationCheckEnabling(IStation StationId);
//public abstract IOrder GetPrioritaryActiveStationOrder(ILgvType lgvType);
//public abstract IOrder GetPrioritaryActiveStationOrder(ILgvType lgvType, EDirection direction, IList<IZone> zones, int? requestedUnits, int? requesterdPalletType);
public abstract bool ValidateModelByLgv(CarrierSystemStatusLgv data);
public abstract IMission CreateMissionByMessage(CarrierMissionStatusMessage message);
public abstract void NotifyMessage(EMessageType messageType, string message);
public abstract void NotifyPlugin(int code, IMission mission);
public abstract void NotifyPlugin(int code, ITrackingInfo trackingInfo, IStation station);
public abstract void UpdateLgvCountByZone();
public abstract void UpdateLgvCountByZone(IList<IZone> zones);
public abstract bool IsZoneLimitReached(IList<IZone> zones);
public abstract bool IsZoneLimitReached(IStation sourceStation, IStation destinationStation);
#endregion
#region Properties
public abstract IDictionary<int, IStationType> StationTypes { get; }
public abstract IDictionary<Int16, IStation> Stations { get; }
public abstract IDictionary<string, IPlc> Plcs { get; }
public abstract IDictionary<int, IBatteryCharger> BatteryChargers { get; } // IODSS 05-23-2012
public abstract IList<IDoor> BatteryDoors { get; } // IODSS 05-23-2012
public abstract IDictionary<Int16, ISemaphore> Semaphores { get; } // IODSS 05-23-2012
public abstract IDictionary<int, IZone> Zones { get; }
public abstract IDictionary<int, ILgv> Lgvs { get; }
public abstract IDictionary<int, ILgvType> LgvTypes { get; }
public abstract IDictionary<int, IOrder> Orders { get; }
public abstract IDictionary<int, IMission> Missions { get; }
public abstract IList<IMission> CurrentMissions { get; }
public abstract IList<IOrder> CurrentOrders { get; }
public abstract IDictionary<int, ILgvStation> LgvStations { get; }
public abstract bool IsValid { get; set; }
public abstract bool DatabaseStatus { get; set; }
public abstract bool OpcStatus { get; set; }
public abstract bool CarrierStatus { get; set; }
#endregion
}
}
And what is the first line of the Model class (i.e. the one that has the word "class" in it)?
ASKER
public partial class Model : IModel, IOrderManager
{
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
We try to find the problem where we think it was but at the end was only a problem of bad reference.
Thank you
Thank you
Open in new window
...seems to imply that you are trying to call an instance method as if it were a static method. Did you actually name your variable the same name as the class?
i.e.
Open in new window
If not, then you need to create an instance of your class and call the method against the instance:
Open in new window