Пример #1
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);
        }
Пример #2
0
 private async void LaunchFullTrust()
 {
     if (ApiInformation.IsApiContractPresent("Windows.ApplicationModel.FullTrustAppContract", 1, 0))
     {
         await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();
     }
 }
Пример #3
0
 private async void btnClick_System(object sender, RoutedEventArgs e)
 {
     if (ApiInformation.IsApiContractPresent("Windows.ApplicationModel.FullTrustAppContract", 1, 0))
     {
         await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync("RemoteDesktop");
     }
 }
        private 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);
            }
        }
Пример #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);
        }
Пример #6
0
        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;
                }
            }
        }
Пример #7
0
 public static async Task InvokeWin32Component(string ApplicationPath)
 {
     Debug.WriteLine("Launching EXE in FullTrustProcess");
     ApplicationData.Current.LocalSettings.Values["Application"] = ApplicationPath;
     ApplicationData.Current.LocalSettings.Values["Arguments"]   = null;
     await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();
 }
Пример #8
0
        private async void DetectCustomLocations()
        {
            // Detect custom locations set from Windows
            localSettings.Values["Arguments"] = "DetectUserPaths";
            await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync("UserFolderPathsGroup");

            App.DesktopPath   = localSettings.Values["DetectedDesktopLocation"] as string;
            App.DownloadsPath = localSettings.Values["DetectedDownloadsLocation"] as string;
            App.DocumentsPath = localSettings.Values["DetectedDocumentsLocation"] as string;
            App.PicturesPath  = localSettings.Values["DetectedPicturesLocation"] as string;
            App.MusicPath     = localSettings.Values["DetectedMusicLocation"] as string;
            App.VideosPath    = localSettings.Values["DetectedVideosLocation"] as string;
            App.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))
                {
                    App.DesktopPath   = localSettings.Values["DesktopLocation"] as string;
                    App.DownloadsPath = localSettings.Values["DownloadsLocation"] as string;
                    App.DocumentsPath = localSettings.Values["DocumentsLocation"] as string;
                    App.PicturesPath  = localSettings.Values["PicturesLocation"] as string;
                    App.MusicPath     = localSettings.Values["MusicLocation"] as string;
                    App.VideosPath    = localSettings.Values["VideosLocation"] as string;
                    App.OneDrivePath  = localSettings.Values["DetectedOneDriveLocation"] as string;
                }
            }
        }
 public async Task LaunchFullTrustProcessAsync()
 {
     if (IsLaunchFullTrustProcessSupported())
     {
         await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();
     }
 }
Пример #10
0
        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());
        }
Пример #11
0
        private async System.Threading.Tasks.Task InitialzeEnvAndPage()
        {
            LoadingText.Text = "加载广告";
            PrepareAds();


            if (IsAppUpdated || SystemInformation.IsFirstRun)
            {
                LoadingText.Text = "解压 AriaNg";
                await PackageTools.UnZip(new Uri("ms-appx:///webui.zip"));


                ContentDialog contentDialog = new ContentDialog()
                {
                    IsPrimaryButtonEnabled = true,
                    Title             = "还差一步",
                    Content           = "激活Aria2,本次启动可能无法正常连接,如果连接失败请重新启动程序",
                    PrimaryButtonText = "激活"
                };
                contentDialog.PrimaryButtonClick += async(e, a) =>
                {
                    await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();
                };
                await contentDialog.ShowAsync();
            }
            else
            {
                LoadingText.Text = "加载Aria2";
                await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();
            }

            LoadingText.Text = "处理Session";
            await GetSessionAndStartAriaNG();
        }
Пример #12
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);
                }
            }
        }
Пример #13
0
        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();
        }
Пример #14
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();
        }
Пример #15
0
 protected override async void OnNavigatedTo(NavigationEventArgs e)
 {
     if (e.NavigationMode == NavigationMode.New)
     {
         await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();
     }
 }
