public async Task LaunchFullTrustProcessAsync()
 {
     if (IsLaunchFullTrustProcessSupported())
     {
         await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();
     }
 }
Exemple #2
0
        private async void DetectCustomLocations()
        {
            // Detect custom locations set from Windows and detect QuickLook
            localSettings.Values["Arguments"] = "StartupTasks";
            await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();

            DesktopPath   = localSettings.Values["DetectedDesktopLocation"] as string;
            DownloadsPath = localSettings.Values["DetectedDownloadsLocation"] as string;
            DocumentsPath = localSettings.Values["DetectedDocumentsLocation"] as string;
            PicturesPath  = localSettings.Values["DetectedPicturesLocation"] as string;
            MusicPath     = localSettings.Values["DetectedMusicLocation"] as string;
            VideosPath    = localSettings.Values["DetectedVideosLocation"] as string;
            OneDrivePath  = localSettings.Values["DetectedOneDriveLocation"] as string;

            // Overwrite paths for common locations if Custom Locations setting is enabled
            if (localSettings.Values["customLocationsSetting"] != null)
            {
                if (localSettings.Values["customLocationsSetting"].Equals(true))
                {
                    DesktopPath   = localSettings.Values["DesktopLocation"] as string;
                    DownloadsPath = localSettings.Values["DownloadsLocation"] as string;
                    DocumentsPath = localSettings.Values["DocumentsLocation"] as string;
                    PicturesPath  = localSettings.Values["PicturesLocation"] as string;
                    MusicPath     = localSettings.Values["MusicLocation"] as string;
                    VideosPath    = localSettings.Values["VideosLocation"] as string;
                    OneDrivePath  = localSettings.Values["DetectedOneDriveLocation"] as string;
                }
            }
        }
Exemple #3
0
        private async Task StartSystemTray()
        {
            var launch = FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync("AppLaunchedParameterGroup").AsTask();
            await Task.WhenAll(launch, _trayReady.Task).ConfigureAwait(true);

            _trayProcessCommunicationService.Initialize(_appServiceConnection);
        }
Exemple #4
0
        public static async Task <AppServiceConnection> BuildConnection()
        {
            try
            {
                var serviceConnection = new AppServiceConnection();
                serviceConnection.AppServiceName    = "FilesInteropService";
                serviceConnection.PackageFamilyName = Package.Current.Id.FamilyName;
                serviceConnection.ServiceClosed    += Connection_ServiceClosed;
                AppServiceConnectionStatus status = await serviceConnection.OpenAsync();

                if (status != AppServiceConnectionStatus.Success)
                {
                    // TODO: error handling
                    serviceConnection?.Dispose();
                    return(null);
                }

                // Launch fulltrust process
                await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();

                return(serviceConnection);
            }
            catch (Exception ex)
            {
                NLog.LogManager.GetCurrentClassLogger().Warn(ex, "Could not initialize AppServiceConnection!");
                return(null);
            }
        }
Exemple #5
0
        private static async Task <NamedPipeAsAppServiceConnection> BuildConnection(bool launchFullTrust)
        {
            try
            {
                if (launchFullTrust)
                {
                    // Launch fulltrust process
                    ApplicationData.Current.LocalSettings.Values["PackageSid"] =
                        WebAuthenticationBroker.GetCurrentApplicationCallbackUri().Host.ToUpperInvariant();
                    await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();
                }

                var connection = new NamedPipeAsAppServiceConnection();
                if (await connection.Connect(@"LOCAL\FilesInteropService_ServerPipe", TimeSpan.FromSeconds(15)))
                {
                    return(connection);
                }
                connection.Dispose();
            }
            catch (Exception ex)
            {
                App.Logger.Warn(ex, "Could not initialize FTP connection!");
            }
            return(null);
        }
Exemple #6
0
 private async void Button_ClickAsync()
 {
     if (ApiInformation.IsApiContractPresent("Windows.ApplicationModel.FullTrustAppContract", 1, 0))
     {
         await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();
     }
 }
