public void Insert(MobileServiceTable <SpawnFlag> table, SpawnFlag item) { // Inserts new spawn flag into Azure table if (Validate(item)) { table.Insert <SpawnFlag>(item, OnInsertCompleted); } }
private void LoadListings() { if (NoNetwork() == true) { MessageBox.Show("A network connection can not be established.\r\nPlease press refresh or check your network settings."); return; } else { listBoxVideos.ItemsSource = ""; usrList = new GlobalVideoList(); usrList.usrInfo = new List<GlobalVideos>(); //Async table from Azure usrStatusTable = mobileServiceClient.GetTable<GlobalVideos>(); //Get Data and Bind them to list Box usrStatusTable.GetAll((res, err) => { if (err != null) { Random ra = new Random(); //handle it return; } foreach (GlobalVideos usrs in res) { usrList.usrInfo.Add(usrs); } listBoxVideos.ItemsSource = usrList.usrInfo.OrderByDescending(usrs => usrs.Date); }); } }
public void BeginUpdate(Dispatcher dispatcher) { this.dispatcher = dispatcher; IsUpdating = true; ThreadPool.QueueUserWorkItem(delegate { List <TodoItem> entries = new List <TodoItem>(); // = TaskManager.GetTasks(); MobileServiceTable <TodoItem> todoItemTable = App.MobileServiceClient.GetTable <TodoItem>(); todoItemTable.GetAll((res, err) => { if (err != null) { //handle it return; } foreach (TodoItem tdi in res) { entries.Add(tdi); } PopulateData(entries); }); }); }
// Use this for initialization void Start() { drop.SetActive(false); anoms = new List <Anomaly>(); anomDevices = new List <string>(); // Create App Service client _client = new MobileServiceClient(_appUrl); // Get App Service 'Telemetry' table _table = _client.GetTable <Telemetry>("Telemetry"); _anomalies = _client.GetTable <Anomaly>("Telemetry"); anomSkip = 0; ID = ""; end = DateTime.UtcNow.ToString(); start = DateTime.UtcNow.Subtract(new TimeSpan(0, 2, 0)).ToString(); times = new string[2] { " ", " " }; tableVals = new float[attributes.Length * tableStats]; graphVals = new Dictionary <string, float[]>(); telGlobal = new Dictionary <string, float[]>(); foreach (string attribute in attributes) { graphVals.Add(attribute, null); telGlobal.Add(attribute, null); } ResetData(); }
/** * Initializes the activity */ protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(R.Layouts.activity_to_do); mProgressBar = (ProgressBar)FindViewById(R.Ids.loadingProgressBar); // Initialize the progress bar mProgressBar.SetVisibility(ProgressBar.GONE); try { // Create the Mobile Service Client instance, using the provided // Mobile Service URL and key mClient = new MobileServiceClient( "https://stamware.azure-mobile.net/", "uPPxchIAQYbawiaTKKfmrjsYjCNVPj40", this).WithFilter(new ProgressFilter(this)); // Get the Mobile Service Table instance to use mToDoTable = mClient.GetTable <ToDoItem>(typeof(ToDoItem)); mTextNewToDo = (EditText)FindViewById(R.Ids.textNewToDo); // Create an adapter to bind the items with the view mAdapter = new ToDoItemAdapter(this, R.Layouts.row_list_to_do); ListView listViewToDo = (ListView)FindViewById(R.Ids.listViewToDo); listViewToDo.SetAdapter(mAdapter); // Load the items from the Mobile Service RefreshItemsFromTable(); } catch (MalformedURLException e) { CreateAndShowDialog(new Exception("There was an error creating the Mobile Service. Verify the URL"), "Error"); } }
public void Start() { setCredentials(); client = new MobileServiceClient(appUrl, appKey); table = client.GetTable<Highscore>("Highscores"); QueryItemsByScore(); }
protected async override Task ProcessTableAsync() { await CreatePullStrategy(); this.Table.SystemProperties |= MobileServiceSystemProperties.Deleted; QueryResult result; do { this.CancellationToken.ThrowIfCancellationRequested(); string query = this.Query.ToODataString(); if (this.Query.UriPath != null) { query = MobileServiceUrlBuilder.CombinePathAndQuery(this.Query.UriPath, query); } result = await this.Table.ReadAsync(query, MobileServiceTable.IncludeDeleted(parameters), this.Table.Features); await this.ProcessAll(result.Values); // process the first batch result = await FollowNextLinks(result); } // if we are not at the end of result and there is no link to get more results while (!this.EndOfResult(result) && await this.strategy.MoveToNextPageAsync()); await this.strategy.PullCompleteAsync(); }
public static void SaveTask(TodoItem task) { MobileServiceTable <TodoItem> todoItemTable = App.MobileServiceClient.GetTable <TodoItem>(); if (task.Id >= 0) { var update = new JObject(); update["id"] = task.Id; update["text"] = task.Text; update["complete"] = task.Complete; todoItemTable.Update(update, err => { if (err != null) { Console.WriteLine("UPDATE FAILED"); } }); } else { todoItemTable.Insert(task, (res, err) => { if (err != null) { Console.WriteLine("INSERT FAILED"); return; } Console.WriteLine("SAVED " + res); }); } }
// Use this for initialization void Start() { // Create App Service client _client = new MobileServiceClient(_appUrl); // Get App Service 'Highscores' table _table = _client.GetTable <Inventory> ("Inventory"); // set TSTableView delegate _tableView.dataSource = this; // setup token using Unity Inspector value if (!String.IsNullOrEmpty(_facebookAccessToken)) { InputField inputToken = GameObject.Find("FacebookAccessToken").GetComponent <InputField> (); inputToken.text = _facebookAccessToken; } // hide controls until login CanvasGroup group = GameObject.Find("UserDataGroup").GetComponent <CanvasGroup> (); group.alpha = 0; group.interactable = false; UpdateUI(); }
public void UpdateFlag(MobileServiceTable <SpawnFlag> table, SpawnFlag item) { // Updates item in the table if (Validate(item)) { table.Update <SpawnFlag>(item, OnUpdateFlagCompleted); } }
public void Delete(MobileServiceTable <SpawnFlag> table, SpawnFlag item) { // Deletes spawn flag from azure table if (Validate(item)) { table.Delete <SpawnFlag>(item.id, OnDeleteCompleted); } }
public static void DeleteTask(int taskId) { MobileServiceTable <TodoItem> todoItemTable = App.MobileServiceClient.GetTable <TodoItem>(); todoItemTable.Delete(taskId, err => { if (err != null) { Console.WriteLine("DELETE FAILED"); } }); }
public void Start() { setCredentials(); namePanel.SetActive(false); scoreText.transform.localPosition = new Vector2(0, 140); pgms = gameObject.AddComponent<PregameMenuSingle>(); client = new MobileServiceClient(appUrl, appKey); table = client.GetTable<Highscore>("Highscores"); score = pgms.getScore(); playerText.text = "Your score: " + score; QueryItemsByScore(); }
/// <summary> /// Applies the specified selection to the source query. /// </summary> /// <typeparam name="U"> /// Type representing the projected result of the query. /// </typeparam> /// <param name="selector"> /// The selector function. /// </param> /// <returns> /// The composed query. /// </returns> public IMobileServiceTableQuery <U> Select <U>(Expression <Func <T, U> > selector) { Arguments.IsNotNull(selector, nameof(selector)); // Create a new table with the same name/client but // pretending to be of a different type since the query needs to // have the same type as the table. This won't cause any issues // since we're only going to use it to evaluate the query and it'll // never leak to users. MobileServiceTable <U> table = new MobileServiceTable <U>(Table.TableName, Table.MobileServiceClient); return(QueryProvider.Create(table, Queryable.Select(this.Query, selector), Parameters, RequestTotalCount)); }
public PurgeAction(MobileServiceTable table, MobileServiceTableKind tableKind, string queryId, MobileServiceTableQueryDescription query, bool force, MobileServiceSyncContext context, OperationQueue operationQueue, MobileServiceSyncSettingsManager settings, IMobileServiceLocalStore store, CancellationToken cancellationToken) : base(table, tableKind, queryId, query, null, context, operationQueue, settings, store, cancellationToken) { this.force = force; }
public PurgeAction(MobileServiceTable table, MobileServiceTableKind tableKind, string queryId, MobileServiceTableQueryDescription query, bool force, MobileServiceSyncContext context, OperationQueue operationQueue, MobileServiceSyncSettingsManager settings, IMobileServiceLocalStore store, CancellationToken cancellationToken) : base(table, tableKind, queryId, query, null, context, operationQueue, settings, store, cancellationToken) { this.force = force; }
public IncrementalPullStrategy(MobileServiceTable table, MobileServiceTableQueryDescription query, string queryId, MobileServiceSyncSettingsManager settings, PullCursor cursor, MobileServiceRemoteTableOptions options) : base(query, cursor, options) { this.table = table; this.originalFilter = query.Filter; this.queryId = queryId; this.settings = settings; this.ordered = options.HasFlag(MobileServiceRemoteTableOptions.OrderBy); }
public IncrementalPullStrategy(MobileServiceTable table, MobileServiceTableQueryDescription query, string queryId, MobileServiceSyncSettingsManager settings, PullCursor cursor, MobileServiceRemoteTableOptions options) : base(query, cursor, options) { this.table = table; this.originalFilter = query.Filter; this.queryId = queryId; this.settings = settings; this.ordered = options.HasFlag(MobileServiceRemoteTableOptions.OrderBy); }
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { if (NoNetwork() == false) { mobileServiceClient = new MobileServiceClient("https://bethere.azure-mobile.net/", "XdjbcQDgRsMEXdNKeiKoiILoWNWLJE48"); usrStatusTable = mobileServiceClient.GetTable<GlobalVideos>(); LoadListings(); } else { MessageBox.Show("A network connection can not be established.\r\nPlease press refresh or check your network settings."); return; } }
public PullAction(MobileServiceTable table, MobileServiceTableKind tableKind, MobileServiceSyncContext context, string queryId, MobileServiceTableQueryDescription query, IDictionary <string, string> parameters, IEnumerable <string> relatedTables, OperationQueue operationQueue, MobileServiceSyncSettingsManager settings, IMobileServiceLocalStore store, MobileServiceRemoteTableOptions options, MobileServiceObjectReader reader, CancellationToken cancellationToken) : base(table, tableKind, queryId, query, relatedTables, context, operationQueue, settings, store, cancellationToken) { this.options = options; this.parameters = parameters; this.cursor = new PullCursor(query); this.Reader = reader ?? new MobileServiceObjectReader(); }
// Use this for initialization void Start() { // Create App Service client _client = new MobileServiceClient(_appUrl); // Get App Service 'Highscores' table _table = _client.GetTable <Highscore> ("Highscores"); // set TSTableView delegate _tableView.dataSource = this; // setup token using Unity Inspector value if (!String.IsNullOrEmpty(_facebookAccessToken)) { InputField inputToken = GameObject.Find("FacebookAccessToken").GetComponent <InputField> (); inputToken.text = _facebookAccessToken; } UpdateUI(); }
public TableAction(MobileServiceTable table, MobileServiceTableKind tableKind, string queryId, MobileServiceTableQueryDescription query, IEnumerable <string> relatedTables, MobileServiceSyncContext context, OperationQueue operationQueue, MobileServiceSyncSettingsManager settings, IMobileServiceLocalStore store, CancellationToken cancellationToken) : base(operationQueue, store, cancellationToken) { this.Table = table; this.TableKind = tableKind; this.QueryId = queryId; this.Query = query; this.RelatedTables = relatedTables; this.Settings = settings; this.Context = context; }
public TableAction(MobileServiceTable table, MobileServiceTableKind tableKind, string queryId, MobileServiceTableQueryDescription query, IEnumerable<string> relatedTables, MobileServiceSyncContext context, OperationQueue operationQueue, MobileServiceSyncSettingsManager settings, IMobileServiceLocalStore store, CancellationToken cancellationToken) : base(operationQueue, store, cancellationToken) { this.Table = table; this.TableKind = tableKind; this.QueryId = queryId; this.Query = query; this.RelatedTables = relatedTables; this.Settings = settings; this.Context = context; }
public PullAction(MobileServiceTable table, MobileServiceTableKind tableKind, MobileServiceSyncContext context, string queryId, MobileServiceTableQueryDescription query, IDictionary<string, string> parameters, IEnumerable<string> relatedTables, OperationQueue operationQueue, MobileServiceSyncSettingsManager settings, IMobileServiceLocalStore store, MobileServiceRemoteTableOptions options, MobileServiceObjectReader reader, CancellationToken cancellationToken) : base(table, tableKind, queryId, query, relatedTables, context, operationQueue, settings, store, cancellationToken) { this.options = options; this.parameters = parameters; this.cursor = new PullCursor(query); this.Reader = reader ?? new MobileServiceObjectReader(); }
public static void GetTask(int id, TaskDetailsPage page) { MobileServiceTable <TodoItem> todoItemTable = App.MobileServiceClient.GetTable <TodoItem>(); var query = new MobileServiceQuery() .Filter("id eq '" + id + "'") .Top(1); todoItemTable.Get(query, (res, err) => { if (err != null) { Console.WriteLine("GET FAILED " + id); return; } foreach (TodoItem tdi in res) { page.Task = tdi; // first one return; } }); }
public IMobileServiceTableQuery <U> Select <U>(Expression <Func <T, U> > selector) { if (selector == null) { throw new ArgumentNullException("selector"); } // Create a new table with the same name/client but // pretending to be of a different type since the query needs to // have the same type as the table. This won't cause any issues // since we're only going to use it to evaluate the query and it'll // never leak to users. MobileServiceTable <U> table = new MobileServiceTable <U>( this.Table.TableName, this.Table.MobileServiceClient); return(this.QueryProvider.Create(table, Queryable.Select(this.Query, selector), MobileServiceTable.AddSystemProperties(Table.SystemProperties, this.Parameters), this.RequestTotalCount)); }
void Start() { Debug.Log(FB.IsLoggedIn); Debug.Log(isLoggedIn); // Create App Service client _client = new MobileServiceClient(AzureAppURL); // Get App Service 'Highscores' table _table = _client.GetTable <Userdata> ("Userdata"); if (PlayerPrefs.HasKey("IsAuthenticated") && PlayerPrefs.HasKey("ExistingUser")) { SceneManager.LoadScene("Dashboard"); profileName = PlayerPrefs.GetString("ProfileName"); } else { SceneManager.LoadScene("StartMenu"); } }
// Use this for initialization void Start() { // Create App Service client (Using factory Create method to force 'https' url) _client = MobileServiceClient.Create(APP_URL); // new MobileServiceClient(APP_URL); // Get App Service 'SpawnFlags' table _SFtable = _client.GetTable <SpawnFlag>("SpawnFlags"); // Initialise local spawnflag model sheild.name = "Sheild"; sheild.flag = false; shock.name = "Shockwave"; shock.flag = false; purge.name = "Purge"; purge.flag = false; // Not inserted yet spawnButton = false; // Insert flags to the spawn flag table Insert(_SFtable, sheild); Insert(_SFtable, shock); Insert(_SFtable, purge); }
// Use this for initialization void Start() { // Create App Service client (Using factory Create method to force 'https' url) _client = MobileServiceClient.Create(_appUrl); //new MobileServiceClient(_appUrl); // Get App Service 'Highscores' table _table = _client.GetTable<Highscore>("Highscores"); // set TSTableView delegate _tableView.dataSource = this; // setup token using Unity Inspector value if (!String.IsNullOrEmpty(_facebookAccessToken)) { InputField inputToken = GameObject.Find("FacebookAccessToken").GetComponent<InputField>(); inputToken.text = _facebookAccessToken; } UpdateUI(); }
private void Record() { StartRecord_BTN.IsEnabled = false; if (NoNetwork() == false) { VideoCaptureDevice videoCaptureDevice = CaptureDeviceConfiguration.GetDefaultVideoCaptureDevice(); if (videoCaptureDevice != null) { this.mySource = new CaptureSource(); this.mySource.CaptureImageCompleted += mySource_CaptureImageCompleted; this.mySource.VideoCaptureDevice = CaptureDeviceConfiguration.GetDefaultVideoCaptureDevice(); this.mySink = new FileSink(); mobileServiceClient = new MobileServiceClient("https://bethere.azure-mobile.net/", "XdjbcQDgRsMEXdNKeiKoiILoWNWLJE48"); usrStatusTable = mobileServiceClient.GetTable<GlobalVideos>(); } else { StartRecord_BTN.Content = "No Camera Available"; StartRecord_BTN.IsEnabled = false; } } else { MessageBox.Show("A network connection can not be established.\r\nPlease press refresh or check your network settings."); return; } this.mySource.VideoCaptureDevice = CaptureDeviceConfiguration.GetDefaultVideoCaptureDevice(); this.mySink = new FileSink(); errMsg.Text = ""; using (IsolatedStorageFile isolatedStorageFile = IsolatedStorageFile.GetUserStoreForApplication()) { if (isolatedStorageFile.FileExists("video.mp4")) { isolatedStorageFile.DeleteFile("video.mp4"); } } this.myBrush = new VideoBrush(); this.cameraView.Background = this.myBrush; this.myBrush.SetSource(this.mySource); this.mySink.CaptureSource = this.mySource; this.mySink.IsolatedStorageFileName = "video.mp4"; this.mySource.Start(); this.mySource.CaptureImageAsync(); DelayDisplay(); }
private void PopulateDBTable() { usrStatusTable = mobileServiceClient.GetTable<GlobalVideos>(); //Save data to windows azure Mobile service //create insert object usrStatusTable.Insert(item, (res, err) => //do the Insert { if (err != null) { //handle it errMsg.Text = "Failed!!!"; } else { errMsg.Text = "Finish!!!"; } item = res; StartRecord_BTN.Content = "OK"; StartRecord_BTN.IsEnabled = true; }); }
/// <summary> /// Ensure the query will get the deleted records. This requires the soft delete feature to be enabled on the Mobile Service. Visit <see href="http://go.microsoft.com/fwlink/?LinkId=507647">the link</see> for details. /// </summary> /// <returns> /// The query object. /// </returns> public IMobileServiceTableQuery <T> IncludeDeleted() { return(this.QueryProvider.Create(this.Table, this.Query, MobileServiceTable.IncludeDeleted(this.Parameters), includeTotalCount: true)); }
void Awake() { if (_instance == null) { _instance = this; DontDestroyOnLoad(gameObject); } else if (_instance != this) { Destroy(gameObject); } OnGameSessionEnded += LeaderboardManager_OnGameSessionCompleted; _serviceClient = new MobileServiceClient(serviceUrl, serviceKey); _scoreTable = _serviceClient.GetTable<Score>(); _leaderboardTable = _serviceClient.GetTable<Leaderboard>(); //_leaderboardTable.Query("SELECT * WHERE game=", null); }
// Use this for initialization void Start() { // Create App Service client (Using factory Create method to force 'https' url) _client = MobileServiceClient.Create(_appUrl); //new MobileServiceClient(_appUrl); // Get App Service 'Highscores' table _table = _client.GetTable<Inventory>("Inventory"); // set TSTableView delegate _tableView.dataSource = this; // setup token using Unity Inspector value if (!String.IsNullOrEmpty(_facebookAccessToken)) { InputField inputToken = GameObject.Find("FacebookAccessToken").GetComponent<InputField> (); inputToken.text = _facebookAccessToken; } // hide controls until login CanvasGroup group = GameObject.Find("UserDataGroup").GetComponent<CanvasGroup> (); group.alpha = 0; group.interactable = false; UpdateUI (); }
/// Use this for initialization void Start() { /// NB: Warning this block disables ServerCertificateValidation on Android for demo purposes only! #if UNITY_ANDROID Debug.Log("Warning: Android ServerCertificateValidation disabled."); ServicePointManager.ServerCertificateValidationCallback = (p1, p2, p3, p4) => true; // NB: this is a workaround for "Unable to find /System/Library/Frameworks/Security.framework/Security" issue in Android #endif /// Create Mobile Service client _client = new MobileServiceClient(Config.appUrl, Config.appKey); Debug.Log(_client); /// Get Mobile Service 'Highscores' table _table = _client.GetTable<Highscore>("Highscores"); Debug.Log(_table); InitializeDemoUI(); }
public void Read(MobileServiceTable <SpawnFlag> table) { table.Read <SpawnFlag>(OnReadCompleted); }
private async Task <bool> ExecuteOperationAsync(MobileServiceTableOperation operation, OperationBatch batch) { if (operation.IsCancelled || this.CancellationToken.IsCancellationRequested) { return(false); } operation.Table = await this.context.GetTable(operation.TableName, this.client); await this.LoadOperationItem(operation, batch); if (this.CancellationToken.IsCancellationRequested) { return(false); } await TryUpdateOperationState(operation, MobileServiceTableOperationState.Attempted, batch); // strip out system properties before executing the operation operation.Item = MobileServiceSyncTable.RemoveSystemPropertiesKeepVersion(operation.Item); JObject result = null; Exception error = null; try { result = await batch.SyncHandler.ExecuteTableOperationAsync(operation); } catch (Exception ex) { error = ex; } if (error != null) { await TryUpdateOperationState(operation, MobileServiceTableOperationState.Failed, batch); if (TryAbortBatch(batch, error)) { // there is no error to save in sync error and no result to capture // this operation will be executed again next time the push happens return(false); } } // save the result if ExecuteTableOperation did not throw if (error == null && result.IsValidItem() && operation.CanWriteResultToStore) { await TryStoreOperation(() => this.Store.UpsertAsync(operation.TableName, result, fromServer: true), batch, "Failed to update the item in the local store."); } else if (error != null) { HttpStatusCode?statusCode = null; string rawResult = null; var iox = error as MobileServiceInvalidOperationException; if (iox != null && iox.Response != null) { statusCode = iox.Response.StatusCode; Tuple <string, JToken> content = await MobileServiceTable.ParseContent(iox.Response, this.client.SerializerSettings); rawResult = content.Item1; result = content.Item2.ValidItemOrNull(); } var syncError = new MobileServiceTableOperationError(operation.Id, operation.Version, operation.Kind, statusCode, operation.TableName, operation.Item, rawResult, result) { TableKind = this.tableKind, Context = this.context }; await batch.AddSyncErrorAsync(syncError); } bool success = error == null; return(success); }
// REST FUNCTIONS public void Lookup(MobileServiceTable <SpawnFlag> table, SpawnFlag item) { table.Lookup <SpawnFlag>(item.id, OnLookupCompleted); }