コード例 #1
0
 private void bGeneratePassword_Click(object sender, RoutedEventArgs e)
 {
     TableServiceContext tsc = new TableServiceContext("http://wakslab1.table.core.windows.net", new Microsoft.Samples.WindowsPhoneCloud.StorageClient.Credentials.StorageCredentialsAccountAndKey("wakslab1", "a6cxCi2PBeIVJSjvo6g5JvPY7vg804Nu6yXQoNP/LCnc1bJPe6rMqNsCju3el9AdcAaloM9ke474UfTfe+MWKg=="));
     CloudTableClient ctc = new CloudTableClient(tsc);
     ctc.CreateTableIfNotExist("NewTable1", delegate { result(); });
     try
     {
         bool? requiresNumber = cbNumber.IsChecked;
         bool? requiresSpecialCharacter = cbSpecialCharacter.IsChecked;
         int minLength = Convert.ToInt32(tbMinimumLength.Text);
         int maxLength = Convert.ToInt32(tbMaximumLength.Text);
         tbPassword.Text = RandomPassword.Generate(minLength, maxLength, requiresNumber.Value, requiresSpecialCharacter.Value);
     }
     catch
     {
         MessageBox.Show("Invalid Number");
         return;
     }
 }
コード例 #2
0
 private void RegisterDevice(Guid applicationId, string deviceId, Guid adControlDeviceId)
 {
     var newAppDevice = new AppDevice(applicationId, deviceId, _appTitle) { AdControlDeviceId = adControlDeviceId };
     _tableContext = new TableServiceContext(TableServiceUri, _credentials);
     _tableContext.AddObject(AppDeviceTableName, newAppDevice);
     _tableContext.BeginSaveChanges(SaveChangesOptions.ContinueOnError, SaveChangesCallback, null);
 }
コード例 #3
0
        public Tracker()
        {
            _applicationId = IdUtil.ApplicationId();
            _deviceId = IdUtil.DeviceId();
            _anid = IdUtil.GetAnidFromOs();
            _appTitle = IdUtil.ApplicationName();
            _adsRefreshRate = 3;
            _pubCenterAdsId = new List<string>();
            _adsReady = false;

            // Due to Disallowed key in RowKey, /, \, #, ? needs to be removed
            // And excel cannot allow "=" at the beginning
            foreach (string s in _invalidRowKeyChar)
            {
                _deviceId = _deviceId.Replace(s, string.Empty);
                if (_deviceId.Substring(0, 1) == "=")
                {
                    _deviceId = "x" + _deviceId;
                }
            }

            GetAdAssemblyVersion();
            RefreshIpInfo();

            _credentials = new StorageCredentialsAccountAndKey(StorageAccount, StorageKey);
            _tableContext = new TableServiceContext(TableServiceUri, _credentials);

            //EnsureTablesCreated();
            //DownloadWebAppConfigFile();
            //CreateAdsRequestEngine();
            //IdUtil.GetAnidFromOs();
        }
コード例 #4
0
        private void EnsureTablesCreated()
        {
            _tableContext = new TableServiceContext(TableServiceUri, _credentials);
            var tableClient = new CloudTableClient(_tableContext);

            tableClient.CreateTableIfNotExist(AppDeviceTableName, null);
            tableClient.CreateTableIfNotExist(AppUsageTableName, null);
            tableClient.CreateTableIfNotExist(AppAgreementTableName, null);
            tableClient.CreateTableIfNotExist(AppReviewTableName, null);
        }
コード例 #5
0
 public void ReportImpressionInfo(string pubId, string adUnitId)
 {
     // Reason to put this part of the code in a worker thread:
     // 1) CPU optimization
     // 2) WaitOne cannot happen in UI thread or else the whole app will be hual
     ThreadPool.QueueUserWorkItem(
         state =>
             {
                 _ipRefreshedEvent.WaitOne();
                 var newAppUsage = new AppUsage(_applicationId, _anid, _deviceId, _appTitle)
                                       {
                                           AdControlDeviceId = _adControlDeviceId,
                                           AdUnitId = adUnitId,
                                           AssemblyFileVersion = _assemblyVersion,
                                           IpAddress = _ipAddress,
                                           Country = _country,
                                           Region = _region,
                                           City = _city,
                                           Isp = _isp,
                                           PubId = pubId,
                                           Action = "Impress"
                                       };
                 _tableContext = new TableServiceContext(TableServiceUri, _credentials);
                 _tableContext.AddObject(AppUsageTableName, newAppUsage);
                 _tableContext.BeginSaveChanges(SaveChangesOptions.ContinueOnError, SaveChangesCallback, null);
             });
 }
コード例 #6
0
 public void ReportErrorInfo(string pubId, string adUnitId, string errorMessage)
 {
     ThreadPool.QueueUserWorkItem(
         state =>
             {
                 _ipRefreshedEvent.WaitOne();
                 var newAppUsage = new AppUsage(_applicationId, _anid, _deviceId, _appTitle)
                                       {
                                           AdControlDeviceId = _adControlDeviceId,
                                           AdUnitId = adUnitId,
                                           AssemblyFileVersion = _assemblyVersion,
                                           IpAddress = _ipAddress,
                                           Country = _country,
                                           Region = _region,
                                           City = _city,
                                           Isp = _isp,
                                           PubId = pubId,
                                           Action = "Error",
                                           Message = errorMessage
                                       };
                 _tableContext = new TableServiceContext(TableServiceUri, _credentials);
                 _tableContext.AddObject(AppUsageTableName, newAppUsage);
                 _tableContext.BeginSaveChanges(SaveChangesOptions.ContinueOnError, SaveChangesCallback, null);
             });
 }
コード例 #7
0
 public void ReportAppReviewInfo(int rating, string reviewMessage)
 {
     ThreadPool.QueueUserWorkItem(
         state =>
         {
             _ipRefreshedEvent.WaitOne();
             var newAppReview = new AppReview(_applicationId, _deviceId, _appTitle, rating, reviewMessage)
             {
                 IpAddress = _ipAddress,
                 Country = _country,
                 Region = _region,
                 City = _city,
                 Isp = _isp,
             };
             _tableContext = new TableServiceContext(TableServiceUri, _credentials);
             _tableContext.AddObject(AppReviewTableName, newAppReview);
             _tableContext.BeginSaveChanges(SaveChangesOptions.ContinueOnError, SaveChangesCallback, null);
         });
 }
コード例 #8
0
 public void ReportEngagedInfo(string pubId, string adUnitId)
 {
     ThreadPool.QueueUserWorkItem(
         state =>
         {
             _ipRefreshedEvent.WaitOne();
             var newPartitionKey = (DateTime.MaxValue.Ticks - DateTime.UtcNow.Ticks).ToString("d19");
             var newAppUsage = new AppUsage(newPartitionKey, _anid, _deviceId, _appTitle)
             {
                 AdControlDeviceId = _adControlDeviceId,
                 AdUnitId = adUnitId,
                 AssemblyFileVersion = _assemblyVersion,
                 IpAddress = _ipAddress,
                 Country = _country,
                 Region = _region,
                 City = _city,
                 Isp = _isp,
                 PubId = pubId,
                 Action = "Engaged"
             };
             _tableContext = new TableServiceContext(TableServiceUri, _credentials);
             _tableContext.AddObject(AppUsageTableName, newAppUsage);
             _tableContext.BeginSaveChanges(SaveChangesOptions.ContinueOnError, SaveChangesCallback, null);
         });
 }