Example #1
0
        public async Task <List <CloudEntity> > GetCloudEntities1(
            DatastoreService dataStore, string projectId,
            KindName kindName, Offset offset, ResultsLimit skip, DateTime dateAdded)
        {
            var res = dataStore.Projects.RunQuery(
                getQueryRequest(dateAdded, kindName), projectId);

            var response = await res.ExecuteAsync();

            var entityResults = response.Batch.EntityResults;

            var toReturn = new List <CloudEntity>();

            foreach (var entityResult in response.Batch.EntityResults)
            {
                var entity      = entityResult.Entity;
                var path        = entity.Key.Path.FirstOrDefault();
                var cloudEntity = new CloudEntity()
                {
                    FormName     = path.Kind,
                    Id           = path.Name,
                    EntityId     = entity.Properties["entityid"].StringValue,
                    DataBlob     = entity.Properties["datablob"].StringValue,
                    KindMetaData = entity.Properties["kindmetadata"].StringValue,

                    //EditDay = Convert.ToInt32( entity.Properties["editday"].IntegerValue),
                    //EditDate = Convert.ToInt64(entity.Properties["editdate"].IntegerValue),

                    //{ "editday", new Value() { IntegerValue = now.toYMDInt() } },
                    //{ "editdate", new Value() { IntegerValue = now.ToBinary() } },

                    //DateAdded = Convert.ToDateTime(
                    //    entity.Properties["dateadded"].TimestampValue)
                };

                if (entity.Properties.ContainsKey("editdate"))
                {
                    var editDate = entity.Properties["editdate"].IntegerValue;
                    cloudEntity.EditDate = Convert.ToInt64(editDate);

                    var editDay = entity.Properties["editday"].IntegerValue;
                    cloudEntity.EditDay = Convert.ToInt32(editDay);
                }
                else
                {
                    //use field date added
                    var entityDate = Convert.ToDateTime(
                        entity.Properties["dateadded"].TimestampValue);
                    var editday = entityDate.toYMDInt();
                    cloudEntity.EditDay = editday;

                    var local    = entityDate.ToLocalTime();
                    var editdate = local.ToBinary();
                    cloudEntity.EditDate = editdate;
                }

                toReturn.Add(cloudEntity);
            }
            return(toReturn);
        }
