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


C# ItemState类代码示例

本文整理汇总了C#中ItemState的典型用法代码示例。如果您正苦于以下问题:C# ItemState类的具体用法?C# ItemState怎么用?C# ItemState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ItemState类属于命名空间,在下文中一共展示了ItemState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OpenPullRequestMonitor

        public OpenPullRequestMonitor(TimeSpan timespan, ItemState state=ItemState.Open)
        {
            var pollingPeriod = timespan.TotalMilliseconds;
            _timer = new Timer(pollingPeriod) {AutoReset = true};
            _timer.Elapsed += (sender, eventArgs) =>
            {
                var prs = 0;
                Task.Run(async () =>
                {
                    var requests = await PollGitHub(state);
                    prs = requests.Count;
                    _pr = requests.FirstOrDefault();
                    Console.WriteLine("Polled PR count:" + prs);
                }).Wait();

                if (prs > OpenPrs)
                {
                    var soundPlayer = new SoundPlayer("fanfare3.wav");
                    soundPlayer.PlaySync();
                    if (_pr != null)
                    {
                        var speech = new SpeechSynthesizer();
                        speech.Speak("New pull request.");
                        speech.Speak(_pr.Title);
                    }

                    OpenPrs = prs;
                }
                else if (prs < OpenPrs)
                {
                    OpenPrs = prs;
                }
            };
        }
开发者ID:awcoats,项目名称:PRNotifier,代码行数:34,代码来源:OpenPullRequestMonitor.cs

示例2: PullRequest

 public PullRequest(Uri url, Uri htmlUrl, Uri diffUrl, Uri patchUrl, Uri issueUrl, Uri statusesUrl, int number, ItemState state, string title, string body, DateTimeOffset createdAt, DateTimeOffset updatedAt, DateTimeOffset? closedAt, DateTimeOffset? mergedAt, GitReference head, GitReference @base, User user, User assignee, bool? mergeable, User mergedBy, int comments, int commits, int additions, int deletions, int changedFiles)
 {
     Url = url;
     HtmlUrl = htmlUrl;
     DiffUrl = diffUrl;
     PatchUrl = patchUrl;
     IssueUrl = issueUrl;
     StatusesUrl = statusesUrl;
     Number = number;
     State = state;
     Title = title;
     Body = body;
     CreatedAt = createdAt;
     UpdatedAt = updatedAt;
     ClosedAt = closedAt;
     MergedAt = mergedAt;
     Head = head;
     Base = @base;
     User = user;
     Assignee = assignee;
     Mergeable = mergeable;
     MergedBy = mergedBy;
     Comments = comments;
     Commits = commits;
     Additions = additions;
     Deletions = deletions;
     ChangedFiles = changedFiles;
 }
开发者ID:cloudRoutine,项目名称:octokit.net,代码行数:28,代码来源:PullRequest.cs

示例3: GetIcon

 public static Icon GetIcon(string path, ItemType type, IconSize size, ItemState state)
 {
     var flags = (uint)(Interop.SHGFI_ICON | Interop.SHGFI_USEFILEATTRIBUTES);
     var attribute = (uint)(object.Equals(type, ItemType.Folder) ? Interop.FILE_ATTRIBUTE_DIRECTORY : Interop.FILE_ATTRIBUTE_FILE);
     if (object.Equals(type, ItemType.Folder) && object.Equals(state, ItemState.Open))
     {
         flags += Interop.SHGFI_OPENICON;
     }
     if (object.Equals(size, IconSize.Small))
     {
         flags += Interop.SHGFI_SMALLICON;
     }
     else
     {
         flags += Interop.SHGFI_LARGEICON;
     }
     var shfi = new SHFileInfo();
     var res = Interop.SHGetFileInfo(path, attribute, out shfi, (uint)Marshal.SizeOf(shfi), flags);
     if (object.Equals(res, IntPtr.Zero)) throw Marshal.GetExceptionForHR(Marshal.GetHRForLastWin32Error());
     try
     {
         Icon.FromHandle(shfi.hIcon);
         return (Icon)Icon.FromHandle(shfi.hIcon).Clone();
     }
     catch
     {
         throw;
     }
     finally
     {
         Interop.DestroyIcon(shfi.hIcon);
     }
 }
开发者ID:rickflagg,项目名称:public,代码行数:33,代码来源:ShellManager.cs

示例4: GetImageSource

 public static ImageSource GetImageSource(string directory, Size size, ItemState folderType)
 {
     using (var icon = ShellManager.GetIcon(directory, ItemType.Folder, IconSize.Large, folderType))
     {
         return Imaging.CreateBitmapSourceFromHIcon(icon.Handle, System.Windows.Int32Rect.Empty, BitmapSizeOptions.FromWidthAndHeight((int)size.Width, (int)size.Height));
     }
 }
开发者ID:jonbonne,项目名称:OCTGN,代码行数:7,代码来源:ShellManager.cs

