Beispiel #1
0
        public async Task TestCloudFunction()
        {
            string SMSExceptionString = $"SMS Cloud function test";

            string[] keys = { "uuid", "exception", "type" };

            object[] objects = { "ee9798fdb87da590", SMSExceptionString, 7 };

            var smsDictionary = new Dictionary <string, object>();

            for (int index = 0; index < keys.Length; index++)
            {
                smsDictionary.Add(keys[index], objects[index]);
            }
            var parseClient = new ParseClient(ClientID, ParseEndPoint);

            await LoginAsync();

            var functionResult = await parseClient.CallFunctionAsync <IDictionary <string, object> >("sms", smsDictionary, CancellationToken.None);
        }
Beispiel #2
0
        public async Task UserSignUp()
        {
            var parseObject = new ParseUser
            {
                CreatedAt = DateTime.Now,
                UpdatedAt = DateTime.Now,
                ObjectId  = "dafdafd23"
            };
            var response = JsonConvert.SerializeObject(parseObject);

            _httpTest.RespondWithJson(response);

            var fakeUser = GetFakeUser();

            var parseClient = new ParseClient(ClientID, ParseEndPoint);

            var result = await parseClient.SignUp(fakeUser.Username, fakeUser.Password, CancellationToken.None);

            Assert.True(result);
        }
Beispiel #3
0
        public void Init()
        {
            DbProfileList         = new List <IDbProfile>();
            DbSubGameList         = new List <IDbSubGame>();
            DbSubGameLevelTagList = new List <IDbSubGameLevelTag>();

            if (_isInited)
            {
                return;
            }

            var initObj = CoreContext.ContextView.gameObject.AddComponent <ParseInitializeBehaviour>();

            initObj.applicationID = PARSE_APP_ID;
            initObj.dotnetKey     = PARSE_DOTNET_KEY;

            ParseClient.Initialize(PARSE_APP_ID, PARSE_DOTNET_KEY);

            _isInited = true;
        }
Beispiel #4
0
        public Task <IDictionary <string, object> > AuthenticateAsync(CancellationToken cancellationToken)
        {
            if (AppId == null)
            {
                throw new InvalidOperationException(
                          "You must initialize ParseFacebookUtils before attempting a Facebook login.");
            }
            if (pendingTask != null)
            {
                pendingTask.TrySetCanceled();
            }
            TaskCompletionSource <IDictionary <string, object> > tcs =
                new TaskCompletionSource <IDictionary <string, object> >();

            pendingCancellationToken = cancellationToken;
            pendingTask = tcs;

            cancellationToken.Register(() => {
                tcs.TrySetCanceled();
            });

            var navigateHandler = Navigate;

            if (navigateHandler != null)
            {
                var parameters = new Dictionary <string, object>()
                {
                    { "redirect_uri", (ResponseUrlOverride ?? ResponseUrl).AbsoluteUri },
                    { "response_type", "token" },
                    { "display", "popup" },
                    { "client_id", AppId }
                };
                if (Permissions != null)
                {
                    parameters["scope"] = string.Join(",", Permissions.ToArray());
                }
                navigateHandler(new Uri(LoginDialogUrlOverride ?? LoginDialogUrl,
                                        "?" + ParseClient.BuildQueryString(parameters)));
            }
            return(tcs.Task);
        }
Beispiel #5
0
        /// <summary>
        /// Constructor for the Application object.
        /// </summary>
        public App()
        {
            // Global handler for uncaught exceptions.
            UnhandledException += Application_UnhandledException;

            // Standard XAML initialization
            InitializeComponent();

            // Phone-specific initialization
            InitializePhoneApplication();

            ThemeManager.ToLightTheme();
            //AccentColor color = new AccentColor();
            //ThemeManager.SetAccentColor(color);


            // Language display initialization
            InitializeLanguage();

            // Show graphics profiling information while debugging.
            if (Debugger.IsAttached)
            {
                // Display the current frame rate counters.
                Application.Current.Host.Settings.EnableFrameRateCounter = true;

                // Show the areas of the app that are being redrawn in each frame.
                //Application.Current.Host.Settings.EnableRedrawRegions = true;

                // Enable non-production analysis visualization mode,
                // which shows areas of a page that are handed off to GPU with a colored overlay.
                //Application.Current.Host.Settings.EnableCacheVisualization = true;

                // Prevent the screen from turning off while under the debugger by disabling
                // the application's idle detection.
                // Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run
                // and consume battery power when the user is not using the phone.
                PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
            }
            ParseClient.Initialize("bthlugArbHCrcDgbuHPS5Uiz3lZbWvmU2EIjBgaV", "SPE35IPobltfR4wHXipwa8uIFZuNoiI2tY0QHpCV");
            ParseFacebookUtils.Initialize("690850497593331");
        }
