当前位置: 首页>>代码示例>>C#>>正文


C# Issue.AddPin方法代码示例

本文整理汇总了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
                }
            }
        }
开发者ID:Dessix,项目名称:TUM.CMS.VPLControl,代码行数:80,代码来源:IssueNode.cs


注:本文中的Issue.AddPin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。