本文整理汇总了C#中Station类的典型用法代码示例。如果您正苦于以下问题:C# Station类的具体用法?C# Station怎么用?C# Station使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Station类属于命名空间,在下文中一共展示了Station类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddRef
/// <summary>
/// Create and remember a reference to an Instance.
/// </summary>
/// <param name="instance"></param>
/// <param name="station">station to which this instance belongs</param>
/// <returns>new instance reference</returns>
public InstanceRef AddRef(Instance instance, Station station)
{
long id = NextId();
InstanceRef iRef = new InstanceRefImpl(id, instance, station);
refs.Add(id, iRef);
return iRef;
}
示例2: setUp
public void setUp()
{
station = new Station();
station.Input = Inputs.Ant_Two;
station.VirtualChannel = 67;
}
示例3: TestHandoverEventActionCallHandover
public void TestHandoverEventActionCallHandover()
{
int dropped = 0;
int createdhandover = 0;
int createdend = 0;
var data = new CallData( 1, 5, 20, 0 );
var tostation = new Station( 1, 0, 10, 10 );
var fromstation = new Station( 1, 0, 0, 10 );
fromstation.ClaimChannel( true );
var e = new HandoverEvent(
fromstation,
tostation,
() => { dropped++; },
( d, cd ) => { createdend++; },
( d, cd ) =>
{
createdhandover++;
Assert.AreEqual( data, cd );
Assert.AreEqual( (uint) 15, d );
},
5,
data );
e.Action();
Assert.AreEqual( 0, dropped );
Assert.AreEqual( 0, createdend );
Assert.AreEqual( 1, createdhandover );
}
示例4: CreateDeviceCollection
/// <summary>
///
/// </summary>
/// <param name="db"></param>
/// <param name="s"></param>
private static void CreateDeviceCollection(DB db, Station s)
{
DataTable tbl = db.GetDeviceDataTable ( s.ID );
foreach (DataRow row in tbl.Rows)
{
Device d = new Device(s);
d.ID = Convert.ToInt32(row["DeviceID"]);
d.Name = row["name"].ToString().Trim();
s.DeviceCollection.Add(d);
//if (_request.IsReady())
if (_client.IsRequestReady())
{
object state = new object[] {
d.Station.Group.Name ,
d.Station.Name ,
d.Name };
//RequestResult r = _request.Request("", RequestNameEnum.GetDeviceID, state);
RequestResult r = _client.ExecuteRequestDeviceID(state);
if (r.ResultEnum == RequestResultEnum.OK)
{
int remoteDeviceID = (int)r.Result;
d.RemoteID = remoteDeviceID;
}
}
}
}
示例5: AddStation
public Task AddStation(Station station)
{
var connection = _context.CreateConnection();
var findedStation=connection.GetAsync<Station>(station.Id);
if (findedStation == null) return Task.CompletedTask;
return connection.InsertAsync(station);
}
示例6: TryGrowHub
bool TryGrowHub(Station v, bool useHalfEdgesAsIdealR) {
double oldR = v.Radius;
double allowedRadius = CalculateAllowedHubRadius(v);
Debug.Assert(allowedRadius > 0);
if (v.Radius >= allowedRadius)
return false;
double idealR = useHalfEdgesAsIdealR ?
CalculateIdealHubRadiusWithAdjacentEdges(metroGraphData, bundlingSettings, v) :
v.cachedIdealRadius;
Debug.Assert(idealR > 0);
if (v.Radius >= idealR)
return false;
double step = 0.05;
double delta = step * (idealR - v.Radius);
if (delta < 1.0)
delta = 1.0;
double newR = Math.Min(v.Radius + delta, allowedRadius);
if (newR <= v.Radius)
return false;
v.Radius = newR;
return true;
}
示例7: GetSites
public List<Station> GetSites(string locationText)
{
var path = string.Format(
"sl/realtid/GetSite.json?stationSearch={0}&key=72c26d46c3efc6d5158d1dfc89b5f6fd", locationText);
var response = this.ApiClient.GetAsync(path).Result;
if (!response.IsSuccessStatusCode)
{
return new List<Station>();
}
var result = response.Content.ReadAsStringAsync().Result;
dynamic test = JsonConvert.DeserializeObject(result);
var siteList = new List<Station>();
var siteTest = test.Hafas.Sites.Site;
if (siteTest.GetType().ToString() == "Newtonsoft.Json.Linq.JObject")
{
var site = new Station { Name = siteTest.Name, Id = siteTest.Number };
siteList.Add(site);
}
else
{
foreach (var item in siteTest)
{
var site = new Station { Name = item.Name, Id = item.Number };
siteList.Add(site);
}
}
return siteList;
}
示例8: SetStations
public void SetStations(Station[] InitialStationList)
{
this.InitialStationList = InitialStationList;
FilterStations = InitialStationList.OrderByDescending(o => o.LastSeenDate).ToArray();
StationList.VirtualListSize = FilterStations.Length;
}
示例9: NPCCorporation
/// <summary>
/// Initializes a new instance of the <see cref="NPCCorporation"/> class.
/// </summary>
/// <param name="station">The station.</param>
/// <exception cref="System.ArgumentNullException">station</exception>
public NPCCorporation(Station station)
{
station.ThrowIfNull(nameof(station));
ID = station.CorporationID;
Name = station.CorporationName;
}
示例10: getStations
public List<Station> getStations(Inputs input)
{
List<Station> ret = new List<Station>();
RegistryManager registry = new RegistryManager();
byte[] value = registry.getStations(input);
int segmentLength = 40;
int stationEndpoint = segmentLength * registry.getStationCount(input);
for (int i = 8; i < stationEndpoint; i += segmentLength)
{
ArraySegment<byte> segment = new ArraySegment<byte>(value, i, segmentLength);
Station s = new Station();
s.Input = input;
s.PhysicalChannel = BitConverter.ToInt16(segment.Array, segment.Offset + (int)StationBytePositions.PhysicalChannel);
s.VirtualChannel = BitConverter.ToInt16(segment.Array, segment.Offset + (int)StationBytePositions.VirtualChannel);
s.SubChannel = segment.Array[segment.Offset + (int)StationBytePositions.SubChannel];
// TODO: (KJM 02/21/06) Figure out how to treat 0xFF as -1 rather than 255.
int minorChannel = segment.Array[segment.Offset + (int)StationBytePositions.MinorChannel];
if (255 == minorChannel)
{
minorChannel = -1;
}
s.MinorChannel = minorChannel;
// TODO: (KJM 02/21/06) Figure out a way of actually reading in the name without dying on channels without names.
//s.Name = System.Text.Encoding.ASCII.GetString(segment.Array, segment.Offset + 16, 5);
ret.Add(s);
}
return ret;
}
示例11: SaveTimetables
/// <summary>
/// Create html file with information about timetable and save it
/// </summary>
/// <param name="Path">Where html file should be saved</param>
/// <param name="station">Station</param>
public void SaveTimetables(string Path, Station station)
{
FileStream fs = new FileStream(Path, FileMode.Create);
XDocument document = new XDocument();
document.AddFirst(new XElement("html"));
document.Root.Add(new XElement("head",
new XElement("title", station.Name)));
XElement body = new XElement("body");
XElement div = new XElement("div");
foreach (Timetable tt in station)
{
XElement inner = new XElement("div", new XAttribute("style", "width:800px;"));
inner.Add(new XElement("div", tt.FirstStation + " - " + tt.LastStation, new XAttribute("style", "border:solid; float:left; width:400px; heigth:20px;"), new XAttribute("align", "center")),
new XElement("div", tt.TimeOfArrival.ToString() + " - " + tt.TimeOfDeparture.ToString(), new XAttribute("style", "border:solid; float:left; width:150px; heigth:20px;"), new XAttribute("align", "center")),
new XElement("div", tt.FreqType, new XAttribute("style", "border:solid; float:left; width:150px; heigth:20px;"), new XAttribute("align", "center")),
new XElement("br"));
div.Add(inner);
}
body.Add(div);
document.Root.Add(body);
document.Save(fs);
fs.Close();
}
示例12: StationIsCreatedAtProperPosition
public void StationIsCreatedAtProperPosition()
{
var st = new Station( 0, 0, 2, 1 );
Assert.AreEqual( (uint) 2, st.StartPosition );
Assert.AreEqual( (uint) 3, st.EndPosition );
}
示例13: getLineTypeTo
public Line.Type getLineTypeTo(Station station)
{
if ((line() == null || station.getLine() != line()))
return Line.Type.None;
else
return line().type;
}
示例14: AddExistingStationTest
public void AddExistingStationTest()
{
Administration admin = new Administration();
Station station = new Station("station1");
admin.Add(station);
Assert.AreEqual(station, admin.Add(station));
}
示例15: AddedStationCanBeFoundTest
public void AddedStationCanBeFoundTest()
{
Administration admin = new Administration();
Station station = new Station("station1");
admin.Add(station);
Station foundStation = admin.FindStation("station1");
Assert.AreEqual(foundStation, station);
}