dyt*_*him 29 c# wpf visual-studio-2010
我对Visual Studio 2010已经发生了很长一段时间的烦恼.我有一个类文件,我将VS保存为类型"组件",我无法辨别.如果我忘记并尝试打开文件,它会查找不存在的设计器.
我查看了Google并发现了VS 2005的一些类似问题,但问题似乎与从GUI组件类(listbox,combobox等)派生有关.这个课不这样做.
该文件是GpsUtilities.cs.它如下,出现在的csproj文件SubType中Component.没有其他对该文件的引用,即没有任何声称它DependentUpon.
<Compile Include="Utilities\GpsUtilities.cs">
<SubType>Component</SubType>
</Compile>
Run Code Online (Sandbox Code Playgroud)
即使我删除SubType标记,即使我明确地将其设置为Code替代Component,它仍然将其保存为SubType的Component.
这是类结构(所有代码都被删除).正如我所说,它不会继承,甚至不导入与GUI相关的任何名称空间.
using System;
using System.ComponentModel;
using System.IO.Ports;
using System.Text.RegularExpressions;
using System.Timers;
using System.Xml.Serialization;
namespace AppNamespace
{
public class GpsUtil : INotifyPropertyChanged
{
public GpsUtil() { }
public static GpsUtil CreateInstance() { }
public bool IsGpsReady { get; }
public GPSPort GpsSerialPort { get; private set; }
public Timer GpsTimer { get; set; }
private CircularArray<GpsPositionData> PositionBuffer { get; set; }
private GpsPositionData m_GpsCurLoc;
public GpsPositionData MyLocation { }
public string GpggaPattern { get; set; }
public Regex GpggaRegEx { get; set; }
public GpsPositionData GpsPosDataFromRegExMatch(Match gpsRegExMatch) { }
public void SetGpsPosition(double latitude, double longitude) { }
private void gpsTimer_Elapsed(object sender, ElapsedEventArgs e) { }
private bool InitializeGpsPort() { }
public bool TestGpsPort() { }
public double ComputeSquaredDistance(double startLat, double startLon, double endLat, double endLon) { }
public event PropertyChangedEventHandler PropertyChanged;
}
public class GPSPort : SerialPort
{
public GPSPort(string portName, int baudRate = 9600) : base(portName, baudRate)
{
}
private bool TestResult { get; set; }
public bool Test(int interval = 3000, bool leavePortOpen = false) {}
}
public enum GpsFixQuality { Invalid = 0, GpsFix = 1, DgpsFix = 2 }
[Serializable]
public class GpsPositionData
{
public GpsPositionData() { }
public GpsPositionData(double latitude, double longitude) {}
public override string ToString() {}
public bool IsCloseTo(GpsPositionData otherPoint, double tolerance = 0.0001) {}
public GpsPositionData(DateTime time, double latitude, double longitude, GpsFixQuality fixQuality, int numberOfSatellites, double hdop, double altitude, double geodialSeparation, int ageOfDgps, string dgpsRefStationId){}
[XmlIgnore]
public DateTime Time { get; private set; }
[XmlElement("Latitude", typeof(double))]
public double Latitude { get; set; }
[XmlElement("Longitude", typeof(double))]
public double Longitude { get; set; }
[XmlIgnore]
public GpsFixQuality FixQuality { get; private set; }
[XmlIgnore]
public int NumberOfSatellites { get; private set; }
[XmlIgnore]
public double Hdop { get; private set; }
[XmlIgnore]
public double Altitude { get; private set; }
[XmlIgnore]
public double GeodialSeparation { get; private set; }
[XmlIgnore]
public int AgeOfDgps { get; private set; }
[XmlIgnore]
public string DgpsRefStationId { get; private set; }
}
}
Run Code Online (Sandbox Code Playgroud)
提前致谢.
Ken*_*art 15
猜测一下,我会说这是由于你的GPSPort课程延伸SerialPort而来的Component.尝试删除它(或将其移动到单独的文件中),看看它是否解决了问题.
| 归档时间: |
|
| 查看次数: |
4795 次 |
| 最近记录: |