本文整理汇总了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;
}
};
}
示例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;
}
示例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);
}
}
示例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));
}
}
示例5: Item
public Item(string name, string description, Texture2D image)
{
this.name = name;
this.description = description;
this.image = image;
quantity = 1;
state = ItemState.Positioned;
}
示例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;
}
示例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
}));
}
示例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;
}
示例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;
}
示例10: GetImageSource
public static ImageSource GetImageSource(string directory, ItemState folderType)
{
try
{
return GetImageSource(directory, new Size(16, 16), folderType);
}
catch
{
throw;
}
}
示例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);
}
}
示例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;
}
示例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;
}
}
示例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);
}
}
}
示例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;
}