Пример #16
0
        public static async Task <T> LaunchFullTrustAndConnect <T>(string groupId, string appServiceName, Func <AppServiceConnection, CancellationTokenSource, Task <T> > exec)
        {
            using (var cts = new CancellationTokenSource())
            {
                var completionSource = new TaskCompletionSource <bool>();

                var appServiceInfoTask =
                    Events.FirstEventOf <object, Tuple <AppServiceTriggerDetails, CancellationTokenSource> >(
                        cts.Token,
                        h => AppService.AppServiceConnected += h,
                        h => AppService.AppServiceConnected -= h,
                        3000,
                        result => result.Item1.Name == appServiceName);

                await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync(groupId);

                var appServiceInfo       = await appServiceInfoTask;
                var appServiceConnection = appServiceInfo.Item1.AppServiceConnection;
                using (var serviceCancellation = appServiceInfo.Item2)
                {
                    serviceCancellation.Token.Register(() => completionSource.TrySetResult(false));
                    var result = await exec(appServiceConnection, cts);

                    var _ = await completionSource.Task;
                    return(result);
                }
            }
        }
Пример #17
0
 private async void Button_Click(object sender, RoutedEventArgs e)
 {
     if (ApiInformation.IsApiContractPresent("Windows.ApplicationModel.FullTrustAppContract", 1, 0))
     {
         await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();
     }
 }
Пример #18
0
        public async void ToggleQuickLook()
        {
            try
            {
                string selectedItemPath = null;
                int    selectedItemCount;
                Type   sourcePageType = App.CurrentInstance.CurrentPageType;
                selectedItemCount = (CurrentInstance.ContentPage as BaseLayout).SelectedItems.Count;
                if (selectedItemCount == 1)
                {
                    selectedItemPath = (CurrentInstance.ContentPage as BaseLayout).SelectedItems[0].FilePath;
                }

                if (selectedItemCount == 1)
                {
                    var clickedOnItem = (CurrentInstance.ContentPage as BaseLayout).SelectedItems[0];

                    Debug.WriteLine("Toggle QuickLook");
                    ApplicationData.Current.LocalSettings.Values["path"]      = clickedOnItem.FilePath;
                    ApplicationData.Current.LocalSettings.Values["Arguments"] = "ToggleQuickLook";
                    await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();
                }
            }
            catch (FileNotFoundException)
            {
                MessageDialog dialog = new MessageDialog("The file you are attempting to preview may have been moved or deleted.", "File Not Found");
                var           task   = dialog.ShowAsync();
                task.AsTask().Wait();
                NavigationActions.Refresh_Click(null, null);
            }
        }
Пример #19
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();
 }
Пример #20
0
        private async void btnExport_Click(object sender, RoutedEventArgs e)
        {
            // create a ValueSet from the datacontext
            table = new ValueSet();
            if (ContentFrame.Content is GridPage)
            {
                ObservableCollection <Employee> items = (ContentFrame.Content as GridPage).GridItems;
                table.Add("REQUEST", "CreateSpreadsheet");
                for (int i = 0; i < items.Count; i++)
                {
                    table.Add("Name" + i.ToString(), items[i].Name);
                    table.Add("Title" + i.ToString(), items[i].Title);
                    table.Add("Department" + i.ToString(), items[i].Department);
                    table.Add("Manager" + i.ToString(), items[i].Manager);
                    table.Add("Phone" + i.ToString(), items[i].OfficePhone);
                    table.Add("Email" + i.ToString(), items[i].Mail);
                }

                // 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();
                }
            }
        }
Пример #21
0
 public static async Task OpenShellCommandInExplorer(string shellCommand)
 {
     Debug.WriteLine("Launching shell command in FullTrustProcess");
     ApplicationData.Current.LocalSettings.Values["ShellCommand"] = shellCommand;
     ApplicationData.Current.LocalSettings.Values["Arguments"]    = "ShellCommand";
     await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();
 }
