本文整理汇总了C#中Issue.AddPin方法的典型用法代码示例。如果您正苦于以下问题:C# Issue.AddPin方法的具体用法?C# Issue.AddPin怎么用?C# Issue.AddPin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Issue
的用法示例。
在下文中一共展示了Issue.AddPin方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IssueControlOnBaseButtonClicked
private void IssueControlOnBaseButtonClicked(object sender, EventArgs eventArgs)
{
var issue = new Issue();
if (InputPorts[0].Data == null || InputPorts[1].Data == null || InputPorts[2].Data == null) return;
// Common Information
issue.CreatedAt = DateTime.Now;
issue.Author = _controller.IntBase.APICore.UserName;
issue.Id = Guid.NewGuid();
// User Control Stuff
issue.Description = _issueControl.DescriptionTextBox.Text;
var teamMember = _issueControl.ResponsibleUserComboBox.SelectedItem as TeamMember;
if (teamMember != null)
issue.Responsible = teamMember.User;
var project = InputPorts[0].Data as Project;
// Create the Issue
if (project != null)
{
issue.ProjectId = project.Id;
_controller.IntBase.APICore.CreateIssue(issue, project.Id);
}
Issue createdIssue = null;
// Download the Issue
if (project == null) return;
foreach (var item in _controller.IntBase.APICore.GetIssues(project.Id).Where(item => item.Id == issue.Id))
{
createdIssue = item;
}
// Screenshot Stuff
var image = RenderFrameworkElement(InputPorts[2].ConnectedConnectors[0].StartPort.ParentNode);
var encoder = new JpegBitmapEncoder();
var photolocation = _controller.IntBase.UserDirectory + Guid.NewGuid() + ".jpg"; //file name
encoder.Frames.Add(BitmapFrame.Create(image));
using (var filestream = new FileStream(photolocation, FileMode.Create))
encoder.Save(filestream);
var fs = File.OpenRead(photolocation);
var bytes = new byte[fs.Length];
fs.Read(bytes, 0, Convert.ToInt32(fs.Length));
try
{
if (createdIssue != null)
createdIssue.AddAttachment(photolocation, bytes);
}
catch (Exception)
{
// ignored
}
// Pin Stuff
if (InputPorts[1].Data.GetType() != typeof (List<GenericElement>)) return;
var genericElements = InputPorts[1].Data as List<GenericElement>;
if (genericElements == null) return;
foreach (var item in genericElements)
{
var pin = new Pin
{
ObjectId = item.Id
};
try
{
issue.AddPin(pin);
}
catch (Exception)
{
// ignored
}
}
}