示例5: Item

 public Item(string name, string description, Texture2D image)
 {
     this.name = name;
     this.description = description;
     this.image = image;
     quantity = 1;
     state = ItemState.Positioned;
 }
开发者ID:VicBoss,项目名称:KR,代码行数:8,代码来源:Item.cs

示例6: PollGitHub

 public async Task<IReadOnlyList<PullRequest>> PollGitHub(ItemState state = ItemState.Open)
 {
     var gitHubClient = new GitHubClient(new ProductHeaderValue("CalPEATS"));
     gitHubClient.Credentials = new Credentials("***email**", "******");
     var openPullRequests = new PullRequestRequest {State = state };
     var prs = await gitHubClient.PullRequest.GetAllForRepository("calicosol", "CalPEATS", openPullRequests);
     return prs;
 }
开发者ID:awcoats,项目名称:PRNotifier,代码行数:8,代码来源:OpenPullRequestMonitor.cs

示例7: SetupSearch

 public static void SetupSearch(this Mock<IGitHubClient> github, ItemState state, params Issue[] result)
 {
     github.Setup(x => x.Search.SearchIssues(It.Is<SearchIssuesRequest>(s => s.State == state)))
         .Returns(Task.FromResult(new SearchIssuesResult
         {
             Items = result.ToList(),
             TotalCount = result.Length
         }));
 }
开发者ID:LeCantaloop,项目名称:OctoHook,代码行数:9,代码来源:MockExtensions.cs

示例8: TasklistItem

 public TasklistItem(string taskId, string name, ItemState state, int total, int completed)
 {
     this.TaskId = taskId;
     this.Name = name;
     this.Description = String.Empty;
     this.State = state;
     this.Total = total;
     this.Completed = completed;
 }
开发者ID:matthiase,项目名称:odeo-mobile,代码行数:9,代码来源:TasklistItem.cs

示例9: SubItemPaintEventArgs

 /// <summary>Create <see cref="ItemPaintEventArgs"/>.</summary>
 /// <param name="graphics">Graphics surface to draw the item on.</param>
 /// <param name="clipRectangle">Clipping rectangle.</param>
 /// <param name="bounds">Rectangle that represents the bounds of the item that is being drawn.</param>
 /// <param name="index">Index value of the item that is being drawn.</param>
 /// <param name="state">State of the item being drawn.</param>
 /// <param name="hoveredPart">Hovered part of the item.</param>
 /// <param name="hostControlFocused">Host control is focused.</param>
 public SubItemPaintEventArgs(
     Graphics graphics, Rectangle clipRectangle, Rectangle bounds, int index,
     ItemState state, int hoveredPart, bool hostControlFocused,
     int columnIndex, CustomListBoxColumn column)
     : base(graphics, clipRectangle, bounds, index, state, hoveredPart, hostControlFocused)
 {
     _columnIndex = columnIndex;
     _column = column;
 }
开发者ID:Kuzq,项目名称:gitter,代码行数:17,代码来源:SubItemPaintEventArgs.cs

示例10: GetImageSource

 public static ImageSource GetImageSource(string directory, ItemState folderType)
 {
     try
     {
         return GetImageSource(directory, new Size(16, 16), folderType);
     }
     catch
     {
         throw;
     }
 }
开发者ID:DmytroMelnyk,项目名称:MyCommander,代码行数:11,代码来源:FolderManager.cs

示例11: DrawButton

        public virtual void DrawButton(Graphics g, Rectangle rectangle, string text, Font font, StringFormat fmt, ItemState state, bool hasBorder, bool enabled)
        {
            float angle = 90;

            if (rectangle.Width > 0 && rectangle.Height > 0)
            {
                if (!enabled)
                {
                    using (Brush backBrush = new LinearGradientBrush(rectangle, Office2003Colors.Default[Office2003Color.Button1], Office2003Colors.Default[Office2003Color.Button2], angle))
                    {
                        g.FillRectangle(backBrush, rectangle);
                    }
                }
                else
                {
                    switch (state)
                    {
                        case ItemState.Normal:
                            using (Brush backBrush = new LinearGradientBrush(rectangle, Office2003Colors.Default[Office2003Color.Button1], Office2003Colors.Default[Office2003Color.Button2], angle))
                                g.FillRectangle(backBrush, rectangle);
                            break;
                        case ItemState.HotTrack:
                            using (Brush trackBrush = new LinearGradientBrush(rectangle, Office2003Colors.Default[Office2003Color.Button1Hot], Office2003Colors.Default[Office2003Color.Button2Hot], angle))
                                g.FillRectangle(trackBrush, rectangle);
                            break;
                        case ItemState.Open:
                        case ItemState.Pressed:
                            using (Brush trackBrush = new LinearGradientBrush(rectangle, Office2003Colors.Default[Office2003Color.Button1Pressed], Office2003Colors.Default[Office2003Color.Button2Pressed], angle))
                                g.FillRectangle(trackBrush, rectangle);
                            break;
                        default:
                            break;
                    }
                }

                if (!string.IsNullOrEmpty(text))
                {
                    if (enabled)
                    {
                        using (SolidBrush br = new SolidBrush(Office2003Colors.Default[Office2003Color.Text]))
                            g.DrawString(text, font, br, rectangle, fmt);
                    }
                    else
                    {
                        using (SolidBrush br = new SolidBrush(Office2003Colors.Default[Office2003Color.TextDisabled]))
                            g.DrawString(text, font, br, rectangle, fmt);
                    }
                }

                if(hasBorder)
                    DrawBorder(g, new Rectangle(rectangle.X, rectangle.Y, rectangle.Width - 1, rectangle.Height - 1), enabled);
            }
        }