Пример #22
0
        public async Task OnNavigatedToAsync(NavigationEventArgs _)
        {
            _isPingAutoStart = await ApplicationData.Current.LocalSettings.ReadAsync <bool>("IsPingAutoStart");

            var address = await ApplicationData.Current.LocalSettings.ReadAsync <string>(nameof(HostNameOrAddress));

            if (string.IsNullOrEmpty(address))
            {
                HostNameOrAddress = "172.217.166.238";
            }
            else
            {
                HostNameOrAddress = address;
            }
            if (ApiInformation.IsApiContractPresent("Windows.ApplicationModel.FullTrustAppContract", 1, 0))
            {
                App.AppServiceConnected    += MainPage_AppServiceConnected;
                App.AppServiceDisconnected += MainPage_AppServiceDisconnected;
                await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();
            }
            await SetNetworkInfoAsync();

            NetworkInformation.NetworkStatusChanged -= NetworkInformation_NetworkStatusChangedAsync;
            NetworkInformation.NetworkStatusChanged += NetworkInformation_NetworkStatusChangedAsync;
            if (_isPingAutoStart)
            {
                await Task.Delay(2000);
                await OnStartCommandExecutedAsync();
            }
        }
Пример #23
0
 private async void PrintReceipt(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();
     }
 }
        public async void Run(IBackgroundTaskInstance taskInstance)
        {
            BackgroundTaskDeferral deferral = taskInstance.GetDeferral();

            try
            {
                string message = "Task has run.";

                Debug.WriteLine("Inside PreInstalledConfigTask");

                try
                {
                    // launch the UWP app
                    await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();
                }
                catch (Exception ex)
                {
                    message = ex.Message;
                }

                ToastHelper.ShowToast("PreInstalledConfigTask", message);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(string.Format("Exception in PreInstalledConfigTask, message is {0}", ex.Message));
            }
            finally
            {
                // this must always be called, even if there is an exception
                deferral.Complete();
            }
        }
Пример #25
0
        public static async void GetNotificationsAndProcessThem()
        {
            IReadOnlyList <UserNotification> notifs =
                await MainPage.listener.GetNotificationsAsync(NotificationKinds.Toast);

            UserNotification n = notifs[notifs.Count - 1];

            // Get the toast binding, if present
            NotificationBinding toastBinding = n.Notification.Visual.GetBinding(KnownNotificationBindings.ToastGeneric);

            if (toastBinding != null)
            {
                // And then get the text elements from the toast binding
                IReadOnlyList <AdaptiveNotificationText> textElements = toastBinding.GetTextElements();
                String appName  = n.AppInfo.DisplayInfo.DisplayName;
                string bodyText =
                    string.Join(" | ", textElements.Select(t => t.Text));
                Debug.Write(bodyText);
                MainPage.items.Add(bodyText);


                if (ApiInformation.IsApiContractPresent("Windows.ApplicationModel.FullTrustAppContract", 1, 0))
                {
                    ApplicationData.Current.LocalSettings.Values["parameters"] = appName + " | " + bodyText;
                    await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();
                }
            }
        }
Пример #26
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;
                }
            }
        }
Пример #27
0
        private async Task StartSystemTray()
        {
            var launch = FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync("AppLaunchedParameterGroup").AsTask();
            await Task.WhenAll(launch, _trayReady.Task).ConfigureAwait(true);

            _trayProcessCommunicationService.Initialize(_appServiceConnection);
        }
Пример #28
0
 private async void convertvideo(object sender, RoutedEventArgs e)
 {
     if (Windows.Foundation.Metadata.ApiInformation.IsApiContractPresent("Windows.ApplicationModel.FullTrustAppContract", 1, 0))
     {
         await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();
     }
 }
Пример #29
0
        private async void SystemNavigationManager_CloseRequested(object sender, SystemNavigationCloseRequestedPreviewEventArgs e)
        {
            int      closeNum = 1;
            Deferral deferral = e.GetDeferral();

            if (false)
            {
                // user cancelled the close operation
                e.Handled = true;
                deferral.Complete();
            }
            else
            {
                switch (closeNum)
                {
                case 0:
                    e.Handled = false;
                    deferral.Complete();
                    break;

                case 1:
                    if (ApiInformation.IsApiContractPresent(
                            "Windows.ApplicationModel.FullTrustAppContract", 1, 0))
                    {
                        await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();
                    }
                    e.Handled = false;
                    deferral.Complete();
                    break;
                }
            }
        }
Пример #30
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();
            }
        }