Beispiel #6
0
        public Task TestRequestPasswordReset()
        {
            MutableServiceHub hub = new MutableServiceHub {
            };
            ParseClient client    = new ParseClient(new ServerConnectionData {
                Test = true
            }, hub);

            Mock <IParseUserController> mockController = new Mock <IParseUserController> {
            };

            hub.UserController = mockController.Object;

            return(client.RequestPasswordResetAsync("*****@*****.**").ContinueWith(task =>
            {
                Assert.IsFalse(task.IsFaulted);
                Assert.IsFalse(task.IsCanceled);

                mockController.Verify(obj => obj.RequestPasswordResetAsync("*****@*****.**", It.IsAny <CancellationToken>()), Times.Exactly(1));
            }));
        }
Beispiel #7
0
        /// <summary>
        /// Init this instance.
        /// </summary>
        public void Init()
        {
            try
            {
                //You need to register the models that you want to use with parse. this always need to be before initialize the client.
                ParseObject.RegisterSubclass <Movies>();

                ParseClient.Initialize(new ParseClient.Configuration
                {
                    ApplicationId = APPLICATION_ID,
                    WindowsKey    = NET_KEY,
                    Server        = BASE_URL
                });

                ParseInstallation.CurrentInstallation.SaveAsync();
            }
            catch (Exception ex)
            {
                Debug.WriteLine(string.Format("Error in ServiceClient class ==> Init method: {0}", ex.Message));
            }
        }
Beispiel #8
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(savedInstanceState);

            ParseClient.Initialize(new ParseClient.Configuration
            {
                ApplicationId = GetString(Resource.String.back4app_app_id),
                WindowsKey    = GetString(Resource.String.back4app_dotnet_key),
                Server        = GetString(Resource.String.back4app_server_url)
            });

            ParsePush.ParsePushNotificationReceived += ParsePush.DefaultParsePushNotificationReceivedHandler;
            ParseInstallation.CurrentInstallation["GCMSenderId"] = "754373890304";
            ParseInstallation.CurrentInstallation.SaveAsync();

            global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
            LoadApplication(new App());
        }
Beispiel #9
0
        private void _setUp(string applicationId, string clientKey)
        {
            this.applicationId = applicationId;
            this.clientKey     = clientKey;

            ParseClient.Initialize(appId, clientKey);
            await ParseInstallation.CurrentInstallation.SaveAsync();

            //String installationId = ParseInstallation.CurrentInstallation.InstallationId.ToString();
            //String objectId = ParseInstallation.CurrentInstallation.ObjectId.ToString();
            //var installation = ParseInstallation.CurrentInstallation;
            //IEnumerable<string> subscribedChannels = installation.Channels;

            PluginResult pr = new PluginResult(PluginResult.Status.OK, "onRegisterAsPushNotificationClientSucceeded");

            pr.KeepCallback = true;
            DispatchCommandResult(pr);
            //PluginResult pr = new PluginResult(PluginResult.Status.ERROR);
            //pr.KeepCallback = true;
            //DispatchCommandResult(pr);
        }
Beispiel #10
0
        public Task TestGetCurrentSessionWithNoCurrentUser()
        {
            MutableServiceHub hub = new MutableServiceHub {
            };
            ParseClient client    = new ParseClient(new ServerConnectionData {
                Test = true
            }, hub);

            Mock <IParseSessionController>     mockController            = new Mock <IParseSessionController>();
            Mock <IParseCurrentUserController> mockCurrentUserController = new Mock <IParseCurrentUserController>();

            hub.SessionController     = mockController.Object;
            hub.CurrentUserController = mockCurrentUserController.Object;

            return(client.GetCurrentSessionAsync().ContinueWith(task =>
            {
                Assert.IsFalse(task.IsFaulted);
                Assert.IsFalse(task.IsCanceled);
                Assert.IsNull(task.Result);
            }));
        }
