Reputation: 45
I have 2 wpf applications. I need to send as parameter to one of them and in that one to change the parametr and in the other wpf application to use the new value of the variables.
My code :
1 WPF :
Forms.CreatRadar creatRadarWPF = new Forms.CreatRadar(azimuthStart,AzimuthEnd,Long,Lat,numOfRadars,listRadars);
creatRadarWPF.Show();
2 WPF :
public partial class CreatRadar : Window
{
private double AzimuthStart;
private double AzimuthEnd;
private double Long;
private double Lat;
private int numOfRadars;
private List<Radar> ListRadars;
public CreatRadar(double AzimuthStart, double AzimuthEnd, double Long, double Lat, int numOfRadars, List<MapSample.Radar> ListRadars)
{
InitializeComponent();
}
private void CreatRadarBtn_Click(object sender, RoutedEventArgs e)
{
this.AzimuthStart = double.Parse(txt_AzimuthStart.Text.ToString());
this.AzimuthEnd = double.Parse(txt_AzimuthEnd.Text.ToString());
this.Long = double.Parse(txt_Long.Text.ToString());
this.Lat = double.Parse(txt_Lat.Text.ToString());
this.ListRadars = ListRadars;
this.numOfRadars = numOfRadars;
this.numOfRadars++;
Radar RadarTemp = new Radar(numOfRadars, this.AzimuthStart, this.AzimuthEnd, this.Long, this.Lat, 1, 1);
this.ListRadars.Add(RadarTemp);
MapDrawManager.Instance.Draw(RadarTemp);
}
}
The error : Inconsistent accessibility : parameter type 'System.Collections.Generic.List' is less accessible than method 'MapSample.Forms.CreatRadar(double,double,double,double,int,System.Collections.Generic.List)'
Upvotes: 0
Views: 114
Reputation: 3806
Is the MapSample.Radar class a public class or an internal class? If so, consider changing the internal modifier of this class and makes sure it says "public class MapSample.Radar". You must change additional types into public as required if you can use them from the other WPF app. Or you can also change the assemblies to a friend assembly for the other WPF app by setting the InternalsVisibleTo attribute in AssemblyInfo file.
More info here about friend assemblies here and how to strong name sign assemblies (note that inside Visual Studio it is also possible set up the signing of assemblies such that the sn command does not have to be run from a command line): How to declare a friend assembly?
Upvotes: 0
Reputation: 5797
Your class MapSample.Radar seems not to be public. That is necessary because it is used in the public function CreatRadar.
Upvotes: 1