本文整理汇总了C#中Link类的典型用法代码示例。如果您正苦于以下问题:C# Link类的具体用法?C# Link怎么用?C# Link使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Link类属于命名空间,在下文中一共展示了Link类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenerateGrid
private void GenerateGrid()
{
CompositeLink composLink = new CompositeLink(new PrintingSystem());
PrintableComponentLink pcLink1 = new PrintableComponentLink();
Link linkMainReport = new Link();
Link linkGrid1Report = new Link();
linkGrid1Report.CreateDetailArea += new CreateAreaEventHandler(linkGrid1Report_CreateDetailArea);
// Assign the controls to the printing links.
pcLink1.Component = this.ThirdGridIncomeAnalysis;
// Populate the collection of links in the composite link.
// The order of operations corresponds to the document structure.
composLink.Links.Add(linkGrid1Report);
composLink.Links.Add(pcLink1);
composLink.Links.Add(linkMainReport);
// Create the report and show the preview window.
//composLink.PrintingSystem.PreviewFormEx.AutoScale = true;
composLink.PrintingSystem.PageSettings.Landscape = true;
composLink.CreateDocument(printingSystem1);
printingSystem1.PreviewFormEx.PrintingSystem.PageSettings.LeftMargin = 0;
printingSystem1.PreviewFormEx.PrintingSystem.PageSettings.TopMargin = 30;
//printingSystem1.PreviewFormEx.AutoScale = true;
printingSystem1.PageSettings.Landscape = true;
printingSystem1.PreviewFormEx.ForeColor = System.Drawing.Color.Black;
printingSystem1.PreviewFormEx.Owner = this;
printingSystem1.PreviewFormEx.PrintingSystem.Print();
}
示例2: Calculate
/// <summary>
/// Calculation method.
/// </summary>
/// <param name="chain">
/// Source sequence.
/// </param>
/// <param name="link">
/// Link of intervals in chain.
/// </param>
/// <returns>
/// Average remoteness dispersion <see cref="double"/> value.
/// </returns>
public double Calculate(Chain chain, Link link)
{
List<int> intervals = new List<int>();
for (int i = 0; i < chain.Alphabet.Cardinality; i++)
{
intervals.AddRange(chain.CongenericChain(i).GetIntervals(link).ToList());
}
List<int> uniqueIntervals = intervals.Distinct().ToList();
List<int> intervalsCounts = new List<int>();
for (int i = 0; i < uniqueIntervals.Count; i++)
{
var currentInterval = uniqueIntervals[i];
intervalsCounts.Add(intervals.Count(interval => interval == currentInterval));
}
double result = 0;
double gDelta = geometricMean.Calculate(chain, link);
int n = (int)intervalsCount.Calculate(chain, link);
for (int i = 0; i < uniqueIntervals.Count; i++)
{
int nk = intervalsCounts[i];
double kDelta = uniqueIntervals[i];
double centeredRemoteness = Math.Log(kDelta, 2) - Math.Log(gDelta, 2);
result += nk == 0 ? 0 : centeredRemoteness * centeredRemoteness * nk / n;
}
return result;
}
示例3: DeserializeLink
public ILink DeserializeLink(IConnection connection, SerializationInfo info)
{
Link link = new Link();
string sourceEmployeeId = string.Empty;
string targeteEmployeeId = string.Empty;
if (info["SourceEmployeeId"] != null)
sourceEmployeeId = info["SourceEmployeeId"].ToString();
if (info["TargetEmployeeId"] != null)
targeteEmployeeId = info["TargetEmployeeId"].ToString();
if (info["IsVisible"] != null)
link.IsVisible = bool.Parse(info["IsVisible"].ToString());
if (info["Text"] != null)
link.Text = info["Text"].ToString();
if (info["MainColor"] != null)
link.MainColor = info["MainColor"].ToString();
var sourceModel = this.deserializedEmployees.FirstOrDefault(x => x.GetId().Equals(sourceEmployeeId));
if (sourceModel != null)
{
link.Source = sourceModel;
}
var targetModel = this.deserializedEmployees.FirstOrDefault(x => x.GetId().Equals(targeteEmployeeId));
if (targetModel != null)
{
link.Target = targetModel;
}
return link;
}
开发者ID:netintellect,项目名称:PluralsightSpaJumpStartFinal,代码行数:30,代码来源:ObservableGraphSource.Serialization.cs
示例4: Piece
public Piece (int start, int length, string text, Link link)
{
this.start = start;
this.length = length;
this.text = text;
this.link = link;
}
示例5: Calculate
/// <summary>
/// Calculation method.
/// </summary>
/// <param name="firstChain">
/// The first chain.
/// </param>
/// <param name="secondChain">
/// The second chain.
/// </param>
/// <param name="link">
/// The link.
/// </param>
/// <returns>
/// The <see cref="double"/>.
/// </returns>
public double Calculate(CongenericChain firstChain, CongenericChain secondChain, Link link)
{
var partialAccordanceCalculator = new PartialComplianceDegree();
var firstResult = partialAccordanceCalculator.Calculate(firstChain, secondChain, link);
var secondResult = partialAccordanceCalculator.Calculate(secondChain, firstChain, link);
return Math.Sqrt(firstResult * secondResult);
}
示例6: CutLink
private static void CutLink(Link n)
{
answer = n.Node1 + " " + n.Node2;
found = true;
links.RemoveAll(x=> x.Node1 == n.Node1 && x.Node2 == n.Node2);
links.RemoveAll(x=> x.Node1 == n.Node2 && x.Node2 == n.Node1);
}
示例7: CanUseRegisterExtensionMethod
public void CanUseRegisterExtensionMethod()
{
var curie = new CuriesLink("aap", "http://www.helpt.com/{?rel}");
var builder = Hypermedia.CreateBuilder();
var selfLink = new Link<ProductRepresentation>("product", "http://www.product.com?id=1");
var link2 = new Link("related", "http://www.related.com");
var link3 = curie.CreateLink<CategoryRepresentation>("category", "http://www.category.com");
builder.Register(selfLink, link2, link3);
var config = builder.Build();
// arrange
var mediaFormatter = new JsonHalOutputFormatter(config) { };
var type = representation.GetType();
var httpContext = new Mock<HttpContext>();
var httpRequest = new DefaultHttpContext().Request;
httpContext.SetupGet(o => o.Request).Returns(httpRequest);
// act
using (var stream = new MemoryStream())
{
mediaFormatter.WriteResponseBodyAsync(new OutputFormatterWriteContext(httpContext.Object,
(s,e)=> new HttpResponseStreamWriter(s, e), type, representation));
//WriteToStreamAsync(type, representation, stream, content, null);
stream.Seek(0, SeekOrigin.Begin);
var serialisedResult = new StreamReader(stream).ReadToEnd();
// assert
Approvals.Verify(serialisedResult);
}
}
示例8: GetLinks
public List<Link> GetLinks()
{
List<Link> lstLinks = new List<Link>();
DbCommand oDbCommand = DbProviderHelper.CreateCommand("SELECTLinks",CommandType.StoredProcedure);
DbDataReader oDbDataReader = DbProviderHelper.ExecuteReader(oDbCommand);
while (oDbDataReader.Read())
{
Link oLink = new Link();
oLink.LinkId = Convert.ToInt32(oDbDataReader["LinkId"]);
oLink.LinkGuid = (Guid) oDbDataReader["LinkGuid"];
oLink.LinkName = Convert.ToString(oDbDataReader["LinkName"]);
if(oDbDataReader["LinkUrl"] != DBNull.Value)
oLink.LinkUrl = Convert.ToString(oDbDataReader["LinkUrl"]);
if(oDbDataReader["Remark"] != DBNull.Value)
oLink.Remark = Convert.ToString(oDbDataReader["Remark"]);
if(oDbDataReader["Logo"] != DBNull.Value)
oLink.Logo = Convert.ToString(oDbDataReader["Logo"]);
oLink.Rank = Convert.ToInt32(oDbDataReader["Rank"]);
oLink.DateCreated = Convert.ToDateTime(oDbDataReader["DateCreated"]);
lstLinks.Add(oLink);
}
oDbDataReader.Close();
return lstLinks;
}
示例9: AddLinkText
private void AddLinkText(SvgDocument document, Link link)
{
if (link.Label.Text.Trim() == "") return;
Style style = new Style();
//Set up text object
PointF location = link.GetLabelLocation();
location = OffsetPoint(location, link.Label.Offset);
location = OffsetPoint(location, link.Rectangle.Location);
Text text = new Text();
text.Label = link.Label;
text.LayoutRectangle = new RectangleF(location, new SizeF());
//Get style
string classId = null;
classId = document.AddClass(text.GetStyle());
//Create fragment and add to document
XmlDocumentFragment frag = null;
XmlNode newElementNode = null;
frag = document.CreateDocumentFragment();
frag.InnerXml = text.ExtractText(0, 0, link.Key + "Text");
frag.FirstChild.Attributes.GetNamedItem("class").InnerText = classId;
newElementNode = document.ContainerNode.AppendChild(frag);
}
示例10: Add0
void Add0(Link a)
{
if (head==null)
head = last = a;
else
last = last.next = a;
}
示例11: GetLink
public Link GetLink(int LinkId)
{
Link oLink = new Link();
DbCommand oDbCommand = DbProviderHelper.CreateCommand("SELECTLink",CommandType.StoredProcedure);
oDbCommand.Parameters.Add(DbProviderHelper.CreateParameter("@LinkId",DbType.Int32,LinkId));
DbDataReader oDbDataReader = DbProviderHelper.ExecuteReader(oDbCommand);
while (oDbDataReader.Read())
{
oLink.LinkId = Convert.ToInt32(oDbDataReader["LinkId"]);
oLink.LinkGuid = (Guid) oDbDataReader["LinkGuid"];
oLink.LinkName = Convert.ToString(oDbDataReader["LinkName"]);
if(oDbDataReader["LinkUrl"] != DBNull.Value)
oLink.LinkUrl = Convert.ToString(oDbDataReader["LinkUrl"]);
if(oDbDataReader["Remark"] != DBNull.Value)
oLink.Remark = Convert.ToString(oDbDataReader["Remark"]);
if(oDbDataReader["Logo"] != DBNull.Value)
oLink.Logo = Convert.ToString(oDbDataReader["Logo"]);
oLink.Rank = Convert.ToInt32(oDbDataReader["Rank"]);
oLink.DateCreated = Convert.ToDateTime(oDbDataReader["DateCreated"]);
}
oDbDataReader.Close();
return oLink;
}
示例12: Save
public ActionResult Save(Link links)
{
var data = GetData();
data.Add(links);
_pluginContentService.SavePluginData(PluginId, data);
return RedirectToAction("Edit");
}
示例13: CreateBufferSizeChart
public void CreateBufferSizeChart(ZedGraphControl zgc, Link[] list)
{
GraphPane myPane = zgc.GraphPane;
System.Drawing.Color[] GraphColors = { Color.Red, Color.Blue, Color.Green, Color.Orange, Color.Purple, Color.Brown };
// Set the titles and axis labels
myPane.Title.Text = "";
myPane.XAxis.Title.Text = "Time, ms";
myPane.YAxis.Title.Text = "Buffer size (packets)";
/*myPane.Legend.Position = LegendPos.Float;
myPane.Legend.Location = new Location(0.95, 0.15, CoordType.PaneFraction,
AlignH.Right, AlignV.Top);
myPane.Legend.FontSpec.Size = 10;*/
myPane.Legend.Position = LegendPos.InsideTopLeft;
// Add a curve
for (int k = 0; k < list.Length; k++)
{
LineItem curve = myPane.AddCurve(list[k].name, list[k].buffer_size_list, GraphColors[k % 6], SymbolType.None);
curve.Line.Width = 2.0F;
curve.Line.IsAntiAlias = true;
curve.Symbol.Fill = new Fill(Color.White);
curve.Symbol.Size = 7;
}
// Fill the axis background with a gradient
//myPane.Chart.Fill = new Fill(Color.White, Color.FromArgb(255, Color.ForestGreen), 45.0F);
// Offset Y space between point and label
// NOTE: This offset is in Y scale units, so it depends on your actual data
//const double offset = 1.0;
// Leave some extra space on top for the labels to fit within the chart rect
myPane.YAxis.Scale.MaxGrace = 0.2;
// Calculate the Axis Scale Ranges
zgc.AxisChange();
}
示例14: Artist
public Artist(Link link, SessionBase session, bool browse = false)
{
this.Handle = libspotify.sp_link_as_artist(link.Handle);
this._session = session;
Init(browse);
}
示例15: Main
static void Main(string[] args)
{
string[] inputs = Console.ReadLine().Split(' ');
int N = int.Parse(inputs[0]); // the total number of nodes in the level, including the gateways
int L = int.Parse(inputs[1]); // the number of links
int E = int.Parse(inputs[2]); // the number of exit gateways
for (int i = 0; i < L; i++)
{
links.Add(new Link(Console.ReadLine().Split(' ')));
}
for (int i = 0; i < E; i++)
{
EditType(int.Parse(Console.ReadLine()), Type.EXIT);
}
// game loop
while (true)
{
// The index of the node on which the Skynet agent is positioned this turn
EditType(int.Parse(Console.ReadLine()), Type.SKY);
// Write an action using Console.WriteLine()
last = GetOne();
Console.WriteLine(last.ToString()); // Example: 0 1 are the indices of the nodes you wish to sever the link between
}
}