public string UrlFromBase64Image(string base64 = TestBase)
        {
            var stream = new MemoryStream(Convert.FromBase64String(base64));

            var uploadResult = app.WorkWith().Files().Upload(new FileField("fieldName", Guid.NewGuid().ToString(), "image/jpeg", stream)).ExecuteSync();

            var url = app.WorkWith().Files().GetFileDownloadUrl(uploadResult.Id);

            return(url);
        }
 internal static IEnumerable<string> ListFiles(string apiKey)
 {
     EverliveAppSettings settings = new EverliveAppSettings();
     settings.ServiceUrl = "api.everlive.com";
     settings.ApiKey = apiKey;
     var application = new EverliveApp(settings);
     AppHandler currentAppHandler = application.WorkWith();
     var files = currentAppHandler.Files().GetAll().ExecuteSync();
     return files.Select(f => f.Filename);
 }
Example #3
0
        private async void RetrieveAuthorName()
        {
            EverliveApp nativeConnection      = CloudProvider.Current.NativeConnection as EverliveApp;
            RequestResult <CustomUser> result = await nativeConnection.WorkWith().Users <CustomUser>().GetById(this.userId).TryExecuteAsync();

            if (result.Success)
            {
                this.AuthorName = result.Value.DisplayName;
            }
        }
        private void CheckRegistration()
        {
            var result = everliveApp.WorkWith().Push().CurrentDevice.GetRegistration().ExecuteSync(5000);

            if (result != null)
            {
                this.IsDeviceRegistered = true;
            }
            else
            {
                this.IsDeviceRegistered = false;
            }
        }
        internal static IEnumerable <string> ListFiles(string apiKey)
        {
            EverliveAppSettings settings = new EverliveAppSettings();

            settings.ServiceUrl = "api.everlive.com";
            settings.ApiKey     = apiKey;
            var        application       = new EverliveApp(settings);
            AppHandler currentAppHandler = application.WorkWith();
            var        files             = currentAppHandler.Files().GetAll().ExecuteSync();

            return(files.Select(f => f.Filename));
        }
Example #6
0
        private async void ReloadComments()
        {
            EverliveApp nativeApp = CloudProvider.Current.NativeConnection as EverliveApp;
            // TODO
            //ItemsResult<Comment> result = await (CloudProvider.Current as ICloudProvider).getitem.GetSortedItemsByFilterAsync<Comment>(filter, sorting);
            RequestResult <IEnumerable <Comment> > comments = await nativeApp.WorkWith().Data <Comment>().GetAll().Where(comment => comment.ActivityId == this.currentActivity.Id).OrderBy <DateTime>(c => c.CreatedAt).TryExecuteAsync();

            if (comments.Success)
            {
                this.currentActivity.CommentsCount = comments.Value.Count <Comment>();
                this.CommentsList.ItemsSource      = comments.Value;
            }
        }
        public string SignIn(string token)
        {
            var app = new EverliveApp("5tnum1NuePyeHNwk");

            try {
                app.WorkWith().Authentication().LoginWithGoogle(token).ExecuteSync();
                return "SUCCESS!";
            }
            catch (Exception ex)
            {
                Response.StatusCode = 500;
                return $"Operation Failed: {ex.Message}";
            }
        }
Example #8
0
        private async void RetrieveCommentsCount()
        {
            EverliveApp app = CloudProvider.Current.NativeConnection as EverliveApp;

            try
            {
                int count = await app.WorkWith().Data <Comment>().GetCount().Where(comment => comment.ActivityId == this.Id).ExecuteAsync();

                this.CommentsCount = count;
            }
            catch (Exception ex)
            {
            }
        }
Example #9
0
        public string UrlFromBase64Image(string base64, string category, string[] tags)
        {
            var filename = string.Format("{0}#{1}#{2}", category, string.Join(" ", tags), Guid.NewGuid());

            var stream = new MemoryStream(Convert.FromBase64String(base64));

            var uploadResult = app.WorkWith().Files().Upload(new FileField("fieldName", filename, "image/jpeg", stream)).ExecuteSync();

            var url = app.WorkWith().Files().GetFileDownloadUrl(uploadResult.Id);

            return(url);
        }
Example #10
0
        private async void RetrieveDisplayName()
        {
            EverliveApp app = CloudProvider.Current.NativeConnection as EverliveApp;

            try
            {
                var result = await app.WorkWith().Data <CustomUser>().GetById(this.userId).ExecuteAsync();

                if (!String.IsNullOrEmpty(result.DisplayName))
                {
                    this.AuthorName = result.DisplayName;
                }
                else
                {
                    this.AuthorName = result.Email;
                }
            }
            catch (Exception ex)
            {
            }
        }
        public string UploadFile(Stream stream, string filename, string filetype, string path = "/")
        {
            if (stream == null || !stream.CanRead)
            {
                throw new ArgumentException("stream");
            }

            if (string.IsNullOrEmpty(filename))
            {
                throw new ArgumentException("filename");
            }

            if (string.IsNullOrEmpty(filetype))
            {
                throw new ArgumentException("filetype");
            }

            var uploadResult = this.app.WorkWith().Files()
                               .Upload(new FileField("fieldName", filename + filetype.GetFileExtension(), filetype, stream)).ExecuteSync();

            return(app.WorkWith().Files().GetById(uploadResult.Id).ExecuteSync().CustomProperties["Uri"].ToString());
        }
Example #12
0
        public async Task <ObservableCollection <BizJets> > GetAllBizJets()
        {
            BizJetsCollection = new ObservableCollection <BizJets>();

            if (Application.Current.Properties.ContainsKey("BizJetsCollection"))
            {
                BizJetsCollection = Application.Current.Properties["BizJetsCollection"] as ObservableCollection <BizJets>;
                return(BizJetsCollection);
            }
            else
            {
                var bizJetsManager = ELHandle.WorkWith().Data <BizJets>();
                var allBizJets     = await bizJetsManager.GetAll().ExecuteAsync();

                foreach (BizJets serializedBizJet in allBizJets)
                {
                    BizJetsCollection.Add(serializedBizJet);
                }

                Application.Current.Properties["BizJetsCollection"] = BizJetsCollection;
                return(BizJetsCollection);
            }
        }