Exemple #7
0
        private async void ExportExcel_Click(object sender, RoutedEventArgs e)
        {
            if (IsPerformingRead() | IsPerformingWrite())
            {
            }
            else
            {
                table = new ValueSet();
                table.Add("REQUEST", "CreateSpreadsheet");



                for (int i = 0; i < listOfMessages.Count; i++)
                {
                    table.Add("DateTime" + i.ToString(), listOfMessages[i].Datetime_String);
                    table.Add("Event" + i.ToString(), listOfMessages[i].EventName);
                    table.Add("Description" + i.ToString(), listOfMessages[i].Description);
                }


                // launch the fulltrust process and for it to connect to the app service
                if (ApiInformation.IsApiContractPresent("Windows.ApplicationModel.FullTrustAppContract", 1, 0))
                {
                    await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();
                }
                else
                {
                    rootPage.NotifyUser("This feature is only available on Windows 10 Desktop SKU", NotifyType.ErrorMessage);
                }
            }
        }
        private async void SystemNavigationManager_CloseRequested(object sender, SystemNavigationCloseRequestedPreviewEventArgs e)
        {
            Deferral            deferral = e.GetDeferral();
            ConfirmCloseDialog  dlg      = new ConfirmCloseDialog();
            ContentDialogResult result   = await dlg.ShowAsync();

            if (result == ContentDialogResult.Secondary)
            {
                // user cancelled the close operation
                e.Handled = true;
                deferral.Complete();
            }
            else
            {
                switch (dlg.Result)
                {
                case CloseAction.Terminate:
                    e.Handled = false;
                    deferral.Complete();
                    break;

                case CloseAction.Systray:
                    if (ApiInformation.IsApiContractPresent(
                            "Windows.ApplicationModel.FullTrustAppContract", 1, 0))
                    {
                        await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();
                    }
                    e.Handled = false;
                    deferral.Complete();
                    break;
                }
            }
        }
        private async void InkPresenter_StrokesCollected(InkPresenter sender, InkStrokesCollectedEventArgs args)
        {
            Rect viewBounds = ApplicationView.GetForCurrentView().VisibleBounds;
            Rect inkBounds  = args.Strokes[0].BoundingRect;

            ApplicationData.Current.LocalSettings.Values["X"]      = viewBounds.X + inkBounds.Left;
            ApplicationData.Current.LocalSettings.Values["Y"]      = viewBounds.Y + inkBounds.Top;
            ApplicationData.Current.LocalSettings.Values["Width"]  = Window.Current.Bounds.Width;
            ApplicationData.Current.LocalSettings.Values["Height"] = Window.Current.Bounds.Height;

            var inkPoints = args.Strokes[0].GetInkPoints();
            var rawPoints = new double[inkPoints.Count * 2];

            for (int i = 0; i < inkPoints.Count; i++)
            {
                rawPoints[2 * i]     = inkPoints[i].Position.X - inkBounds.Left;
                rawPoints[2 * i + 1] = inkPoints[i].Position.Y - inkBounds.Top;
            }
            SavePointsToSettings(rawPoints);


            if (ApiInformation.IsApiContractPresent("Windows.ApplicationModel.FullTrustAppContract", 1, 0))
            {
                await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();
            }
            await Task.Delay(1000);

            sender.StrokeContainer.Clear();
        }
 private async void Button_Click(object sender, RoutedEventArgs e)
 {
     if (ApiInformation.IsApiContractPresent("Windows.ApplicationModel.FullTrustAppContract", 1, 0))
     {
         await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync("RemoteDesktop");
     }
 }
        private async void Button_Clicked(object sender, EventArgs e)
        {
#if WINDOWS_UWP
            var pref = ViewModePreferences.CreateDefault(ApplicationViewMode.CompactOverlay);
            pref.CustomSize = new Windows.Foundation.Size(500, 500);

            await ApplicationView.GetForCurrentView().TryEnterViewModeAsync(ApplicationViewMode.CompactOverlay, pref);

            await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();
#elif __MACOS__
            NSApplication.SharedApplication.MainWindow.ToggleFullScreen(NSApplication.SharedApplication.MainWindow);
            NSApplication.SharedApplication.MainWindow.Level = NSWindowLevel.Floating;

            var process = new ProcessStartInfo("test.sh")
            {
                WorkingDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
            };

            //var proc = new ProcessStartInfo("/Users/jimmygarrido/Desktop/test.sh");
            //proc.WorkingDirectory = "/Users/jimmygarrido/Desktop";

            Process.Start(process);
#endif
            await Navigation.PushAsync(new Page1());
        }
Exemple #12
0
        protected override async void OnLaunched(LaunchActivatedEventArgs e)
        {
            var launch     = FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync().AsTask();
            var clearCache = WebView.ClearTemporaryWebDataAsync().AsTask();

            await Task.WhenAll(launch, clearCache);

            Frame rootFrame = Window.Current.Content as Frame;

            if (rootFrame == null)
            {
                rootFrame = new Frame();
                rootFrame.NavigationFailed += OnNavigationFailed;
                Window.Current.Content      = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;
                rootFrame.Navigate(typeof(MainPage), e.Arguments);
                idSaved.Add(ApplicationView.GetForCurrentView().Id);
            }
            else if (false) //todo: add option to create new windows on launch
            {
                await CreateNewWindow(typeof(MainPage), true);
            }
            Window.Current.Activate();
        }