Beispiel #11
0
        public Task <IObjectState> LogInAsync(string username,
                                              string password,
                                              CancellationToken cancellationToken)
        {
            var data = new Dictionary <string, object> {
                { "username", username },
                { "password", password }
            };

            var command = new ParseCommand(string.Format("login?{0}", ParseClient.BuildQueryString(data)),
                                           method: "GET",
                                           data: null);

            return(commandRunner.RunCommandAsync(command, cancellationToken: cancellationToken).OnSuccess(t => {
                var serverState = ParseObjectCoder.Instance.Decode(t.Result.Item2, ParseDecoder.Instance);
                serverState = serverState.MutatedClone(mutableClone => {
                    mutableClone.IsNew = t.Result.Item1 == System.Net.HttpStatusCode.Created;
                });
                return serverState;
            }));
        }
Beispiel #12
0
        protected async Task StartPage()
        {
            if (NewSession)
            {
                RegisterParseSubclasses();
                ParseClient.Initialize("iT8NyJO0dChjLyfVsHUTM8UZQLSBBJLxd43AX9IY", "SvmmmluPjmLblmNrgqnUmylInkyiXzoWBk9ZxeZH");
                NewSession = false;
            }
            if (IsTestMode)
            {
                Session["Email"]    = "*****@*****.**";
                Session["Password"] = "******";
            }
            if (LoggedIn)
            {
                //if (ParseUser.CurrentUser == null)
                //{
                await ParseUser.LogInAsync(Session["Email"].ToString(), Session["Password"].ToString());

                //}
                //PublicUserData = ParseUser.CurrentUser.Get<PublicUserData>("publicUserData");
                //await PublicUserData.FetchAsync();
                //Tutor = PublicUserData.Tutor;
                //await Tutor.FetchAsync();
                //PrivateTutorData = Tutor.PrivateTutorData;
                //await PrivateTutorData.FetchAsync();

                //ParseObject[] data = new ParseObject[] {PublicUserData, Tutor, PrivateTutorData};
                //await data.FetchAllAsync();
                PublicUserData = await PublicUserData.GetTutorDataById(PublicUserData.ObjectId);
            }
            else
            {
                if (!(this is _Default || this is Register || this is RegistrationTest || this is RegisterSuccess || this is RegisterFailure || this is Login))
                {
                    Response.Redirect("Default");
                }
            }
            await OnStart();
        }
Beispiel #13
0
        public Task TestLogOut()
        {
            IObjectState state = new MutableObjectState
            {
                ServerData = new Dictionary <string, object>
                {
                    ["sessionToken"] = "r:llaKcolnu"
                }
            };

            MutableServiceHub hub = new MutableServiceHub {
            };
            ParseClient client    = new ParseClient(new ServerConnectionData {
                Test = true
            }, hub);

            ParseUser user = client.GenerateObjectFromState <ParseUser>(state, "_User");

            Mock <IParseCurrentUserController> mockCurrentUserController = new Mock <IParseCurrentUserController> {
            };

            mockCurrentUserController.Setup(obj => obj.GetAsync(It.IsAny <IServiceHub>(), It.IsAny <CancellationToken>())).Returns(Task.FromResult(user));

            Mock <IParseSessionController> mockSessionController = new Mock <IParseSessionController>();

            mockSessionController.Setup(c => c.IsRevocableSessionToken(It.IsAny <string>())).Returns(true);

            hub.CurrentUserController = mockCurrentUserController.Object;
            hub.SessionController     = mockSessionController.Object;

            return(client.LogOutAsync().ContinueWith(task =>
            {
                Assert.IsFalse(task.IsFaulted);
                Assert.IsFalse(task.IsCanceled);

                mockCurrentUserController.Verify(obj => obj.LogOutAsync(It.IsAny <IServiceHub>(), It.IsAny <CancellationToken>()), Times.Exactly(1));
                mockSessionController.Verify(obj => obj.RevokeAsync("r:llaKcolnu", It.IsAny <CancellationToken>()), Times.Exactly(1));
            }));
        }