Example #2
0
        /// <summary>
        /// Imports entities into Google Cloud Datastore. Existing entities with thesame key are overwritten. The import occurs in the background and itsprogress can be monitored and managed via the Operation resource that iscreated. If an ImportEntities operation is cancelled, it is possiblethat a subset of the data has already been imported to Cloud Datastore.
        /// Documentation https://developers.google.com/datastore/v1beta1/reference/projects/import
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Datastore service.</param>
        /// <param name="projectId">Project ID against which to make the request.</param>
        /// <param name="body">A valid Datastore v1beta1 body.</param>
        /// <returns>GoogleLongrunningOperationResponse</returns>
        public static GoogleLongrunningOperation Import(DatastoreService service, string projectId, GoogleDatastoreAdminV1beta1ImportEntitiesRequest body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (projectId == null)
                {
                    throw new ArgumentNullException(projectId);
                }

                // Make the request.
                return(service.Projects.Import(body, projectId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Projects.Import failed.", ex);
            }
        }
Example #3
0
        private async Task <Key> SaveToCloud(DatastoreService datastore, string projectId, Entity entity)
        {
            var trxbody         = new BeginTransactionRequest();
            var beginTrxRequest = datastore.Projects.BeginTransaction(trxbody, projectId);
            var res             = await beginTrxRequest.ExecuteAsync();

            var trxid = res.Transaction;

            var commitRequest = new CommitRequest();

            commitRequest.Mutations = new List <Mutation>()
            {
                new Mutation()
                {
                    Upsert = entity
                }
            };
            commitRequest.Transaction = trxid;
            var commmitReq = datastore.Projects.Commit(commitRequest, projectId);

            var commitExec = await commmitReq.ExecuteAsync();

            var res1 = commitExec.MutationResults.FirstOrDefault();

            return(res1.Key);
        }
Example #4
0
        public async Task <int> doServerSync(KindName kindName, string projectId, DatastoreService datastore)
        {
            var  offset          = 0;
            var  skip            = 500;
            var  lastDateForKind = getMostRecentDate(kindName);
            bool hasData;

            do
            {
                var cloudEntities = await GetCloudEntities1(datastore,
                                                            projectId,
                                                            kindName,
                                                            new Offset(offset),
                                                            new ResultsLimit(skip),
                                                            lastDateForKind
                                                            );

                hasData = cloudEntities.Count > 0;

                //we save this result
                addToProcessingQueue(cloudEntities);
                offset += skip;
            } while (hasData);
            return(0);
        }
        /// <summary>
        /// Begins a new transaction.
        /// Documentation https://developers.google.com/datastore/v1beta3/reference/projects/beginTransaction
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Datastore service.</param>
        /// <param name="projectId">The ID of the project against which to make the request.</param>
        /// <param name="body">A valid Datastore v1beta3 body.</param>
        /// <returns>BeginTransactionResponseResponse</returns>
        public static BeginTransactionResponse BeginTransaction(DatastoreService service, string projectId, BeginTransactionRequest body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (projectId == null)
                {
                    throw new ArgumentNullException(projectId);
                }

                // Make the request.
                return(service.Projects.BeginTransaction(body, projectId).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Projects.BeginTransaction failed.", ex);
            }
        }
Example #6
0
        /// <summary />
        public static FieldFilter Create <TSourceType>(string name)
            where TSourceType : IDatastoreItem
        {
            var fields = DatastoreService.GetFields(typeof(TSourceType));
            var field  = fields.FirstOrDefault(x => x.Name.Match(name));

            if (field != null)
            {
                if (field.DataType == RepositorySchema.DataTypeConstants.GeoCode)
                {
                    return(new GeoCodeFieldFilter()
                    {
                        Name = field.Name,
                        Comparer = ComparisonConstants.LessThanOrEq,
                        DataType = field.DataType,
                    });
                }
                else
                {
                    return(new FieldFilter()
                    {
                        Name = field.Name,
                        Comparer = ComparisonConstants.Equals,
                        DataType = field.DataType,
                    });
                }
            }
            return(null);
        }
Example #7
0
        private async Task <Key> trainAriaStark(DatastoreService datastore, string projectId)
        {
            var trxbody         = new BeginTransactionRequest();
            var beginTrxRequest = datastore.Projects.BeginTransaction(trxbody, projectId);
            var res             = await beginTrxRequest.ExecuteAsync();

            var trxid  = res.Transaction;
            var entity = new Entity()
            {
                Key = new Key()
                {
                    PartitionId = new PartitionId()
                    {
                        NamespaceId = "", ProjectId = projectId
                    },
                    Path = new List <PathElement>()
                    {
                        new PathElement()
                        {
                            Kind = "jhpsystems",
                            Name = "A8CFCA9D-0B3C-43F7-B7AD-DA21AE79C92F"
                        }
                    }
                },
                Properties = new Dictionary <string, Value>()
                {
                    { "cardserial", new Value()
                      {
                          IntegerValue = 2022
                      } },
                    { "datablob", new Value()
                      {
                          StringValue = "I was once a blob"
                      } },
                    { "registerno", new Value()
                      {
                          IntegerValue = 666
                      } }
                }
            };

            var commitRequest = new CommitRequest();

            commitRequest.Mutations = new List <Mutation>()
            {
                new Mutation()
                {
                    Upsert = entity
                }
            };
            commitRequest.Transaction = trxid;
            var commmitReq = datastore.Projects.Commit(commitRequest, projectId);

            var commitExec = await commmitReq.ExecuteAsync();

            var res1 = commitExec.MutationResults.FirstOrDefault();

            return(res1.Key);
        }
 void PowerOff()
 {
     _gameControl.Stop();
     _gameControl.StartSnow();
     _gameProgramInfoViewItem.ImportedGameProgramInfo.PersistedStateAt = DateTime.MinValue;
     _hud_buttonPower.IsChecked = false;
     DatastoreService.PurgePersistedMachine(_gameProgramInfoViewItem.ImportedGameProgramInfo.GameProgramInfo);
 }
Example #9
0
        public void DoNothing()
        {
            var serviceAccountEmail = "***.apps.googleusercontent.com";

            var certificate = new X509Certificate2(
                @"***-privatekey.p12", "notasecret", X509KeyStorageFlags.Exportable);


            //var t = Google.Apis.Auth.OAuth2.ServiceAccountCredential

            var credential = new ServiceAccountCredential(new ServiceAccountCredential.Initializer(serviceAccountEmail)
            {
                Scopes = new[] {
                    Google.Apis.Datastore.v1beta3.DatastoreService.Scope.Datastore.ToString().ToLower()
                }
            }.FromCertificate(certificate));

            // Create the service.
            var service = new DatastoreService(new BaseClientService.Initializer()
            {
                HttpClientInitializer = credential,
                ApplicationName       = "***",
            });

            var request = new Google.Apis.Datastore.v1beta3.Data
                          .BeginTransactionRequest();
            // GoogleData.BlindWriteRequest();
            var entity = new Entity();

            entity.Key      = new Google.Apis.Datastore.v1beta3.Data.Key();
            entity.Key.Path = new List <Google.Apis.Datastore.v1beta3.Data.PathElement>();
            entity.Key.Path.Add(new Google.Apis.Datastore.v1beta3.Data.PathElement()
            {
                Kind = "KindTest", Name = "name"
            });
            var firstName = new Google.Apis.Datastore.v1beta3.Data.PropertyReference();//.Property();

            //firstName.
            //firstName.Values = new List<Google.Apis.Datastore.v1beta3.Data.Value>();
            //firstName. .Values.Add(new Google.Apis.Datastore.v1beta3.Data.Value { StringValue = "FName" });
            entity.Properties = new Dictionary <string, Google.Apis.Datastore.v1beta3.Data.Value>();
            entity.Properties["firstName"] = new
                                             Google.Apis.Datastore.v1beta3.Data.Value {
                StringValue = "FName"
            };

            entity.Properties.Add("FirstName", new
                                  Google.Apis.Datastore.v1beta3.Data.Value
            {
                StringValue = "FName"
            });

            //request.Mutation = new Mutation();
            //request.Mutation.Upsert = new List<Entity>();
            //request.Mutation.Upsert.Add(entity);

            //var response = service.Datasets.BlindWrite(request, "***").Execute();
        }
Example #10
0
        public GoogleCloudDatastore(string connectionStringName)
        {
            var connString = ConfigurationManager.ConnectionStrings[connectionStringName].ConnectionString;
            _connStringParts = connString.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries)
                .Select(t => t.Split(new char[] { '=' }, 2))
                .ToDictionary(t => t[0].Trim(), t => t[1].Trim(), StringComparer.InvariantCultureIgnoreCase);

            _service = new DatastoreService(new BaseClientService.Initializer() { Authenticator = CreateAuthenticator() });
        }