Exemple #13
0
 private async void PrintLastReceipt_Event(string text, string ImagePath)
 {
     // create a ValueSet from the datacontext
     table = new ValueSet();
     table.Add("PrintText", text);
     //table.Add("PrintText", "TEST:\r\n");
     if (ImagePath != null)
     {
         table.Add("ImgPath", ImagePath);
     }
     else
     {
         table.Add("ImgPath", null);
     }
     //table.Add("ImgPath", null);
     // launch the fulltrust process and for it to connect to the app service
     if (ApiInformation.IsApiContractPresent("Windows.ApplicationModel.FullTrustAppContract", 1, 0))
     {
         await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();
     }
     else
     {
         MessageDialog dialog = new MessageDialog("This feature is only available on Windows 10 Desktop SKU");
         await dialog.ShowAsync();
     }
 }
Exemple #14
0
        public MainPage()
        {
            this.InitializeComponent();

            ApplicationView.PreferredLaunchViewSize      = new Size(800, 1200);
            ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.PreferredLaunchViewSize;

            ListView_Processes.ItemsSource = Global.ProcessList;

            if (ApiInformation.IsApiContractPresent(
                    "Windows.ApplicationModel.FullTrustAppContract", 1, 0))
            {
                FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();
            }


            //SendToWinForms();

            /*ValueSet request = new ValueSet();
             * request.Add("KEY", "key");
             * App.SendToWinForms(request);*/

            // Hook Window Close

            SystemNavigationManagerPreview mgr =
                SystemNavigationManagerPreview.GetForCurrentView();

            mgr.CloseRequested += SystemNavigationManager_CloseRequested;

            // Hook Minimize
            Window.Current.VisibilityChanged += new WindowVisibilityChangedEventHandler(Minimize_Hook);
        }
Exemple #15
0
        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            // create a ValueSet from the datacontext
            table = new ValueSet();
            table.Add("REQUEST", "CreateSpreadsheet");
            table.Add("TAG", "E- 0106-Ta2-X3-EVAP2");


            /*  for (int i = 0; i < items.Count; i++)
             * {
             *    table.Add("TAG", "W- 0334-ECS-X2-Cds Fan");
             *    table.Add("Id" + i.ToString(), items[i].Id);
             *    table.Add("Quantity" + i.ToString(), items[i].Quantity);
             *    table.Add("UnitPrice" + i.ToString(), items[i].UnitPrice);
             * }
             */

            // launch the fulltrust process and for it to connect to the app service
            if (ApiInformation.IsApiContractPresent("Windows.ApplicationModel.FullTrustAppContract", 1, 0))
            {
                await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();
            }
            else
            {
                MessageDialog dialog = new MessageDialog("This feature is only available on Windows 10 Desktop SKU");
                await dialog.ShowAsync();
            }
        }
Exemple #16
0
 public static async Task OpenShellCommandInExplorerAsync(string shellCommand, int pid)
 {
     ApplicationData.Current.LocalSettings.Values["ShellCommand"] = shellCommand;
     ApplicationData.Current.LocalSettings.Values["Arguments"]    = "ShellCommand";
     ApplicationData.Current.LocalSettings.Values["pid"]          = pid;
     await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();
 }
Exemple #17
0
        private async void Page_Loaded(object sender, RoutedEventArgs e)
        {
            await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();

            await InitWebcamDevicesAsync();

            LoadSettings();
        }
Exemple #18
0
 protected async override void OnNavigatedTo(NavigationEventArgs e)
 {
     if (ApiInformation.IsTypePresent("Windows.ApplicationModel.FullTrustProcessLauncher"))
     {
         //we launch the Win32 process that generates the boarding pass on the desktop
         await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();
     }
 }
        public async void Run(IBackgroundTaskInstance taskInstance)
        {
            BackgroundTaskDeferral deferral = taskInstance.GetDeferral();
            await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();

            ToastHelper.PopToast("Connected Session Task", "Session Connected task is running", "OK");
            deferral.Complete();
        }
        private Task StartSystemTray()
        {
            var launch = FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync("AppLaunchedParameterGroup").AsTask();

            return(Task.WhenAll(launch, _trayReady.Task).ContinueWith(
                       t => _trayProcessCommunicationService.Initialize(_appServiceConnection),
                       TaskContinuationOptions.OnlyOnRanToCompletion));
        }