Beispiel #14
0
        public Task TestLogInWith()
        {
            IObjectState state = new MutableObjectState
            {
                ObjectId   = "some0neTol4v4",
                ServerData = new Dictionary <string, object>
                {
                    ["sessionToken"] = "llaKcolnu"
                }
            };

            MutableServiceHub hub = new MutableServiceHub {
            };
            ParseClient client    = new ParseClient(new ServerConnectionData {
                Test = true
            }, hub);

            Mock <IParseUserController> mockController = new Mock <IParseUserController> {
            };

            mockController.Setup(obj => obj.LogInAsync("parse", It.IsAny <IDictionary <string, object> >(), It.IsAny <IServiceHub>(), It.IsAny <CancellationToken>())).Returns(Task.FromResult(state));

            hub.UserController = mockController.Object;

            return(client.LogInWithAsync("parse", new Dictionary <string, object> {
            }, CancellationToken.None).ContinueWith(task =>
            {
                Assert.IsFalse(task.IsFaulted);
                Assert.IsFalse(task.IsCanceled);

                mockController.Verify(obj => obj.LogInAsync("parse", It.IsAny <IDictionary <string, object> >(), It.IsAny <IServiceHub>(), It.IsAny <CancellationToken>()), Times.Exactly(1));

                ParseUser user = task.Result;

                Assert.IsNotNull(user.AuthData);
                Assert.IsNotNull(user.AuthData["parse"]);
                Assert.AreEqual("some0neTol4v4", user.ObjectId);
            }));
        }
Beispiel #15
0
        /// <summary>
        /// Parses a uri, looking for a base uri that represents facebook login completion, and then
        /// converting the query string into a dictionary of key-value pairs. (e.g. access_token)
        /// </summary>
        private bool TryParseOAuthCallbackUrl(Uri uri, out IDictionary <string, string> result)
        {
            if (!uri.AbsoluteUri.StartsWith((ResponseUrlOverride ?? ResponseUrl).AbsoluteUri) ||
                uri.Fragment == null)
            {
                result = null;
                return(false);
            }
            string fragmentOrQuery;

            if (!string.IsNullOrEmpty(uri.Fragment))
            {
                fragmentOrQuery = uri.Fragment;
            }
            else
            {
                fragmentOrQuery = uri.Query;
            }
            // Trim the # or ? off of the fragment/query and then parse the querystring
            result = ParseClient.DecodeQueryString(fragmentOrQuery.Substring(1));
            return(true);
        }
Beispiel #16
0
 public IParseFieldOperation MergeWithPrevious(IParseFieldOperation previous)
 {
     if (previous == null)
     {
         return(this);
     }
     if (previous is ParseDeleteOperation)
     {
         return(new ParseSetOperation(objects.ToList()));
     }
     if (previous is ParseSetOperation)
     {
         var setOp   = (ParseSetOperation)previous;
         var oldList = (IList <object>)ParseClient.ConvertTo <IList <object> >(setOp.Value);
         return(new ParseSetOperation(oldList.Concat(objects).ToList()));
     }
     if (previous is ParseAddOperation)
     {
         return(new ParseAddOperation(((ParseAddOperation)previous).Objects.Concat(objects)));
     }
     throw new InvalidOperationException("Operation is invalid after previous operation.");
 }
Beispiel #17
0
        public Task TestUnsubscribe()
        {
            MutableServiceHub hub = new MutableServiceHub {
            };
            ParseClient client    = new ParseClient(new ServerConnectionData {
                Test = true
            }, hub);

            List <string> channels = new List <string> {
            };

            hub.PushChannelsController = GetMockedPushChannelsController(channels);

            channels.Add("test");

            return(client.UnsubscribeToPushChannelAsync("test").ContinueWith(task =>
            {
                Assert.IsTrue(task.IsCompleted);
                Assert.IsFalse(task.IsFaulted);

                return client.UnsubscribeToPushChannelsAsync(new List <string> {
                    { "test" }
                });
            }).ContinueWith(task =>
            {
                Assert.IsTrue(task.IsCompleted);
                Assert.IsFalse(task.IsFaulted);

                CancellationTokenSource cancellationTokenSource = new CancellationTokenSource {
                };
                return client.UnsubscribeToPushChannelsAsync(new List <string> {
                    { "test" }
                }, cancellationTokenSource.Token);
            }).ContinueWith(task =>
            {
                Assert.IsTrue(task.IsCompleted);
                Assert.IsFalse(task.IsFaulted);
            }));
        }
