public CgbEventVM(CgbEventType type)
        {
            _eventType     = type;
            _filteredFiles = new ListCollectionView(Files);

            this.PropertyChanged += CgbEventVM_PropertyChanged;
        }
示例#2
0
        public void UpdateViewAfterHandledInvocationAndStartFileSystemWatchers(CgbEventType eventType, InvocationParams config, IList <IFileDeployment> deployments, IList <FileDeploymentData> fileDeployments, IList <FileDeploymentData> windowsToShowFor, bool stopAnimateIcon = true)
        {
            // Sync across threads by invoking it on the dispatcher
            _myDispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)(() =>
            {
                // See, if we're already handling that executable!
                var inst = _instances.GetInstance(config.ExecutablePath);

                // Create new or update config/invocation params:
                if (null == inst)
                {
                    inst = new CgbAppInstanceVM
                    {
                        Config = config
                    };
                    _instances.Add(inst);

                    AddToMessagesList(Message.Create(MessageType.Information, $"Handling new instance '{inst.ShortPath}' at path '{inst.Path}'", () =>
                    {
                        var wnd = new View.InstancesList
                        {
                            DataContext = new { Items = _instances }
                        };
                        wnd.ContentRendered += (object sender, EventArgs e) =>
                        {
                            var children = wnd.GetChildren(true);
                            foreach (var child in children)
                            {
                                if (!(child is FrameworkElement feChild))
                                {
                                    continue;
                                }
                                if (feChild.DataContext == inst)
                                {
                                    feChild.BringIntoView();
                                    break;
                                }
                            }
                        };
                        wnd.Show();
                    }), inst);