public async void NotifyFromDialog(ContentDialogResult dialogResult, object argument)
 {
     if (dialogResult == ContentDialogResult.Primary)
     {
         AppListEntry app = argument as AppListEntry;
         await app.LaunchAsync();
     }
 }
Beispiel #2
0
 public override void Activate()
 {
     try
     {
         _ = sourceApp?.LaunchAsync();
     }
     catch { }
 }
Beispiel #3
0
        static void Main(string[] args)
        {
            IAsyncOperation <IReadOnlyList <AppListEntry> > result = Windows.ApplicationModel.Package.Current.GetAppListEntriesAsync();

            result.Completed += delegate
            {
                AppListEntry appListEntry             = result.GetResults().First();
                appListEntry.LaunchAsync().Completed += delegate
                {
                    areWeDone.Set();
                };
            };
            areWeDone.WaitOne();
        }
Beispiel #4
0
        private async Task LauchUwpxAsync()
        {
            UpdateProgressInvoke(100, "Launching UWPX...");
            AppListEntry app = await GetAppByPackageFamilyNameAsync(info.appFamilyName);

            if (app is null)
            {
                UpdateProgressInvoke(100, "Failed to launch UWPX. App not found.");
            }
            else
            {
                await app.LaunchAsync();

                UpdateProgressInvoke(100, "Done");
            }
        }
 public override void Activate()
 {
     try
     {
         if (Data.DataType == SourceAppInfoDataType.FromAppUserModelId)
         {
             _ = sourceApp?.LaunchAsync();
         }
         else if (Data.DataType == SourceAppInfoDataType.FromProcessId)
         {
             using var sourceProcess = Process.GetProcessById((int)Data.ProcessId);
             IntPtr hWnd = IsWindow(Data.MainWindowHandle)
                 ? Data.MainWindowHandle : sourceProcess?.MainWindowHandle ?? IntPtr.Zero;
             SourceDesktopAppInfo.ActivateWindow(hWnd);
         }
     }
     catch { }
 }
Beispiel #6
0
        public async void CheckAppPresence(Action notFoundCallback, bool launch = false)
        {
            AppListEntry launcher = null;

            Windows.ApplicationModel.Package pack = new PackageManager().FindPackageForUser("", PackageName);
            if (pack != null)
            {
                launcher = (await pack.GetAppListEntriesAsync()).FirstOrDefault(a => a.DisplayInfo.DisplayName == AppName);
            }

            if (launcher == null)
            {
                notFoundCallback?.Invoke();
            }
            else
            {
                IsActive = true;

                if (launch)
                {
                    await launcher.LaunchAsync();
                }
            }
        }
Beispiel #7
0
 public static async void StartApp(AppListEntry appListEntry)
 {
     await appListEntry.LaunchAsync();
 }
 /// <summary>アプリを起動する</summary>
 /// <returns>起動が成功した場合true</returns>
 public async Task <bool> LaunchAsync() => await appListEntry.LaunchAsync();