Esempio n. 1
0
        public ApplicationDockItem(DesktopEntry entry)
        {
            WindowHandles = new List <IntPtr>();

            DesktopEntry = entry;

            Autorun = false;
            Pinned  = true;

            Name = entry.Name;

            Image = entry.Icon;

            if (entry.Type == DesktopEntryType.Application)
            {
                var possitiblities = AppUserModelId.Find(entry.TryExec);
                AppId = AppUserModelId.Find(entry.TryExec).Where(a => File.Exists(a.DestinationList)).FirstOrDefault();
                if (AppId == null)
                {
                    AppId = possitiblities.FirstOrDefault();
                }
            }
            else
            {
                AppId = AppUserModelId.FromExplicitAppId("C:\\Windows\\explorer.exe", "Microsoft.Windows.Explorer").First();
            }
        }
Esempio n. 2
0
        public ApplicationDockItem(IntPtr windowHandle)
        {
            WindowHandles = new List <IntPtr> {
                windowHandle
            };

            Autorun = false;
            Pinned  = false;

            var possibleIds = AppUserModelId.Find(windowHandle);

            AppId = possibleIds.Where(a => File.Exists(a.DestinationList)).FirstOrDefault();
            if (AppId == null)
            {
                AppId = possibleIds.FirstOrDefault();
            }

            if (AppId != null)
            {
                DesktopEntry = new DesktopEntry()
                {
                    TryExec = AppId.Executable
                };
            }
        }