本文整理汇总了C#中WindowState.RestoreCurrentItem方法的典型用法代码示例。如果您正苦于以下问题:C# WindowState.RestoreCurrentItem方法的具体用法?C# WindowState.RestoreCurrentItem怎么用?C# WindowState.RestoreCurrentItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WindowState
的用法示例。
在下文中一共展示了WindowState.RestoreCurrentItem方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SaveCurrentItemAndRestoreCurrentItemTest
public void SaveCurrentItemAndRestoreCurrentItemTest()
{
var window = new EPuzzleWindow();
var windowState = new WindowState(window);
var button = new EigoTestButtonItem();
windowState.Items.Add(button);
windowState.CurrentItem = button;
var info = windowState.SaveCurrentItem();
windowState.CurrentItem = null;
windowState.RestoreCurrentItem(info);
Assert.IsInstanceOf<EigoTestButtonItem>(windowState.CurrentItem);
windowState.CurrentItem = null;
info = windowState.SaveCurrentItem();
windowState.CurrentItem = button;
windowState.RestoreCurrentItem(info);
Assert.Null(windowState.CurrentItem);
var button2 = new EigoTestButtonItem();
windowState.Items.Add(button2);
windowState.CurrentItem = button2;
info = windowState.SaveCurrentItem();
windowState.CurrentItem = button;
windowState.RestoreCurrentItem(info);
Assert.AreSame(button2, windowState.CurrentItem);
button.Name = "a";
windowState.CurrentItem = button;
info = windowState.SaveCurrentItem();
windowState.Items.Clear();
var button3 = new EigoTestButtonItem() { Name = "b", };
var button4 = new EigoTestButtonItem() { Name = "c", };
var button5 = new EigoTestButtonItem() { Name = "d", };
var button6 = new EigoTestButtonItem() { Name = "e", };
windowState.Items.Add(button3);
windowState.Items.Add(button4);
windowState.Items.Add(button5);
windowState.Items.Add(button6);
windowState.RestoreCurrentItem(info);
Assert.Null(windowState.CurrentItem);
button6.Name = "a";
windowState.RestoreCurrentItem(info);
Assert.AreSame(button6, windowState.CurrentItem);
Assert.AreNotSame(button, windowState.CurrentItem);
}