Example #11
0
        List <Key> allocateIds(DatastoreService datasstore, List <Key> keys, string projectId)
        {
            var alloc = new AllocateIdsRequest()
            {
                Keys = keys
            };
            var worker = datasstore.Projects.AllocateIds(alloc, projectId);
            var res    = worker.Execute();

            return(keys);
        }
Example #12
0
        public FetchCloudDataWorker(DatastoreService dataStore, string projectId, KindName kindName, ResultsLimit skip, long editDate, bool fetchOldData)
        {
            query = getQueryRequest1(skip, editDate, fetchOldData, kindName);
            res   = dataStore.Projects.RunQuery(query
                                                , projectId);

            _dataStore    = dataStore;
            _projectId    = projectId;
            _kindName     = kindName;
            _skip         = skip;
            _editDate     = editDate;
            _fetchOldData = fetchOldData;
        }
Example #13
0
        private static void Main(string[] args)
        {
            if (args.Length < 1)
            {
                string binPath = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
                Console.WriteLine(String.Format(_usage, System.IO.Path.GetFileName(binPath)));
                return;
            }
            var projectId = args[0];
            // Use Application Default Credentials.
            var credentials = Google.Apis.Auth.OAuth2.GoogleCredential
                              .GetApplicationDefaultAsync().Result;

            credentials = credentials.CreateScoped(new[] {
                DatastoreService.Scope.Datastore,
                DatastoreService.Scope.UserinfoEmail,
            });
            // Create our connection to datastore.
            var datastore = new DatastoreService(new Google.Apis.Services
                                                 .BaseClientService.Initializer()
            {
                HttpClientInitializer = credentials,
            });

            var query = new Query()
            {
                Limit = 100,
                Kinds = new[] { new KindExpression()
                                {
                                    Name = "Book"
                                } },
            };

            var datastoreRequest = datastore.Datasets.RunQuery(
                datasetId: projectId,
                body: new RunQueryRequest()
            {
                Query = query
            }
                );

            var response = datastoreRequest.Execute();
            var results  = response.Batch.EntityResults;

            foreach (var result in results)
            {
                Property value;
                bool     found = result.Entity.Properties.TryGetValue("Title", out value);
                Console.WriteLine(value.StringValue);
            }
        }
 /// <summary>
 /// Create a new datastore-backed bookstore.
 /// </summary>
 /// <param name="projectId">Your Google Cloud project id</param>
 public DatastoreBookStore(string projectId)
 {
     _projectId = projectId;
     // Use Application Default Credentials.
     var credentials = Google.Apis.Auth.OAuth2.GoogleCredential
         .GetApplicationDefaultAsync().Result;
     credentials = credentials.CreateScoped(new[] {
         DatastoreService.Scope.Datastore
     });
     // Create our connection to datastore.
     _datastore = new DatastoreService(new Google.Apis.Services
         .BaseClientService.Initializer()
     {
         HttpClientInitializer = credentials,
     });
 }
        public override void OnNavigatingAway()
        {
            base.OnNavigatingAway();

            if (_isAlreadyNavigatedAway)
            {
                return;
            }
            _isAlreadyNavigatedAway = true;
            _isAlreadyNavigatedHere = false;

            DatastoreService.SaveSettings(_settings);
            _gameControl.Stop();

            HideHud();

            _buttonBack.IsVisible     = !_isTooNarrowForHud;
            _buttonSettings.IsVisible = !_isTooNarrowForHud;
        }
