本文整理汇总了C#中ItemEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# ItemEventArgs类的具体用法?C# ItemEventArgs怎么用?C# ItemEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ItemEventArgs类属于命名空间,在下文中一共展示了ItemEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ItemsList_ItemInvoked
/// <summary>
/// Logs in a user when one is selected
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The e.</param>
async void ItemsList_ItemInvoked(object sender, ItemEventArgs<object> e)
{
var model = (UserDtoViewModel)e.Argument;
var user = model.User;
if (user.HasPassword)
{
await NavigationManager.Navigate(new ManualLoginPage(user.Name, ChkAutoLogin.IsChecked, SessionManager, PresentationManager));
return;
}
try
{
await SessionManager.Login(user.Name, string.Empty, (bool)ChkAutoLogin.IsChecked);
}
catch (Exception ex)
{
PresentationManager.ShowMessage(new MessageBoxInfo
{
Caption = "Login Failure",
Text = ex.Message,
Icon = MessageBoxIcon.Error
});
}
}
示例2: ItemsList_ItemInvoked
/// <summary>
/// Logs in a user when one is selected
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The e.</param>
async void ItemsList_ItemInvoked(object sender, ItemEventArgs<object> e)
{
var model = (UserDtoViewModel)e.Argument;
var user = model.User;
if (user.HasPassword)
{
await NavigationManager.Navigate(new ManualLoginPage(user.Name, SessionManager, PresentationManager));
return;
}
try
{
await SessionManager.Login(user.Name, string.Empty);
}
catch (HttpException ex)
{
if (ex.StatusCode.HasValue && (ex.StatusCode.Value == HttpStatusCode.Unauthorized || ex.StatusCode.Value == HttpStatusCode.Forbidden))
{
PresentationManager.ShowMessage(new MessageBoxInfo
{
Caption = "Login Failure",
Text = "Invalid username or password. Please try again.",
Icon = MessageBoxIcon.Error
});
}
else
{
PresentationManager.ShowDefaultErrorMessage();
}
}
}
示例3: OnChannelError
public virtual void OnChannelError(ItemEventArgs<Exception> args)
{
if (ChannelError != null)
{
ChannelError.SafeEventInvoke(this, args);
}
}
示例4: HandleKeyPressed
private void HandleKeyPressed (object sender, ItemEventArgs<Keys> e)
{
if(e.Item == Keys.Back)
{
var length = Text.Length - 1;
if(length >= 0)
Text = Text.Substring(0, length);
}
else
{
string keyValue;
if(_keyStringMap.TryGetValue(e.Item, out keyValue))
{
Text += keyValue;
}
else
{
if(e.Item >= Keys.A && e.Item <= Keys.Z)
{
var stringValue = e.Item.ToString();
if(_isShiftDown)
stringValue = stringValue.ToUpper();
else
stringValue = stringValue.ToLower();
Text += stringValue;
}
}
}
}
示例5: TrinityOnItemSold
internal static void TrinityOnItemSold(object sender, ItemEventArgs e)
{
ResetTownRun();
try
{
ACDItem i = e.Item;
if (i == null || !i.IsValid || i.IsDisposed)
return;
var cachedItem = CachedACDItem.GetCachedItem(i);
switch (i.ItemBaseType)
{
case ItemBaseType.Gem:
case ItemBaseType.Misc:
break;
default:
TownRun.LogJunkItems(cachedItem, cachedItem.TrinityItemBaseType, cachedItem.TrinityItemType, ItemValuation.ValueThisItem(cachedItem, cachedItem.TrinityItemType));
break;
}
}
catch (Exception ex)
{
if (ex is CoroutineStoppedException)
throw;
}
}
示例6: HandleSettingsChanged
private void HandleSettingsChanged(object sender, ItemEventArgs<Core.Model.Settings> e)
{
foreach (IPresenter presenter in _presenters)
{
presenter.UpdateSettings(e.Item);
}
}
示例7: HandleCurrentFloorChanged
public void HandleCurrentFloorChanged(Object o, ItemEventArgs<int> e)
{
int topMargin = (25 * (10 - e.Item - 1));
txtStatus.Text = topMargin.ToString();
Top = topMargin;
//Refresh();
}
示例8: _themeManager_ThemeLoaded
void _themeManager_ThemeLoaded(object sender, ItemEventArgs<ITheme> e)
{
if (App.Instance.ApplicationWindow != null)
{
App.Instance.ApplicationWindow.PageContent.DataContext = e.Argument.CreatePageContentDataContext();
}
}
示例9: PersisterOnChanged
private void PersisterOnChanged(object sender, ItemEventArgs itemEventArgs)
{
if (itemEventArgs.AffectedItem is PartDefinitionPage)
{
_rebuild = true; // void cache
}
}
示例10: HandleReservationRemoved
public void HandleReservationRemoved(object sender, ItemEventArgs<IReservation> e)
{
if (e.Item.Direction == Direction)
{
_buttonList[e.Item.FloorIndex].BackColor = Color.Black;
}
}
示例11: OnItemCreating
protected virtual void OnItemCreating(ItemEventArgs e)
{
EventHandler<ItemEventArgs> handler = base.Events[EventItemCreating] as EventHandler<ItemEventArgs>;
if (handler != null)
handler.Invoke(this, e);
if (e.AffectedItem != null)
{
IDefinitionManager definitions = Engine.Definitions;
ISecurityManager security = Engine.SecurityManager;
ContentActivator activator = Engine.Resolve<ContentActivator>();
ItemDefinition parentDefinition = definitions.GetDefinition(parentItem);
if (parentDefinition.IsChildAllowed(definitions, parentItem, parentDefinition))
{
e.AffectedItem = Engine.Resolve<ContentActivator>().CreateInstance(parentItem.GetContentType(), parentItem);
return;
}
foreach (ItemDefinition definition in definitions.GetAllowedChildren(parentItem, null).WhereAuthorized(security, HttpContext.Current.User, parentItem))
{
e.AffectedItem = activator.CreateInstance(definition.ItemType, parentItem);
return;
}
throw new N2.Definitions.NoItemAllowedException(parentItem);
}
}
示例12: ItemEventArgs_ItemTest
public void ItemEventArgs_ItemTest()
{
using (var verify = new Verify())
{
var x = new ItemEventArgs<string>("xxx");
verify.AreEqual("xxx", x.Item, "Item property was not set correctly");
}
}
示例13: lstItems_ItemInvoked
/// <summary>
/// LSTs the items_ item invoked.
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The e.</param>
void lstItems_ItemInvoked(object sender, ItemEventArgs<object> e)
{
var img = (BitmapImage)e.Argument;
var index = Images.IndexOf(img);
//App.Instance.OpenImageViewer(new Uri(ImageUrls[index]), Item.Name);
}
示例14: MenuList_ItemInvoked
async void MenuList_ItemInvoked(object sender, ItemEventArgs<object> e)
{
var settingsPage = (ISettingsPage)e.Argument;
var page = (Page)_appHost.CreateInstance(settingsPage.PageType);
await _nav.Navigate(page);
}
示例15: NotifyDeleting
/// <summary>Notify subscribers that an item is to be deleted.</summary>
/// <param name="itemToBeDeleted">The item that is to be deleted.</param>
/// <returns>True if the item was modified.</returns>
public void NotifyDeleting(ContentItem itemToBeDeleted)
{
if (ItemDeleting == null)
return;
var args = new ItemEventArgs(itemToBeDeleted);
ItemDeleting(this, args);
}