本文整理汇总了C#中Poker.ChangeMode方法的典型用法代码示例。如果您正苦于以下问题:C# Poker.ChangeMode方法的具体用法?C# Poker.ChangeMode怎么用?C# Poker.ChangeMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Poker
的用法示例。
在下文中一共展示了Poker.ChangeMode方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FormView_UpdateItem
public void FormView_UpdateItem ()
{
Poker fv = new Poker ();
fv.Page = new Page ();
fv.DataSource = myds;
fv.DataBind ();
fv.ChangeMode (FormViewMode.Edit);
fv.ItemUpdating += new FormViewUpdateEventHandler (update_item);
Assert.AreEqual (false, updateItem, "BeforeUpdateItem");
fv.UpdateItem (false);
Assert.AreEqual (true, updateItem, "AfterUpdateItem");
}
示例2: FormView_InsertItem
public void FormView_InsertItem ()
{
Poker fv = new Poker ();
fv.Page = new Page ();
fv.ChangeMode (FormViewMode.Insert);
fv.ItemInserting += new FormViewInsertEventHandler (insert_item);
Assert.AreEqual (false, insertItem, "BeforeInsertItem");
fv.InsertItem (false);
Assert.AreEqual (true, insertItem, "AfterInsertItem");
}
示例3: FormView_ChangeMode
public void FormView_ChangeMode ()
{
Poker fv = new Poker ();
Assert.AreEqual (FormViewMode.ReadOnly, fv.CurrentMode, "ChangeModeDefault");
fv.ChangeMode (FormViewMode.Insert);
Assert.AreEqual (FormViewMode.Insert, fv.CurrentMode, "ChangeModeInsert");
fv.ChangeMode (FormViewMode.Edit);
Assert.AreEqual (FormViewMode.Edit, fv.CurrentMode, "ChangeModeEdit");
fv.ChangeMode (FormViewMode.ReadOnly);
Assert.AreEqual (FormViewMode.ReadOnly, fv.CurrentMode, "ChangeModeReadOnly");
}
示例4: FormView_ItemsProperties
public void FormView_ItemsProperties ()
{
Poker p = new Poker ();
p.Page = new Page ();
p.AllowPaging = true;
p.DataSource = myds;
p.DataBind ();
//Assert.AreEqual (typeof (FormViewPagerRow), (p.BottomPagerRow).GetType (), "BottomPagerRow1");
Assert.AreEqual (0, p.BottomPagerRow.ItemIndex, "BottomPagerRow2");
Assert.AreEqual (DataControlRowType.Pager, p.BottomPagerRow.RowType, "BottomPagerRow2");
Assert.AreEqual ("Item1", p.DataItem, "DataItem");
Assert.AreEqual (6, p.DataItemCount, "DataItemCount");
Assert.AreEqual (0, p.DataItemIndex, "DataItemIndex");
Assert.AreEqual (0, p.DataItemIndex, "DataItemIndex");
string[] str = new string[] { "1", "2", "3", "4", "5", "6" };
Assert.AreEqual (typeof (DataKey), p.DataKey.GetType (), "DataKey");
p.DataKeyNames = str;
Assert.AreEqual (str, p.DataKeyNames, "DataKeyNames");
p.ChangeMode (FormViewMode.Edit);
Assert.AreEqual (FormViewMode.Edit, p.CurrentMode, "CurrentModeEdit");
p.ChangeMode (FormViewMode.Insert);
Assert.AreEqual (FormViewMode.Insert, p.CurrentMode, "CurrentModeInsert");
}
示例5: FormView_BubbleEvent
public void FormView_BubbleEvent ()
{
FormViewCommandEventArgs com;
Poker fv = new Poker ();
Page page = new Page ();
Button bt = new Button ();
fv.AllowPaging = true;
fv.DataSource = myds;
page.Controls.Add (fv);
fv.DataBind ();
ResetEvents ();
fv.ItemCommand += new FormViewCommandEventHandler (fv_ItemCommand);
fv.ItemDeleted += new FormViewDeletedEventHandler (fv_ItemDeleted);
//Delete
fv.ItemDeleting += new FormViewDeleteEventHandler (fv_ItemDeleting);
com = new FormViewCommandEventArgs (bt, new CommandEventArgs ("Delete", null));
Assert.AreEqual (false, itemDeleting, "BeforeDeleteCommandBubbleEvent");
Assert.AreEqual (false, itemCommand, "BeforeDeleteBubbleEvent");
Assert.IsTrue (fv.DoOnBubbleEvent (bt, com), "OnBubbleEvent - Delete");
Assert.AreEqual (true, itemDeleting, "AfterDeleteBubbleEvent");
Assert.AreEqual (true, itemCommand, "AfterDeleteCommandBubbleEvent");
//Insert
itemCommand = false;
fv.ItemInserting += new FormViewInsertEventHandler (fv_ItemInserting);
fv.ChangeMode (FormViewMode.Insert);
com = new FormViewCommandEventArgs (bt, new CommandEventArgs ("Insert", null));
Assert.AreEqual (false, itemCommand, "BeforeInsertCommandBubbleEvent");
Assert.AreEqual (false, itemInserting, "BeforeInsertBubbleEvent");
Assert.IsTrue (fv.DoOnBubbleEvent (bt, com), "OnBubbleEvent - Insert");
Assert.AreEqual (true, itemCommand, "AfterInsertCommandBubbleEvent");
Assert.AreEqual (true, itemInserting, "AfterInsertBubbleEvent");
//Update
itemCommand = false;
fv.ItemUpdating += new FormViewUpdateEventHandler (fv_ItemUpdating);
fv.ChangeMode (FormViewMode.Edit);
com = new FormViewCommandEventArgs (bt, new CommandEventArgs ("Update", null));
Assert.AreEqual (false, itemUpdating, "BeforeUpdateEvent");
Assert.AreEqual (false, itemCommand, "BeforeUpdateCommandEvent");
Assert.IsTrue (fv.DoOnBubbleEvent (bt, com), "OnBubbleEvent - Update");
Assert.AreEqual (true, itemCommand, "AfterUpdateCommandBubbleEvent");
Assert.AreEqual (true, itemUpdating, "AfterUpdateBubbleEvent");
//Cancel
itemCommand = false;
fv.ModeChanging += new FormViewModeEventHandler (fv_ModeChanging);
com = new FormViewCommandEventArgs (bt, new CommandEventArgs ("Cancel", null));
Assert.AreEqual (false, itemCommand, "BeforeCancelCommandBubbleEvent");
Assert.AreEqual (false, modeChanging, "BeforeCancelBubbleEvent");
Assert.IsTrue (fv.DoOnBubbleEvent (bt, com), "OnBubbleEvent - Cancel");
Assert.AreEqual (true, itemCommand, "AfterCancelCommandBubbleEvent");
Assert.AreEqual (true, modeChanging, "AfterCancelBubbleEvent");
//Edit
itemCommand = false;
modeChanging = false;
com = new FormViewCommandEventArgs (bt, new CommandEventArgs ("Edit", null));
Assert.AreEqual (false, itemCommand, "BeforeEditCommandBubbleEvent");
Assert.AreEqual (false, modeChanging, "BeforeEditBubbleEvent");
Assert.IsTrue (fv.DoOnBubbleEvent (bt, com), "OnBubbleEvent - Edit");
Assert.AreEqual (true, itemCommand, "AfterEditCommandBubbleEvent");
Assert.AreEqual (true, modeChanging, "AfterEditBubbleEvent");
//New
itemCommand = false;
modeChanging = false;
com = new FormViewCommandEventArgs (bt, new CommandEventArgs ("New", null));
Assert.AreEqual (false, itemCommand, "BeforeNewCommandBubbleEvent");
Assert.AreEqual (false, modeChanging, "BeforeNewBubbleEvent");
Assert.IsTrue (fv.DoOnBubbleEvent (bt, com), "OnBubbleEvent - New");
Assert.AreEqual (true, itemCommand, "AfterNewCommandBubbleEvent");
Assert.AreEqual (true, modeChanging, "AfterNewBubbleEvent");
//Page Index default
itemCommand = false;
fv.PageIndexChanging += new FormViewPageEventHandler (fv_PageIndexChanging);
com = new FormViewCommandEventArgs (bt, new CommandEventArgs ("Page", null));
Assert.AreEqual (false, itemCommand, "BeforePageCommandBubbleEvent");
Assert.AreEqual (false, pageIndexChanging, "BeforePageBubbleEvent");
Assert.IsTrue (fv.DoOnBubbleEvent (bt, com), "OnBubbleEvent - Page Index default");
Assert.AreEqual (true, itemCommand, "AfterPageCommandBubbleEvent");
Assert.AreEqual (true, pageIndexChanging, "AfterPageBubbleEvent");
Assert.AreEqual (-1, newPageIndex, "PageIndex");
//Next Page
itemCommand = false;
pageIndexChanging = false;
com = new FormViewCommandEventArgs (bt, new CommandEventArgs ("Page", "Next"));
Assert.AreEqual (false, itemCommand, "BeforeNextPageCommandBubbleEvent");
Assert.AreEqual (false, pageIndexChanging, "BeforeNextPageBubbleEvent");
Assert.IsTrue (fv.DoOnBubbleEvent (bt, com), "OnBubbleEvent - Next Page");
Assert.AreEqual (true, itemCommand, "AfterNextPageCommandBubbleEvent");
Assert.AreEqual (true, pageIndexChanging, "AfterNextPageBubbleEvent");
Assert.AreEqual (1, newPageIndex, "NextPageIndex");
//Prev Page
//.........这里部分代码省略.........
示例6: FormView_ControlState
public void FormView_ControlState () {
Poker fv = new Poker ();
Poker copy = new Poker ();
string[] keys = new String[2];
keys[0] = "key1";
keys[1] = "key2";
fv.DataKeyNames = keys;
fv.BackImageUrl = "photo.jpg";
fv.DefaultMode = FormViewMode.Insert ;
fv.ChangeMode (FormViewMode.Edit);
object state = fv.DoSaveControlState ();
copy.DoLoadControlState (state);
Assert.AreEqual (2, copy.DataKeyNames.Length, "DataKeyNames.Length");
Assert.AreEqual ("key1", copy.DataKeyNames[0], "ControlStateDataKeyValue");
Assert.AreEqual ("key2", copy.DataKeyNames[1], "ControlStateDataKeyValue2");
Assert.AreEqual (FormViewMode.Insert, copy.DefaultMode, "ControlStateDefaultMode");
Assert.AreEqual (FormViewMode.Edit, copy.CurrentMode, "ControlStateCurrentMode");
}