public void BindTaskbarThumbButtonInfoCommand() {
     VM vm = VM.Create();
     RealWindow.DataContext = vm;
     TaskbarButtonService taskbarServiceImpl = new TaskbarButtonService();
     TaskbarThumbButtonInfo bt = new TaskbarThumbButtonInfo();
     BindingOperations.SetBinding(bt, TaskbarThumbButtonInfo.CommandProperty, new Binding("DoCommand"));
     taskbarServiceImpl.ThumbButtonInfos.Add(bt);
     Interaction.GetBehaviors(RealWindow).Add(taskbarServiceImpl);
     EnqueueShowRealWindow();
     Assert.AreEqual(POCOViewModelExtensions.GetCommand(vm, x => x.Do()), bt.Command);
 }
        public void SetThumbButtonInfosClickAction() {
            TaskbarButtonService taskbarServiceImpl = new TaskbarButtonService();
            Interaction.GetBehaviors(RealWindow).Add(taskbarServiceImpl);
            EnqueueShowRealWindow();
            ITaskbarButtonService taskbarService = taskbarServiceImpl;
            TaskbarThumbButtonInfo taskbarThumbButtonInfo = new TaskbarThumbButtonInfo() { Description = "xxx" };
            bool actionExecuted = false;
            bool clickExecuted = false;
            taskbarThumbButtonInfo.Action = () => { actionExecuted = true; };
            taskbarThumbButtonInfo.Click += (s, e) => clickExecuted = true;

            taskbarService.ThumbButtonInfos.Add(taskbarThumbButtonInfo);
            ThumbButtonInfo thumbButtonInfo = RealWindow.TaskbarItemInfo.ThumbButtonInfos[0];
            ClickThumbButton(thumbButtonInfo);
            Assert.IsTrue(actionExecuted);
            Assert.IsTrue(clickExecuted);
        }
 public void ThumbButtonPropertiesChanged() {
     TaskbarButtonService taskbarServiceImpl = new TaskbarButtonService();
     Interaction.GetBehaviors(RealWindow).Add(taskbarServiceImpl);
     EnqueueShowRealWindow();
     ImageSource imageSource1 = ApplicationJumpListServiceTestsImageSourceHelper.GetImageSource(AssemblyHelper.GetResourceUri(typeof(TaskbarButtonServiceTests).Assembly, "Icons/icon1.ico"));
     ImageSource imageSource2 = ApplicationJumpListServiceTestsImageSourceHelper.GetImageSource(AssemblyHelper.GetResourceUri(typeof(TaskbarButtonServiceTests).Assembly, "Icons/icon2.ico"));
     ITaskbarButtonService taskbarService = taskbarServiceImpl;
     TaskbarThumbButtonInfo thumbButtonInfo_1 = new TaskbarThumbButtonInfo() {
         Description = "thumbButton1",
         IsEnabled = true,
         IsInteractive = true,
         IsBackgroundVisible = false,
         DismissWhenClicked = false,
         Visibility = Visibility.Visible,
         ImageSource = imageSource1
     };
     taskbarService.ThumbButtonInfos.Add(thumbButtonInfo_1);
     RealWindow.TaskbarItemInfo.ThumbButtonInfos[0].Description = "thumbButton2";
     RealWindow.TaskbarItemInfo.ThumbButtonInfos[0].IsEnabled = false;
     RealWindow.TaskbarItemInfo.ThumbButtonInfos[0].IsInteractive = false;
     RealWindow.TaskbarItemInfo.ThumbButtonInfos[0].IsBackgroundVisible = true;
     RealWindow.TaskbarItemInfo.ThumbButtonInfos[0].DismissWhenClicked = true;
     RealWindow.TaskbarItemInfo.ThumbButtonInfos[0].Visibility = Visibility.Collapsed;
     RealWindow.TaskbarItemInfo.ThumbButtonInfos[0].ImageSource = imageSource2;
     EnqueueShowRealWindow();
     AssertHelper.AssertEnumerablesAreEqual(new TaskbarThumbButtonInfo[] {
         new TaskbarThumbButtonInfo() {
         Description = "thumbButton2",
         IsEnabled = false,
         IsInteractive = false,
         IsBackgroundVisible = true,
         DismissWhenClicked = true,
         Visibility = Visibility.Collapsed,
         ImageSource = imageSource2 },
     }, taskbarService.ThumbButtonInfos, true, new string[] { "ItemInfo" });
 }
 public void TaskbarThumbButtonBindCommandWithParameter() {
     TaskbarButtonService taskbarServiceImpl = new TaskbarButtonService();
     Interaction.GetBehaviors(RealWindow).Add(taskbarServiceImpl);
     EnqueueShowRealWindow();
     ButtonViewModel viewModel = new ButtonViewModel();
     ITaskbarButtonService taskbarService = taskbarServiceImpl;
     TaskbarThumbButtonInfo thumbButtonInfo_1 = new TaskbarThumbButtonInfo();
     BindingOperations.SetBinding(thumbButtonInfo_1, TaskbarThumbButtonInfo.CommandParameterProperty, new Binding("CommandParameter") { Source = viewModel, Mode = BindingMode.OneWay });
     BindingOperations.SetBinding(thumbButtonInfo_1, TaskbarThumbButtonInfo.CommandProperty, new Binding("Command") { Source = viewModel, Mode = BindingMode.OneWay });
     taskbarService.ThumbButtonInfos.Add(thumbButtonInfo_1);
     int? parameter = null;
     viewModel.Command = new DelegateCommand<int?>(p => parameter = p);
     viewModel.CommandParameter = 13;
     RealWindow.TaskbarItemInfo.ThumbButtonInfos[0].Command.Execute(RealWindow.TaskbarItemInfo.ThumbButtonInfos[0].CommandParameter);
     Assert.AreEqual(13, parameter);
 }
 public void SetThumbButtonInfos() {
     TaskbarButtonService taskbarServiceImpl = new TaskbarButtonService();
     Interaction.GetBehaviors(RealWindow).Add(taskbarServiceImpl);
     EnqueueShowRealWindow();
     ITaskbarButtonService taskbarService = taskbarServiceImpl;
     TaskbarThumbButtonInfo thumbButtonInfo_1 = new TaskbarThumbButtonInfo() { Description = "thumbButton1" };
     TaskbarThumbButtonInfo thumbButtonInfo_2 = new TaskbarThumbButtonInfo() { Description = "thumbButton2" };
     taskbarService.ThumbButtonInfos.Add(thumbButtonInfo_1);
     taskbarService.ThumbButtonInfos.Add(thumbButtonInfo_2);
     AssertHelper.AssertEnumerablesAreEqual(new ThumbButtonInfo[] {
         new ThumbButtonInfo() { Description = "thumbButton1" },
         new ThumbButtonInfo() { Description = "thumbButton2" },
     }, RealWindow.TaskbarItemInfo.ThumbButtonInfos, true, new string[] { "Command" });
 }
 public void T207524() {
     VM vm = VM.Create();
     RealWindow.DataContext = vm;
     TaskbarButtonServiceTest taskbarServiceImpl = new TaskbarButtonServiceTest();
     TaskbarThumbButtonInfo bt1 = new TaskbarThumbButtonInfo();
     TaskbarThumbButtonInfo bt2 = new TaskbarThumbButtonInfo();
     TaskbarThumbButtonInfo bt3 = new TaskbarThumbButtonInfo();
     BindingOperations.SetBinding(bt1, TaskbarThumbButtonInfo.CommandProperty, new Binding("DoCommand"));
     BindingOperations.SetBinding(bt2, TaskbarThumbButtonInfo.CommandProperty, new Binding("DoCommand"));
     BindingOperations.SetBinding(bt3, TaskbarThumbButtonInfo.CommandProperty, new Binding("DoCommand"));
     taskbarServiceImpl.ThumbButtonInfos.Add(bt1);
     taskbarServiceImpl.ThumbButtonInfos.Add(bt2);
     taskbarServiceImpl.ThumbButtonInfos.Add(bt3);
     Interaction.GetBehaviors(RealWindow).Add(taskbarServiceImpl);
     EnqueueShowRealWindow();
     Assert.AreEqual(1, taskbarServiceImpl.UpdateInternalItemsCount);
     EnqueueTestComplete();
 }