Beispiel #18
0
        public async void initialize(string args)
        {
            PluginResult result;

            try
            {
                var appId     = JSON.JsonHelper.Deserialize <string[]>(args)[0].ToString();
                var clientKey = JSON.JsonHelper.Deserialize <string[]>(args)[1].ToString();

                ParseClient.Initialize(appId, clientKey);


                await ParseInstallation.CurrentInstallation.SaveAsync();


                DispatchCommandResult(new PluginResult(PluginResult.Status.OK, true));
            }
            catch (Exception e)
            {
                DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, false));
            }
        }
Beispiel #19
0
        public Task TestUpgradeToRevocableSession()
        {
            MutableServiceHub hub = new MutableServiceHub {
            };
            ParseClient client    = new ParseClient(new ServerConnectionData {
                Test = true
            }, hub);

            IObjectState state = new MutableObjectState
            {
                ServerData = new Dictionary <string, object>()
                {
                    ["sessionToken"] = "llaKcolnu"
                }
            };

            Mock <IParseSessionController> mockController = new Mock <IParseSessionController>();

            mockController.Setup(obj => obj.UpgradeToRevocableSessionAsync(It.IsAny <string>(), It.IsAny <IServiceHub>(), It.IsAny <CancellationToken>())).Returns(Task.FromResult(state));

            Mock <IParseCurrentUserController> mockCurrentUserController = new Mock <IParseCurrentUserController>();

            hub.SessionController     = mockController.Object;
            hub.CurrentUserController = mockCurrentUserController.Object;

            CancellationTokenSource source = new CancellationTokenSource {
            };

            return(client.UpgradeToRevocableSessionAsync("someSession", source.Token).ContinueWith(task =>
            {
                Assert.IsFalse(task.IsFaulted);
                Assert.IsFalse(task.IsCanceled);

                mockController.Verify(obj => obj.UpgradeToRevocableSessionAsync(It.Is <string>(sessionToken => sessionToken == "someSession"), It.IsAny <IServiceHub>(), source.Token), Times.Exactly(1));

                Assert.AreEqual("llaKcolnu", task.Result);
            }));
        }
        private async void _setUp(string applicationId, string clientKey)
        {
            this.applicationId = applicationId;
            this.clientKey     = clientKey;

            Debug.WriteLine("000000000000000 ");

            try
            {
                ParseClient.Initialize(applicationId, clientKey);
                await ParseInstallation.CurrentInstallation.SaveAsync();

                //String installationId = ParseInstallation.CurrentInstallation.InstallationId.ToString();
                //String objectId = ParseInstallation.CurrentInstallation.ObjectId.ToString();
                //var installation = ParseInstallation.CurrentInstallation;
                //IEnumerable<string> subscribedChannels = installation.Channels;
            }
            catch (Exception ex) {
                Debug.WriteLine("ex: " + ex.Message);

                /*
                 * ex: [net_WebHeaderInvalidControlChars]
                 * Arguments:
                 * Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=4.7.60408.0&File=System.Net.dll&Key=net_WebHeaderInvalidControlChars
                 * Parameter name: name
                 */
            }

            Debug.WriteLine("11111111111111111111 ");

            PluginResult pr = new PluginResult(PluginResult.Status.OK, "onRegisterAsPushNotificationClientSucceeded");

            pr.KeepCallback = true;
            DispatchCommandResult(pr);
            //PluginResult pr = new PluginResult(PluginResult.Status.ERROR);
            //pr.KeepCallback = true;
            //DispatchCommandResult(pr);
        }
Beispiel #21
0
        /// <summary>
        /// Constructor for the Application object.
        /// </summary>
        public App()
        {
            // Global handler for uncaught exceptions.
            UnhandledException += Application_UnhandledException;

            // Standard XAML initialization
            InitializeComponent();

            // Phone-specific initialization
            InitializePhoneApplication();

            // Language display initialization
            InitializeLanguage();

            // Show graphics profiling information while debugging.
            if (Debugger.IsAttached)
            {
                // Display the current frame rate counters.
                Application.Current.Host.Settings.EnableFrameRateCounter = true;

                // Show the areas of the app that are being redrawn in each frame.
                //Application.Current.Host.Settings.EnableRedrawRegions = true;

                // Enable non-production analysis visualization mode,
                // which shows areas of a page that are handed off to GPU with a colored overlay.
                //Application.Current.Host.Settings.EnableCacheVisualization = true;

                // Prevent the screen from turning off while under the debugger by disabling
                // the application's idle detection.
                // Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run
                // and consume battery power when the user is not using the phone.
                PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
            }

            // Initialize the Parse client with your Application ID and .NET Key found on
            // your Parse dashboard
            ParseClient.Initialize("YOUR APPLICATION ID", "YOUR .NET KEY");
        }
