Exemplo n.º 1
0
        public async Task InitialiseProcessListAsync()
        {
            var winList = Win32.GetWindowsByZOrder();

            var processList = GetProcessList();

            foreach (var item in processList)
            {
                var matched = winList.FirstOrDefault(x => x.Value.ToInt32() == item.WindowHandle.ToInt32());
                var empty   = default(KeyValuePair <int, IntPtr>);

                if (!matched.Equals(empty))
                {
                    item.ZOrder = winList.First(x => x.Value.ToInt32() == item.WindowHandle.ToInt32()).Key;
                }
            }

            if (_processList == null)
            {
                _processList = new List <ProcessItem>();
                _processList.AddRange(processList);
            }
            else
            {
                _processList.RemoveAll(x => x.Category == "chrome");
                ResyncProcessState(processList);
            }

            var currentProcessItem =
                _processList.FirstOrDefault(x => x.WindowHandle.ToInt32() == ShellView.ClientHwnd.ToInt32())
                ?? _processList.FirstOrDefault(x => x.WindowHandle.ToInt32() == winList.First().Value.ToInt32());

            if (currentProcessItem != null)
            {
                currentProcessItem.IsEnabled = false;
            }

            //            await AddChromeTabs(_processList).ConfigureAwait(true);
            lock (_gate)
            {
                if (_chromeTabs.Any())
                {
                    _processList.AddRange(_chromeTabs);
                }
            }

            ProcessNames.Clear();
            ProcessNames.AddRange(_processList.OrderBy(x => x.ZOrder));
            await EnhanceWithIconAsync(_mainCancellationTokenSource.Token);
        }
Exemplo n.º 2
0
        public void Release()
        {
            OnActionSnapshotBackup  = null;
            OnActionSnapshotRestore = null;

            OnClosing     = null;
            OnInitialized = null;
            OnLoaded      = null;
            OnOpened      = null;
            OnClosed      = null;

            SnapshotsFolder = null;
            LastSnapshot    = null;

            Watcher = null;

            foreach (var category in Categories)
            {
                category.OnEquals   = null;
                category.OnToString = null;
            }

            Categories.Clear();

            foreach (var snapshot in Snapshots)
            {
                foreach (var pair in snapshot.CustomValues)
                {
                    pair.Value.OnToString = null;
                }

                snapshot.OnEquals = null;
            }

            Snapshots.Clear();

            SnapshotColumnsDefinition.Clear();

            ProcessNames.Clear();
        }
Exemplo n.º 3
0
 private void ResetProcessNames()
 {
     ProcessNames.Clear();
     ProcessNames.AddRange(_processList.OrderBy(x => x.ZOrder));
     Task.Run(() => EnhanceWithIconAsync(_mainCancellationTokenSource.Token), _mainCancellationTokenSource.Token);
 }