Exemple #21
0
        private async Task StartSystemTray()
        {
            var launch     = FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync().AsTask();
            var clearCache = WebView.ClearTemporaryWebDataAsync().AsTask();
            await Task.WhenAll(launch, clearCache, _trayReady.Task).ConfigureAwait(true);

            await _trayProcessCommunicationService.Initialize(_appServiceConnection).ConfigureAwait(true);
        }
Exemple #22
0
 public static async Task OpenShellCommandInExplorerAsync(string shellCommand, int pid)
 {
     System.Diagnostics.Debug.WriteLine("Launching shell command in FullTrustProcess");
     ApplicationData.Current.LocalSettings.Values["ShellCommand"] = shellCommand;
     ApplicationData.Current.LocalSettings.Values["Arguments"]    = "ShellCommand";
     ApplicationData.Current.LocalSettings.Values["pid"]          = pid;
     await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();
 }
Exemple #23
0
 public async void App_LaunchSystray()
 {
     if (ApiInformation.IsApiContractPresent(
             "Windows.ApplicationModel.FullTrustAppContract", 1, 0))
     {
         await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();
     }
 }
Exemple #24
0
        private async System.Threading.Tasks.Task Repair()
        {
            await ApplicationData.Current.LocalFolder.CreateFileAsync("aria2.session", CreationCollisionOption.ReplaceExisting);

            await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();

            wb.Navigate(new Uri("ms-appdata:///local/webui/index.html"));
        }
        //Triggered when we hit the Scan Button on the Update Page
        private async void ButtonScan_Click(object sender, RoutedEventArgs e)
        {
            //Launching exe to generate IC Report
            await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync("ICGroup");

            ViewModel.IsLoading    = true;
            loadingText.Visibility = Visibility.Visible;
            scanStack.Visibility   = Visibility.Collapsed;
        }
Exemple #26
0
 public async void OnNavigatedTo()
 {
     if (ApiInformation.IsApiContractPresent("Windows.ApplicationModel.FullTrustAppContract", 1, 0))
     {
         App.AppServiceConnected    += App_AppServiceConnected;
         App.AppServiceDisconnected += MainPage_AppServiceDisconnected;
         await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();
     }
 }
Exemple #27
0
 private void App_AppServiceDisconnected(object sender, EventArgs e)
 {
     _inited = false;
     _context?.Post(async _ =>
     {
         ToastHelper.SendToast("MLHelperDownTip".GetLocalized(), TimeSpan.FromSeconds(3));
         await Task.Delay(500);
         await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();
     }, null);
 }
        public async void Run(IBackgroundTaskInstance taskInstance)
        {
            if (ApiInformation.IsApiContractPresent("Windows.ApplicationModel.FullTrustAppContract", 1, 0))
            {
                BackgroundTaskDeferral deferral = taskInstance.GetDeferral();
                await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();

                deferral.Complete();
            }
        }
        protected override async void OnStart()
        {
#if WINDOWS_UWP
            await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync("Setup");
#elif __MACOS__
            var process = new ProcessStartInfo("scripts/setup.sh");
            Process.Start(process);
#endif
            Markdown.Init();
        }
Exemple #30
0
        private async void OnStartSync(CoreDispatcher dispatcher)
        {
            //#if DEBUG
            //await VoIPConnection.Current.ConnectAsync();
            //#endif

            await Toast.RegisterBackgroundTasks();

            try
            {
                TileUpdateManager.CreateTileUpdaterForApplication("App").Clear();
            }
            catch { }

            try
            {
                ToastNotificationManager.History.Clear("App");
            }
            catch { }

#if DESKTOP_BRIDGE
            if (ApiInformation.IsTypePresent("Windows.ApplicationModel.FullTrustProcessLauncher"))
            {
                try
                {
                    await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();
                }
                catch
                {
                    // The app has been compiled without desktop bridge
                }
            }
#endif

            if (_extendedSession == null && ApiInfo.IsFullExperience)
            {
                var session = new ExtendedExecutionSession {
                    Reason = ExtendedExecutionReason.Unspecified
                };
                var result = await session.RequestExtensionAsync();

                if (result == ExtendedExecutionResult.Allowed)
                {
                    _extendedSession = session;

                    Logs.Logger.Info(Logs.Target.Lifecycle, "ExtendedExecutionResult.Allowed");
                }
                else
                {
                    session.Dispose();

                    Logs.Logger.Warning(Logs.Target.Lifecycle, "ExtendedExecutionResult.Denied");
                }
            }
        }