Beispiel #22
0
        public void TestIsAuthenticatedWithOtherParseUser()
        {
            IObjectState state = new MutableObjectState
            {
                ObjectId   = "wagimanPutraPetir",
                ServerData = new Dictionary <string, object>
                {
                    ["sessionToken"] = "llaKcolnu"
                }
            };

            IObjectState state2 = new MutableObjectState
            {
                ObjectId   = "wagimanPutraPetir2",
                ServerData = new Dictionary <string, object>
                {
                    ["sessionToken"] = "llaKcolnu"
                }
            };

            MutableServiceHub hub = new MutableServiceHub {
            };
            ParseClient client    = new ParseClient(new ServerConnectionData {
                Test = true
            }, hub);

            ParseUser user  = client.GenerateObjectFromState <ParseUser>(state, "_User");
            ParseUser user2 = client.GenerateObjectFromState <ParseUser>(state2, "_User");

            Mock <IParseCurrentUserController> mockCurrentUserController = new Mock <IParseCurrentUserController> {
            };

            mockCurrentUserController.Setup(obj => obj.GetAsync(It.IsAny <IServiceHub>(), It.IsAny <CancellationToken>())).Returns(Task.FromResult(user));

            hub.CurrentUserController = mockCurrentUserController.Object;

            Assert.IsFalse(user2.IsAuthenticated);
        }
        public void GetBatchJson_OneItem_ProducesCorrectJson()
        {
            // Setup
            var book = new Book()
            {
                BaseUrl  = "www.amazon.com",
                Warnings = new List <string>()
            };
            string bookJson = JsonConvert.SerializeObject(book);

            var inputList = new List <BatchableOperation>
            {
                new BatchableOperation(RestSharp.Method.POST, "/classes/c1", bookJson)
            };

            // System under test
            string resultJson = ParseClient.GetBatchJson(inputList);

            // Verify
            string expectedJson = "{\"requests\": [{\"method\":\"POST\",\"path\":\"/classes/c1\",\"body\":{\"baseUrl\":\"www.amazon.com\",\"warnings\":[],\"objectId\":null}}] }";

            Assert.AreEqual(expectedJson, resultJson);
        }
Beispiel #24
0
        private void RemoveObjectFromRelatedBooksEntry(string objId, ParseClient parseClient)
        {
            var currentRelatedList = parseClient.GetRelatedBooks(objId);
            var bookSep            = "";

            foreach (var currentRelated in currentRelatedList)
            {
                var bldr = new StringBuilder("{");
                bldr.AppendFormat("\"objectId\":\"{0}\", \"books\":[", currentRelated.ObjectId);
                foreach (var book in currentRelated.Books)
                {
                    if (book.ObjectId == objId)
                    {
                        continue;
                    }
                    bldr.AppendFormat("{0}{{\"__type\":\"Pointer\", \"className\":\"books\", \"objectId\":\"{1}\"}}", bookSep, book.ObjectId);
                    bookSep = ", ";
                }
                bldr.Append("]}");
                Console.WriteLine("DEBUG RemoveObjectFromRelatedBooksEntry(): updateJson = {0}", bldr);
                parseClient.UpdateObject("relatedBooks", currentRelated.ObjectId, bldr.ToString());
            }
        }
