private void Instance_OnTerminated(InstanceIdentifier id, TaskbarApplicationInstanceButton instanceButton)
 {
     Dispatcher.InvokeAsync(() =>
     {
         instances.Remove(instances.FirstOrDefault(i => i.Id == id));
         InstanceStackPanel.Children.Remove(instanceButton);
     });
 }
Exemplo n.º 2
0
        private void RemoveInstance(TaskbarApplicationInstanceButton button)
        {
            Dispatcher.InvokeAsync(() =>
            {
                InstanceStackPanel.Children.Remove(button);

                if (InstanceStackPanel.Children.Count == 0)
                {
                    single = default(IApplicationInstance);
                }
            });
        }
        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);
            });
        }
Exemplo n.º 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;
                }
            });
        }