예제 #1
0
        async public Task <DiagnosticAccessStatus> GetAccessStatus()
        {
            // Request user consent to use the diagnostic APIs.
            DiagnosticAccessStatus accessStatus = await AppDiagnosticInfo.RequestAccessAsync();

            return(accessStatus);
        }
예제 #2
0
        private async void Grid_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                Windows.Storage.StorageFolder storageFolder = Windows.Storage.ApplicationData.Current.LocalFolder;
                Windows.Storage.StorageFile   sampleFile    = await storageFolder.GetFileAsync("pass.txt");

                var lp = (await Windows.Storage.FileIO.ReadTextAsync(sampleFile)).Split('\n');
                singlton.api.Authorize(new ApiAuthParams()
                {
                    Login         = lp[1],
                    Password      = lp[0],
                    ApplicationId = singlton.appId,
                    Settings      = Settings.All
                });
            }
            catch (Exception ex)
            {
                answTextBlock.Text = ex.Message;
            }
            DiagnosticAccessStatus diagnosticAccessStatus = await AppDiagnosticInfo.RequestAccessAsync();

            var requestStatus = await Windows.ApplicationModel.Background.BackgroundExecutionManager.RequestAccessAsync();

            DispatcherTimer timer = new DispatcherTimer()
            {
                Interval = new TimeSpan(0, 0, 0, 20, 0)
            };

            timer.Tick += Timer_Tick;
            timer.Start();
        }
예제 #3
0
        public async static void RequestAccessAsync()
        {
            DiagnosticAccessStatus diagnosticAccessStatus =
                await AppDiagnosticInfo.RequestAccessAsync();

            switch (diagnosticAccessStatus)
            {
            case DiagnosticAccessStatus.Allowed:
                Debug.WriteLine("We can get diagnostics for all apps.");
                break;

            case DiagnosticAccessStatus.Limited:
                Debug.WriteLine("We can only get diagnostics for this app package.");
                break;
            }
        }
        private async Task <bool> GetRequest()
        {
            DiagnosticAccessStatus temp = await AppDiagnosticInfo.RequestAccessAsync();

            switch (temp)
            {
            case DiagnosticAccessStatus.Allowed:
            {
                GetProcessRequest.IsEnabled = false;
                break;
            }

            case DiagnosticAccessStatus.Limited:
            {
                AppDiagnosticInfo.RequestAccessAsync();
                GetProcessRequest.IsEnabled = true;
                return(true);
            }
            }
            return(false);
        }
 private async void Page_Loaded(object sender, RoutedEventArgs e)
 {
     DiagnosticAccessStatus diagnosticAccessStatus = await AppDiagnosticInfo.RequestAccessAsync();
 }