Example #16
0
        /// <summary />
        public static FieldSort Create <TSourceType>(string name, bool asc = true)
            where TSourceType : IDatastoreItem
        {
            var fields = DatastoreService.GetFields(typeof(TSourceType));
            var field  = fields.FirstOrDefault(x => x.Name.Match(name));

            if (field != null)
            {
                if (field.DataType == RepositorySchema.DataTypeConstants.GeoCode ||
                    field.DataType == RepositorySchema.DataTypeConstants.List)
                {
                    return(null);
                }
                return(new FieldSort {
                    Name = field.Name, SortDirection = (asc ? SortDirectionConstants.Asc : SortDirectionConstants.Desc)
                });
            }
            return(null);
        }
 /// <summary>
 /// Create a new datastore-backed bookstore.
 /// </summary>
 /// <param name="projectId">Your Google Cloud project id</param>
 public DatastoreBookStore(string projectId)
 {
     _projectId = projectId;
     // Use Application Default Credentials.
     var credentials = Google.Apis.Auth.OAuth2.GoogleCredential
         .GetApplicationDefaultAsync().Result;
     if (credentials.IsCreateScopedRequired)
     {
         credentials = credentials.CreateScoped(new[] {
             DatastoreService.Scope.Datastore,
             DatastoreService.Scope.UserinfoEmail
         });
     }
     // Create our connection to datastore.
     _datastore = new DatastoreService(new Google.Apis.Services
         .BaseClientService.Initializer()
     {
         HttpClientInitializer = credentials,
         ApplicationName = "Bookshelf.NET-Step3"
     });
 }
        /// <summary>
        /// Create a new datastore-backed bookstore.
        /// </summary>
        /// <param name="projectId">Your Google Cloud project id</param>
        public DatastoreBookStore(string projectId)
        {
            _projectId = projectId;
            // Use Application Default Credentials.
            var credentials = Google.Apis.Auth.OAuth2.GoogleCredential
                              .GetApplicationDefaultAsync().Result;

            if (credentials.IsCreateScopedRequired)
            {
                credentials = credentials.CreateScoped(new[] {
                    DatastoreService.Scope.Datastore,
                    DatastoreService.Scope.UserinfoEmail
                });
            }
            // Create our connection to datastore.
            _datastore = new DatastoreService(new Google.Apis.Services
                                              .BaseClientService.Initializer()
            {
                HttpClientInitializer = credentials,
            });
        }