Beispiel #25
0
        public MainPage()
        {
            this.InitializeComponent();

            coordonates = new List <string>();

            TrackLocationButton.Click += MainPage_Loaded;

            this.NavigationCacheMode = NavigationCacheMode.Required;

            //Buton
            StoptrackingButton.IsEnabled = false;

            try
            {
                ParseClient.Initialize("tFQtC1M0IhpZCWBBRRmqXCCE3SdUHO76f1RSNDOD", "wX0h5aUBInXq1NzNZIVx5b04kdidb4iGHKPLKidf");
            }
            catch (Exception)
            {
                MessageDialog warningDialog = new MessageDialog("We couldn't get Parse to work, please try to connect to a Wifi", "Parse BaaS");
                warningDialog.ShowAsync();
            }
        }
        public Task <ParseConfig> GetCurrentConfigAsync()
        {
            return(taskQueue.Enqueue(toAwait => toAwait.ContinueWith(_ => {
                if (currentConfig == null)
                {
                    object tmp;
                    ParseClient.ApplicationSettings.TryGetValue(CurrentConfigKey, out tmp);

                    string propertiesString = tmp as string;
                    if (propertiesString != null)
                    {
                        var dictionary = ParseClient.DeserializeJsonString(propertiesString);
                        currentConfig = new ParseConfig(dictionary);
                    }
                    else
                    {
                        currentConfig = new ParseConfig();
                    }
                }

                return currentConfig;
            }), CancellationToken.None));
        }
Beispiel #27
0
        /// <summary>
        /// Runs the batch process.
        /// 1) Get the list of imported books with their import data from bloomlibrary's book table.
        /// 2) If the catalog is online, load it, possibly filtered by language.
        /// 3) For each book in the catalog, check to see if it has been updated since it was uploaded
        ///    to bloomlibrary.  Also check to see if RoseGarden has been updated significantly since
        ///    the book was uploaded and whether it has never been uploaded.  Any one of these three
        ///    conditions is sufficient to include the book in the batch process.
        /// 4) Download the epub files for all of the batched books.
        /// 5) Convert each of the books, cleverly sorting them into bookshelves and language folders.
        /// 6) Upload the newly converted books.
        /// </summary>
        /// <returns>The batch.</returns>
        public int RunBatch()
        {
            if (!VerifyOptions())
            {
                return(1);
            }
            _bloomlibraryBooks = ParseClient.LoadBloomLibraryInfo(_options.UploadUser, _options.UploadPassword);
            var dryrun = _options.DryRun;

            _options.DryRun = false;                // we really want the catalog even though we may not fetch, convert, or upload any books.
            LoadCatalog();
            _options.DryRun = dryrun;
            var entries = GetEntriesToProcess();

            if (entries.Count == 0)
            {
                Console.WriteLine("INFO: No books need to be updated or converted.");
                return(0);
            }
            FetchBooks(entries);
            ConvertBooks(entries);
            UploadBooks();
            return(0);
        }
Beispiel #28
0
        /// <summary>
        /// Constructor for the Application object.
        /// </summary>
        public App()
        {
            // Global handler for uncaught exceptions.
            UnhandledException += Application_UnhandledException;

            // Standard XAML initialization
            InitializeComponent();

            // Phone-specific initialization
            InitializePhoneApplication();

            // Language display initialization
            InitializeLanguage();

            // Show graphics profiling information while debugging.
            if (Debugger.IsAttached)
            {
                // Display the current frame rate counters.
                Application.Current.Host.Settings.EnableFrameRateCounter = true;

                // Show the areas of the app that are being redrawn in each frame.
                //Application.Current.Host.Settings.EnableRedrawRegions = true;

                // Enable non-production analysis visualization mode,
                // which shows areas of a page that are handed off to GPU with a colored overlay.
                //Application.Current.Host.Settings.EnableCacheVisualization = true;

                // Prevent the screen from turning off while under the debugger by disabling
                // the application's idle detection.
                // Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run
                // and consume battery power when the user is not using the phone.
                PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
            }

            ParseClient.Initialize("CCU5M1XsbWaezy8PCuCCUa26estTAeV3NBNG4bw7", "7ua9EYlaOIB0q29n1mMf2Z6a3tLTqihG0dqp030m");
        }
Beispiel #29
0
 public TeacherService()
 {
     ParseObject.RegisterSubclass <Teachers>();
     ParseClient.Initialize(AppKey, DotNetKey);
 }
 public void SetUp() => ParseClient.Initialize(new ParseClient.Configuration {
     ApplicationID = "", Key = ""
 });
Beispiel #31
0
        public static void Main()
        {
            ParseClient pc = new ParseClient("[Here goes AppId]", "[Here goes REST api key]");

            pc.SendPushToChannel("hola");
        }