Ejemplo n.º 1
0
        public async static Task <TreeProfile> AddTree(TreeProfile tree)
        {
            if (!await Initialize())
            {
                return(null);
            }

            await docClient.CreateDocumentAsync(UriFactory.CreateDocumentCollectionUri(databaseName, collectionName), tree);

            return(tree);
        }
Ejemplo n.º 2
0
 async void processSwipe(object sender, SwipeCards.Controls.Arguments.SwipedEventArgs e2)
 {
     if (e2.Direction == SwipeCards.Controls.Arguments.SwipeDirection.Right)
     {
         TreeProfile tree = e2.Item as TreeProfile;
         favorites.Add(tree);
         var    assembly    = typeof(App).GetTypeInfo().Assembly;
         Stream audioStream = assembly.GetManifestResourceStream("Timbr." + "twig.wav");
         var    player      = Plugin.SimpleAudioPlayer.CrossSimpleAudioPlayer.Current;
         player.Load(audioStream);
         player.Play();
         await Task.Run(() =>
         {
             string currPref = Preferences.Get("favorites", null);
             List <TreeProfile> faves;
             if (currPref == null || currPref.Equals(""))
             {
                 faves = new List <TreeProfile>();
             }
             else
             {
                 faves = JsonConvert.DeserializeObject <List <TreeProfile> >(currPref);
             }
             faves.Add(tree);
             currPref = JsonConvert.SerializeObject(faves);
             Preferences.Set("favorites", currPref);
         });
     }
     else
     {
         var    assembly    = typeof(App).GetTypeInfo().Assembly;
         Stream audioStream = assembly.GetManifestResourceStream("Timbr." + "gasp.wav");
         var    player      = Plugin.SimpleAudioPlayer.CrossSimpleAudioPlayer.Current;
         player.Load(audioStream);
         player.Play();
     }
 }