Example #19
0
 static void SettingsCheck()
 {
     DatastoreService.GetSettings();
 }
Example #20
0
 public TodosController(ILogger logger, DatastoreService datastoreService, EventConsumerService eventConsumerService)
 {
     _logger               = logger;
     _datastoreService     = datastoreService;
     _eventConsumerService = eventConsumerService;
 }
Example #21
0
        public async Task <int> fetchRecordsForKind(KindName kindName, string projectId, DatastoreService datastore)
        {
            var skip            = 50;
            var lastDateForKind = getLastSyncedDateForKind(kindName);

            var cloudEntities = await new FetchCloudDataWorker(datastore,
                                                               projectId,
                                                               kindName,
                                                               new ResultsLimit(skip),
                                                               lastDateForKind, this.FetchOldData)
                                .beginFetchCloudData();

            if (cloudEntities.Count > 0)
            {
                var savedToLocal = await addToProcessingQueue(kindName, cloudEntities);
            }
            return(0);
        }
Example #22
0
 public CreateTodoCommandHandlerController(DatastoreService datastoreService, IOptions <Config> config)
 {
     _datastoreService = datastoreService;
     _config           = config.Value;
 }
        public GamePage(GameProgramInfoViewItem gameProgramInfoViewItem, bool startFresh = false)
        {
            _gameProgramInfoViewItem = gameProgramInfoViewItem ?? throw new ArgumentNullException(nameof(gameProgramInfoViewItem));
            _startFreshReq           = startFresh;

            _settings = DatastoreService.GetSettings();

            _gameControl = new GameControl();
            _buttonBack  = new BackButton
            {
                Location = new(5, 5)
            };
            _buttonSettings = new SettingsButton
            {
                Location = _buttonBack.ToRightOf(25, 0)
            };
            _labelInfoText = new LabelControl
            {
                TextFontFamilyName = Styles.ExtraLargeFontFamily,
                TextFontSize       = Styles.ExtraLargeFontSize,
                TextAlignment      = DWriteTextAlignment.Center,
                Text      = string.Empty,
                IsVisible = false
            };

            _hud_buttonPower = new ButtonToggle
            {
                Text      = "Power",
                Size      = new(HudButtonWidth, HudButtonHeight),
                IsChecked = true
            };
            _hud_buttonColor = new Button
            {
                Text = "Color",
                Size = new(HudButtonWidth, HudButtonHeight)
            };
            _hud_buttonLD = new ButtonToggle
            {
                Text = "A/b",
                Size = new(HudButtonWidth, HudButtonHeight)
            };
            _hud_buttonRD = new ButtonToggle
            {
                Text = "A/b",
                Size = new(HudButtonWidth, HudButtonHeight)
            };
            _hud_buttonSelect = new Button
            {
                Text = "Select",
                Size = new(HudButtonWidth, HudButtonHeight)
            };
            _hud_buttonReset = new Button
            {
                Text = "Reset",
                Size = new(HudButtonWidth, HudButtonHeight)
            };
            _hud_buttonSound = new ButtonToggle
            {
                Text = "Sound",
                Size = new(HudButtonWidth, HudButtonHeight)
            };
            _hud_buttonPaused = new ButtonToggle
            {
                Text = "Paused",
                Size = new(HudButtonWidth, HudButtonHeight)
            };
            _hud_buttonAntiAliasMode = new ButtonToggle
            {
                Text = "Fuzzy",
                Size = new(HudButtonWidth, HudButtonHeight)
            };
            _hud_buttonClose      = new CheckButton();
            _hud_numbercontrolFPS = new()
            {
                TextFontFamilyName = Styles.ExtraLargeFontFamily,
                TextFontSize       = Styles.ExtraLargeFontSize
            };
            _hud_labelFPS = new()
            {
                TextFontFamilyName = Styles.ExtraLargeFontFamily,
                TextFontSize       = Styles.ExtraLargeFontSize,
                Text = "FPS",
                Size = new(100, 50)
            };
            _hud_controllers = new()
            {
                TextFontFamilyName = Styles.SmallFontFamily,
                TextFontSize       = Styles.SmallFontSize,
                TextAlignment      = DWriteTextAlignment.Center,
                Text = string.Empty,
            };
            _hud_buttonFpsMinus = new MinusButton();
            _hud_buttonFpsPlus  = new PlusButton();
            _hud_buttonInput    = new Button
            {
                Text = "Input",
                Size = new(HudButtonWidth, HudButtonHeight)
            };
            _hud_buttonShowTouchControls = new ButtonToggle
            {
                Text = "Touch Controllers",
                Size = new(2 * HudButtonWidth + HudGapX, HudButtonHeight)
            };

            _hud_controlCollection = new ControlCollection();
            _hud_controlCollection.Add(_hud_buttonPower, _hud_buttonColor, _hud_buttonLD, _hud_buttonRD, _hud_buttonSelect,
                                       _hud_buttonReset, _hud_buttonClose, _hud_buttonSound, _hud_buttonPaused, _hud_numbercontrolFPS, _hud_labelFPS, _hud_controllers,
                                       _hud_buttonAntiAliasMode, _hud_buttonFpsMinus, _hud_buttonFpsPlus, _hud_buttonShowTouchControls, _hud_buttonInput);
            _hud_controlCollection.IsVisible = false;

            _touchbuttonLeft = new LeftButton {
                ExpandBoundingRectangleVertically = true
            };
            _touchbuttonRight = new RightButton {
                ExpandBoundingRectangleVertically = true
            };
            _touchbuttonUp = new UpButton {
                ExpandBoundingRectangleHorizontally = true
            };
            _touchbuttonDown = new DownButton {
                ExpandBoundingRectangleHorizontally = true
            };
            _touchbuttonFire       = new FireButton();
            _touchbuttonFire2      = new FireButton();
            _touchbuttonCollection = new ControlCollection();
            _touchbuttonCollection.Add(_touchbuttonLeft, _touchbuttonRight, _touchbuttonUp, _touchbuttonDown, _touchbuttonFire, _touchbuttonFire2);

            _gameControl.IsInTouchMode = _touchbuttonCollection.IsVisible = _settings.ShowTouchControls;

            Controls.Add(_gameControl, _labelInfoText, _hud_controlCollection, _touchbuttonCollection);

            if (!_startFreshReq)
            {
                Controls.Add(_buttonBack, _buttonSettings);
            }

            ResetBackAndSettingsButtonVisibilityCounter();

#if PROFILE
            _numbercontrolRefreshRate = new NumberControl {
                Radix = 1, UseComma = false
            };
            Controls.Add(_numbercontrolRefreshRate);
#endif

            _buttonBack.Clicked     += ButtonBack_Clicked;
            _buttonSettings.Clicked += ButtonSettings_Clicked;

            _hud_buttonClose.Clicked               += (s, e) => HideHud();
            _hud_buttonSound.Checked               += (s, e) => _gameControl.IsSoundOn = true;
            _hud_buttonSound.Unchecked             += (s, e) => _gameControl.IsSoundOn = false;
            _hud_buttonPaused.Checked              += (s, e) => _gameControl.IsPaused = true;
            _hud_buttonPaused.Unchecked            += (s, e) => _gameControl.IsPaused = false;
            _hud_buttonAntiAliasMode.Checked       += (s, e) => _gameControl.IsAntiAliasOn = true;
            _hud_buttonAntiAliasMode.Unchecked     += (s, e) => _gameControl.IsAntiAliasOn = false;
            _hud_buttonShowTouchControls.Checked   += (s, e) => HandleShowTouchControlsCheckedChanged(true);
            _hud_buttonShowTouchControls.Unchecked += (s, e) => HandleShowTouchControlsCheckedChanged(false);
            _hud_buttonInput.Clicked               += Hud_buttonInput_Clicked;

            _hud_buttonPower.Checked   += Hud_buttonPower_Checked;
            _hud_buttonPower.Unchecked += Hud_buttonPower_Unchecked;
            _hud_buttonColor.Pressed   += (s, e) => RaiseMachineInputFromHud(MachineInput.Color, true);
            _hud_buttonColor.Released  += (s, e) => RaiseMachineInputFromHud(MachineInput.Color, false);
            _hud_buttonLD.Pressed      += (s, e) => RaiseMachineInputFromHud(MachineInput.LeftDifficulty, true);
            _hud_buttonLD.Released     += (s, e) => RaiseMachineInputFromHud(MachineInput.LeftDifficulty, false);
            _hud_buttonRD.Pressed      += (s, e) => RaiseMachineInputFromHud(MachineInput.RightDifficulty, true);
            _hud_buttonRD.Released     += (s, e) => RaiseMachineInputFromHud(MachineInput.RightDifficulty, false);
            _hud_buttonSelect.Pressed  += (s, e) => RaiseMachineInputFromHud(MachineInput.Select, true);
            _hud_buttonSelect.Released += (s, e) => RaiseMachineInputFromHud(MachineInput.Select, false);
            _hud_buttonReset.Pressed   += (s, e) => RaiseMachineInputFromHud(MachineInput.Reset, true);
            _hud_buttonReset.Released  += (s, e) => RaiseMachineInputFromHud(MachineInput.Reset, false);

            _touchbuttonLeft.Pressed   += (s, e) => RaiseKeyboardKeyPressed(KeyboardKey.Left, true);
            _touchbuttonLeft.Released  += (s, e) => RaiseKeyboardKeyPressed(KeyboardKey.Left, false);
            _touchbuttonRight.Pressed  += (s, e) => RaiseKeyboardKeyPressed(KeyboardKey.Right, true);
            _touchbuttonRight.Released += (s, e) => RaiseKeyboardKeyPressed(KeyboardKey.Right, false);
            _touchbuttonUp.Pressed     += (s, e) => RaiseKeyboardKeyPressed(KeyboardKey.Up, true);
            _touchbuttonUp.Released    += (s, e) => RaiseKeyboardKeyPressed(KeyboardKey.Up, false);
            _touchbuttonDown.Pressed   += (s, e) => RaiseKeyboardKeyPressed(KeyboardKey.Down, true);
            _touchbuttonDown.Released  += (s, e) => RaiseKeyboardKeyPressed(KeyboardKey.Down, false);
            _touchbuttonFire.Pressed   += (s, e) => RaiseKeyboardKeyPressed(KeyboardKey.Z, true);
            _touchbuttonFire.Released  += (s, e) => RaiseKeyboardKeyPressed(KeyboardKey.Z, false);
            _touchbuttonFire2.Pressed  += (s, e) => RaiseKeyboardKeyPressed(KeyboardKey.X, true);
            _touchbuttonFire2.Released += (s, e) => RaiseKeyboardKeyPressed(KeyboardKey.X, false);
        }
Example #24
0
        public void Initialize()
        {
            var connString = ConfigurationManager.ConnectionStrings["Pogo"].ConnectionString;
            _connStringParts = connString.Split(';')
                .Select(t => t.Split(new char[] { '=' }, 2))
                .ToDictionary(t => t[0].Trim(), t => t[1].Trim(), StringComparer.InvariantCultureIgnoreCase);

            _datasetId = _connStringParts["DatasetId"];

            _service = new DatastoreService(new BaseClientService.Initializer() { Authenticator = CreateAuthenticator() });
        }
Example #25
0
 NaiveJoiner(DatastoreService datastore)
 {
     _datastore = datastore;
 }