コード例 #1
0
 private void Instance_OnTerminated(InstanceIdentifier id, TaskbarApplicationInstanceButton instanceButton)
 {
     Dispatcher.InvokeAsync(() =>
     {
         instances.Remove(instances.FirstOrDefault(i => i.Id == id));
         InstanceStackPanel.Children.Remove(instanceButton);
     });
 }
コード例 #2
0
        private void RemoveInstance(TaskbarApplicationInstanceButton button)
        {
            Dispatcher.InvokeAsync(() =>
            {
                InstanceStackPanel.Children.Remove(button);

                if (InstanceStackPanel.Children.Count == 0)
                {
                    single = default(IApplicationInstance);
                }
            });
        }
コード例 #3
0
        public void RegisterInstance(IApplicationInstance instance)
        {
            Dispatcher.Invoke(() =>
            {
                var instanceButton = new TaskbarApplicationInstanceButton(instance, info);

                instanceButton.Clicked += (id) => Clicked?.Invoke(id);
                instance.Terminated    += (id) => Instance_OnTerminated(id, instanceButton);

                instances.Add(instance);
                InstanceStackPanel.Children.Add(instanceButton);
            });
        }
コード例 #4
0
        private void Application_InstanceStarted(IApplicationInstance instance)
        {
            Dispatcher.Invoke(() =>
            {
                var button = new TaskbarApplicationInstanceButton(instance, application.Info);

                instance.Terminated += (_) => RemoveInstance(button);
                InstanceStackPanel.Children.Add(button);

                if (single == default(IApplicationInstance))
                {
                    single = instance;
                }
            });
        }