开发者ID:HEskandari,项目名称:FarsiLibrary,代码行数:53,代码来源:FAPainterOffice2003.cs

示例12: Milestone

 public Milestone(Uri url, int number, ItemState state, string title, string description, User creator, int openIssues, int closedIssues, DateTimeOffset createdAt, DateTimeOffset? dueOn)
 {
     Url = url;
     Number = number;
     State = state;
     Title = title;
     Description = description;
     Creator = creator;
     OpenIssues = openIssues;
     ClosedIssues = closedIssues;
     CreatedAt = createdAt;
     DueOn = dueOn;
 }
开发者ID:alexgyori,项目名称:octokit.net,代码行数:13,代码来源:Milestone.cs

示例13: StateSwitch

        public static void StateSwitch(PointerEventData data, ItemState state,
		                               System.Action<PointerEventData> attachedAction,  
		                               System.Action<PointerEventData> attachedHighlightedAction,  
		                               System.Action<PointerEventData> draggingAction,  
		                               System.Action<PointerEventData> floatingAction,
		                               System.Action<PointerEventData> instantiateAction,
		                               System.Action<PointerEventData> noInstantiateAction)
        {
            switch (state)
            {
            case ItemState.Attached:
                if (attachedAction != null)
                {
                    attachedAction(data);
                }
                break;
            case ItemState.AttachedHighlighted:
                if (attachedHighlightedAction != null)
                {
                    attachedHighlightedAction(data);
                }
                break;
            case ItemState.Dragging:
                if (draggingAction != null)
                {
                    draggingAction(data);
                }
                break;
            case ItemState.Floating:
                if (floatingAction != null)
                {
                    floatingAction(data);
                }
                break;
            case ItemState.Instantiate:
                if (instantiateAction != null)
                {
                    instantiateAction(data);
                }
                break;
            case ItemState.NoInstantiate:
                if (noInstantiateAction != null)
                {
                    noInstantiateAction(data);
                }
                break;
            }
        }
开发者ID:rygo6,项目名称:VisualizationFramework-Unity,代码行数:48,代码来源:ItemUtility.cs

示例14: DrawItem

 public override void DrawItem(Graphics g, ImageListViewItem item, ItemState state, Rectangle bounds)
 {
     base.DrawItem(g, item, state, bounds);
     PhotoInfo p = item.Tag as PhotoInfo;
     if (ImageListView.View != View.Details && p != null && p.Flickr.Uploaded != null) {
         // Draw the image
         Image img = item.ThumbnailImage;
         if (img != null) {
             Size itemPadding = new Size(4, 4);
             Rectangle pos = GetSizedImageBounds(img, new Rectangle(bounds.Location + itemPadding, ImageListView.ThumbnailSize));
             Image overlayImage = Resource1.Uploaded;
             int w = Math.Min(overlayImage.Width, pos.Width);
             int h = Math.Min(overlayImage.Height, pos.Height);
             g.DrawImage(overlayImage, pos.Left, pos.Bottom - h, w, h);
         }
     }
 }
开发者ID:nikkilocke,项目名称:MyPicturesSync,代码行数:17,代码来源:FlickrInfoRenderer.cs

示例15: loadEventItemState

 public void loadEventItemState(ItemState state)
 {
     itemId = state.id;
     type = EVENT_TYPE;
     level = state.level;
     requiredItems = state.requiredItems;
     restrictedItems = state.restrictedItems;
     leadItems = state.leadItems;
     hideItems = state.hideItems;
     unhideItems = state.unhideItems;
     eventDialogue = state.eventDialogue;
     defaultDialogue = state.defaultDialogue;
     idleDialogue = state.idleDialogue;
     endingPoints = state.endingPoints;
     isInitiallyHidden = state.isInitiallyHidden;
     pt2DefaultDialogue = state.pt2DefaultDialogue;
     pt2EventDialogue = state.pt2EventDialogue;
 }
开发者ID:syncsophia,项目名称:CS4350Project,代码行数:18,代码来源:Item.cs


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