public ItemsController()
 {
     dataContext   = new ExchaggleDbContext();
     uploadManager = new UploadService(dataContext);
     itemManager   = new ItemService(dataContext);
     global        = new GlobalService(dataContext);
 }
Ejemplo n.º 2
0
        [Test] //Bug 2849
        public void TheVendorAPI_UploadBatchWithDuplicateRefD9Segments()
        {
            method  = new StackTrace().GetFrame(0).GetMethod();
            package = new VendorPackage(client, Document.CreateDocument(duplicateRefsBatch));
            var results = UploadService.CallUploadService(package);

            try
            {
                Assert.AreEqual(true, results.thrownException);
            }
            catch (Exception)
            {
                verificationErrors.Append(
                    "Expected Batch That Uploaded With Duplicate Ref D9s To Throw Exception But No Exceptions Were Thrown");
            }
            try
            {
                Assert.AreEqual("Batch import failed.  Batch contains claims with duplicate REF*D9 segments.", results.Exceptions[0].Message);
            }
            catch (AssertionException e)
            {
                verificationErrors.Append(e.Message);
            }
            endOfTest();
        }
Ejemplo n.º 3
0
 public SiteController(StarkitContext db, UserManager <User> userManager, IHostEnvironment environment, UploadService uploadService)
 {
     _db            = db;
     _userManager   = userManager;
     _environment   = environment;
     _uploadService = uploadService;
 }
Ejemplo n.º 4
0
        // The Watcher calls this method when a new file shows up in the watched folder.
        private async Task ProcessNewLocalFile(string fullPath, string name)
        {
            if (!userSession.IsLoggedIn)
            {
                StopMonitoring();
                NotificationService.ShowBalloonError("Please log in and try again. Folder to Drive file deleted.");
                File.Delete(fullPath);
                return;
            }

            if (!File.Exists(fullPath))
            {
                // Apparently there are times when more than one file-created event fires and the initial one happens
                // before the file is available; we're silently ignoring that situation
                return;
            }

            string fileId = await UploadService.UploadFile(fullPath, name, uploadDriveItemId);

            if (fileId == null)
            {
                NotificationService.ShowBalloonError("Folder to Drive upload failed: {0}", name);
                return;
            }

            // Only delete if file was successfully uploaded
            if (userSession.Settings.FolderToDriveDeleteFileAfterUpload)
            {
                File.Delete(fullPath);
            }
        }
Ejemplo n.º 5
0
        public void TheVendorAPI_UploadSingleClaimBatch()
        {
            method = new StackTrace().GetFrame(0).GetMethod();
            var results = UploadService.CallUploadService(new VendorPackage(client, Document.CreateDocument(claimNotFoundStatusBatch)));

            if (results.claimResults.Length == 0)
            {
                verificationErrors.Append("Vendor API Service Returned an Unexpected Result of Null or Empty");
                Assert.Fail();
            }
            try
            {
                Assert.AreEqual(true, results.noErrors);
            }
            catch (Exception)
            {
                verificationErrors.Append(
                    "Expected VendorAPI Batch to Have No Errors Returned, But Error(s) were returned");
            }
            try
            {
                Assert.AreEqual(ClaimDeletionStatus.ClaimNotFound,
                                results.claimResults[0].ClaimDeletionStatus);
            }
            catch (Exception e)
            {
                verificationErrors.Append(e.Message);
            }
            var claimToDelete = results.claimResults[0].VendorClaimId;

            Helper.CleanUpVendorBatch(claimToDelete);
            endOfTest();
        }
        public async Task Test1()
        {
            var service = new UploadService("http://*****:*****@"Replays\UnsavedReplay-2018.10.17-20.22.26.replay");

            Assert.Contains("success", content);
        }
Ejemplo n.º 7
0
        public void TheVendorAPI_UploadClaimsWithoutRefD9Test()
        {
            method = new StackTrace().GetFrame(0).GetMethod();
            var results = UploadService.CallUploadService(new VendorPackage(client, Document.CreateDocument(nonRefD9Batch)));

            if (results.thrownException == false)
            {
                verificationErrors.Append(
                    "Uploaded Batch Excepted to Return Exceptions, but No Exception(s) Were Returned");
                Assert.Fail();
            }
            var  exception = results.Exceptions[0];
            bool matchExpectedExceptionMessage = Regex.IsMatch(exception.Message, "A Claim was sent without a Vendor Claim ID, No Claims Imported");

            try
            {
                Assert.AreEqual(true, matchExpectedExceptionMessage);
            }
            catch (Exception e)
            {
                verificationErrors.Append(
                    "Expected a Returned Error Message that Contained Correct Reason for Failed Uploaded, but Correct Message was Not Returned\n" + e.Message);
            }
            endOfTest();
        }
Ejemplo n.º 8
0
        public async Task <IActionResult> UploadImage(IFormFile imageFile, [FromForm] bool isNotifiableByEmail)
        {
            bool isUploaded = false;

            try
            {
                if (imageFile == null)
                {
                    return(BadRequest("Nincs fogadott feltöltendő fájl"));
                }
                if (AccountKey == string.Empty || AccountName == string.Empty)
                {
                    return(BadRequest("Nem tudjuk feloldani az Azure tárhelyed, csekkold hogy van megadva accountName és accountKey!"));
                }

                if (UploadService.IsImage(imageFile) && imageFile.Length > 0)
                {
                    using (Stream stream = imageFile.OpenReadStream())
                    {
                        isUploaded = await UploadService.UploadImageToPersonalBlobStorage(stream, DateTime.Now.ToString("yyMMddHHmmssffffff") + imageFile.FileName, AzureConnectionString, await GetCurrentUserIdAsync(), isNotifiableByEmail);
                    }
                }
                else
                {
                    return(new UnsupportedMediaTypeResult());
                }

                return(new OkResult());
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
Ejemplo n.º 9
0
        public void TheVendorAPI_UploadVendorReImportedClaimsTest()
        {
            method = new StackTrace().GetFrame(0).GetMethod();
            var results = UploadService.CallUploadService(new VendorPackage(client, Document.CreateDocument(SingleClaimNoErrors)));

            try
            {
                Assert.AreEqual(true, results.noErrors);
            }
            catch (Exception)
            {
                verificationErrors.Append("Expected Upload to throw No Exceptions but Exception(s) were Thrown");
            }
            try
            {
                Assert.AreEqual(0, results.claimResults[0].Errors.Length);
            }
            catch (Exception)
            {
                verificationErrors.Append(
                    "Expected 0 Errors Returned From Batch Upload, but Batch Upload Returned With " +
                    results.claimResults[0].Errors.Length.ToString(CultureInfo.InvariantCulture) + " Errors");
            }
            try
            {
                Assert.AreEqual(ClaimDeletionStatus.ClaimWasReimported, results.claimResults[0].ClaimDeletionStatus);
            }
            catch (Exception)
            {
                verificationErrors.Append("Unexpected ClaimDeletionStatus Value: Expected ClaimWasReimported but was " +
                                          results.claimResults[0].ClaimDeletionStatus.ToString());
            }

            endOfTest();
        }
Ejemplo n.º 10
0
    // Use this for initialization
    public void Initialize()
    {
        //App42API.Initialize(KEY_API, KEY_SECRET);

        serviceAPI    = new ServiceAPI(KEY_API, KEY_SECRET);
        uploadService = serviceAPI.BuildUploadService();
    }
Ejemplo n.º 11
0
        public async Task RightFileNull_Upload_ThrowException()
        {
            // Arrange
            const int id      = 1;
            var       data    = new List <FileComparison>().AsQueryable();
            var       mockSet = await Task.Run(() => MockContextHelper.SetupMockSet(data));

            var mockContext = await Task.Run(() => MockContextHelper.SetupMockContext(mockSet));

            var uploadService = new UploadService(mockContext.Object);

            // Act
            var exceptionThrown = false;

            try
            {
                await uploadService.UploadRightAsync(id, null);
            }
            catch (ArgumentNullException)
            {
                exceptionThrown = true;
            }

            // Assert
            Assert.IsTrue(exceptionThrown, "ArgumentNullException was not thrown!");
        }
Ejemplo n.º 12
0
        static async Task Main(string[] args)
        {
            Server server = null;

            try
            {
                server = new Server()
                {
                    Services = { GreetingService.BindService(new GreetingServiceImpl()),
                                 CalculatorService.BindService(new CalculatorServiceImpl()),
                                 CounterService.BindService(new CounterServiceImpl()),
                                 UploadService.BindService(new UploadServiceImpl()),
                                 ConversationService.BindService(new ConversationServiceImpl()) },
                    Ports = { new ServerPort("localhost", Port, ServerCredentials.Insecure) }
                };

                server.Start();
                Console.WriteLine($"The server is listening on the port : {Port}");
                Console.ReadKey();
            }
            catch (IOException ex)
            {
                Console.WriteLine($"The server failed to start : {ex.Message}");
                throw;
            }
            finally
            {
                if (server != null)
                {
                    await server.ShutdownAsync();
                }
            }
        }
Ejemplo n.º 13
0
        public override Task StartAsync(CancellationToken cancellationToken)
        {
            _logger.LogInformation($"Worker started at: {DateTime.Now}");

            _settings = ReadJsonFile();
            if (_settings.Username == null)
            {
                _logger.LogInformation("No username provided...");
                throw new Exception("No username provided");
            }
            _uploadService = new UploadService(_settings.Endpoint);
            _parseService  = new ParseService();

            _memCache        = new MemoryCache(new MemoryCacheOptions());
            _memCacheOptions = new MemoryCacheEntryOptions()
                               .SetSlidingExpiration(TimeSpan.FromMilliseconds(CacheTimeMilliseconds))
                               .RegisterPostEvictionCallback(callback: OnRemovedFromCache, state: this);

            _watcher = new FileSystemWatcher(_settings.Path, _settings.FileExtension)
            {
                NotifyFilter = NotifyFilters.LastWrite
            };
            _watcher.Changed            += new FileSystemEventHandler(OnChanged);
            _watcher.EnableRaisingEvents = true;
            _logger.LogInformation("Started watching...");

            return(base.StartAsync(cancellationToken));
        }
Ejemplo n.º 14
0
 public HomeController(PathProvider provider, IConfiguration config, UploadService upService, MailService mailService)
 {
     this.pathProvider  = provider;
     this.Configuration = config;
     this.UpService     = upService;
     this.MailService   = mailService;
 }
Ejemplo n.º 15
0
        public async Task <IActionResult> OnPostAsync(UploadInputModel model)
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            var result = await UploadService.AddAnimation(new Application.Models.UploadModel()
            {
                Name        = model.Name,
                Description = model.Description,
                Price       = model.Price,
                File        = await model.File.GetBytes(),
                UserId      = IdentityService.GetUserId() ?? Guid.Empty
            });

            if (result != null && result.Count > 0)
            {
                foreach (var error in result)
                {
                    ModelState.AddModelError("", error);
                }
            }
            else
            {
                ShowSuccess = true;
            }

            return(Page());
        }
Ejemplo n.º 16
0
        public void Get_Upload_Data()
        {
            //Arrange
            var serviceProvider = new ServiceCollection()
                                  .AddLogging()
                                  .BuildServiceProvider();
            var           dbfactory = new ConnectionFactory();
            var           context   = dbfactory.CreateContextForInMemory();
            var           factory   = serviceProvider.GetService <ILoggerFactory>();
            var           logger    = factory.CreateLogger <UploadService>();
            UploadService _service  = new UploadService(logger, context);

            var GUID          = Guid.NewGuid().ToString();
            var LocalFileName = "File Name_" + GUID + ".txt";
            var FilePath      = "App_Data/File Name_" + GUID + ".txt";
            var upload        = new Upload()
            {
                Guid = GUID, FileName = "File Name.txt", FileSize = 256, LocalFileName = LocalFileName, FilePath = FilePath, UploadDate = DateTime.Now
            };

            //Act
            context.Uploads.Add(upload);
            context.SaveChanges();
            List <Upload> uploads = _service.GetUploads();

            //Assert
            Assert.IsTrue(uploads.Count > 0);
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TodoistClient" /> class.
        /// </summary>
        /// <param name="token">The token.</param>
        /// <param name="restClient">The rest client.</param>
        /// <exception cref="System.ArgumentException">Value cannot be null or empty - token</exception>
        public TodoistClient(string token, ITodoistRestClient restClient)
        {
            if (string.IsNullOrEmpty(token))
            {
                throw new ArgumentException("Value cannot be null or empty.", nameof(token));
            }

            _token      = token;
            _restClient = restClient;

            Projects      = new ProjectsService(this);
            Templates     = new TemplateService(this);
            Items         = new ItemsService(this);
            Labels        = new LabelsService(this);
            Notes         = new NotesService(this);
            Uploads       = new UploadService(this);
            Filters       = new FiltersService(this);
            Activity      = new ActivityService(this);
            Notifications = new NotificationsService(this);
            Backups       = new BackupService(this);
            Reminders     = new RemindersService(this);
            Users         = new UsersService(this);
            Sharing       = new SharingService(this);
            Emails        = new EmailService(this);
            Sections      = new SectionService(this);
        }
Ejemplo n.º 18
0
        public void TheVendorAPI_CallUploadMultipleClaimsSomeWithoutRefD9Test()
        {
            method = new StackTrace().GetFrame(0).GetMethod();

            package = new VendorPackage(client, Document.CreateDocument(halfRefBatch));
            var results = UploadService.CallUploadService(package);

            try
            {
                Assert.AreEqual(true, results.thrownException);
            }
            catch (Exception)
            {
                verificationErrors.Append("Expected Exception To Be Thrown But No Exception Was Thrown");
            }
            bool isMatch = Regex.IsMatch(results.Exceptions[0].Message,
                                         "Missing Vendor Claim Id: A Claim was sent without a Vendor Claim ID, No Claims Imported");

            try
            {
                Assert.AreEqual(true, isMatch);
            }
            catch (Exception)
            {
                verificationErrors.Append(
                    "Unexpected Exception Thrown From Upload Service, Expected Error, \"A Claim was sent without a Vendor Claim ID\"");
            }


            endOfTest();
        }
Ejemplo n.º 19
0
 public ApuntesController(EstudianteService estudianteService, UploadService uploadService,
                          IHostingEnvironment environment)
 {
     this.estudianteService = estudianteService;
     this.uploadService     = uploadService;
     this.Environment       = environment;
 }
Ejemplo n.º 20
0
        public ActionResult SaveGoodsImage()
        {
            var hash = new Hashtable();

            if (Request.Files.Count == 0 || Request.Files[0] == null || Request.Files[0].ContentLength == 0)
            {
                hash["error"]   = 1;
                hash["message"] = "上传的图片不能为空";
                return(Json(hash, JsonRequestBehavior.AllowGet));
            }

            string errMsg, savePath;

            if (!UploadService.UploadGoodsImage(Request.Files[0], out errMsg, out savePath))
            {
                hash["error"]   = 1;
                hash["message"] = errMsg;
                return(Json(hash, JsonRequestBehavior.AllowGet));
            }
            else
            {
                hash["error"] = 0;
                hash["url"]   = savePath;
                return(Json(hash, JsonRequestBehavior.AllowGet));
            }
        }
Ejemplo n.º 21
0
        public void TheVendorAPI_UploadLargeBatchTest()
        {
            method  = new StackTrace().GetFrame(0).GetMethod();
            package = new VendorPackage(client, Document.CreateDocument(hundredTwoClaimsBatch));
            var results = UploadService.CallUploadService(package);

            try
            {
                Assert.AreEqual(true, results.thrownException);
            }
            catch (Exception)
            {
                verificationErrors.Append(
                    "Expected 100 claim batch to throw exceptions, but no exception(s) were thrown");
            }
            try
            {
                Assert.AreEqual("Max claims exceeded. Cannot accept more than 20 claims.", results.Exceptions[0].Message);
            }
            catch (VerificationException e)
            {
                verificationErrors.Append(e);
            }
            endOfTest();
        }
Ejemplo n.º 22
0
        private void SendContactInternal(TLMessageBase messageBase)
        {
            var message = messageBase as TLMessage34;

            if (message == null)
            {
                return;
            }

            var mediaContact = message.Media as TLMessageMediaContact;

            if (mediaContact == null)
            {
                return;
            }

            var inputMediaContact = new TLInputMediaContact82
            {
                FirstName   = mediaContact.FirstName,
                LastName    = mediaContact.LastName,
                PhoneNumber = mediaContact.PhoneNumber,
                VCard       = TLString.Empty
            };

            message.InputMedia = inputMediaContact;

            UploadService.SendMediaInternal(message, MTProtoService, StateService, CacheService);
        }
 public SourceManageController(GuideContext db, UserManager <User> userManager, IWebHostEnvironment environment, UploadService uploadService)
 {
     _db            = db;
     _userManager   = userManager;
     _environment   = environment;
     _uploadService = uploadService;
 }
Ejemplo n.º 24
0
        private void SendLocationInternal(TLMessageBase messageBase)
        {
            var message = messageBase as TLMessage34;

            if (message == null)
            {
                return;
            }

            var mediaGeo = message.Media as TLMessageMediaGeo;

            if (mediaGeo == null)
            {
                return;
            }

            var geoPoint = mediaGeo.Geo as TLGeoPoint;

            if (geoPoint == null)
            {
                return;
            }

            var inputMediaGeoPoint = new TLInputMediaGeoPoint
            {
                GeoPoint = new TLInputGeoPoint {
                    Lat = geoPoint.Lat, Long = geoPoint.Long
                }
            };

            message.InputMedia = inputMediaGeoPoint;

            UploadService.SendMediaInternal(message, MTProtoService, StateService, CacheService);
        }
Ejemplo n.º 25
0
        public ActionResult UploadFiles()
        {
            foreach (string file in Request.Files)
            {
                var statuses = new BlueimpJsonResult();
                statuses.files = new List <FileMetadata>();
                var headers = Request.Headers;

                for (int i = 0; i < Request.Files.Count; i++)
                {
                    var f = Request.Files[i];
                    f.SaveAs(Server.MapPath("~/UploadFiles/") + f.FileName);

                    var uservice = new UploadService();
                    uservice.Create(f);

                    statuses.files.Add(new FileMetadata()
                    {
                        name         = f.FileName,
                        size         = f.ContentLength,
                        url          = "/UploadFiles/" + f.FileName,
                        deleteUrl    = "/Upload/DeleteFile?name=" + f.FileName,
                        deleteType   = "GET",
                        thumbnailUrl = "null"
                    });
                }
                JsonResult result = Json(statuses);
                result.ContentType = "text/plain";
                return(result);
            }
            return(Json(new List <FileMetadata>()));
        }
Ejemplo n.º 26
0
 public HomeController(ILogger <HomeController> logger, UploadService upload, PostService postService, PersonService personService)
 {
     this.logger        = logger;
     this.uploadService = upload;
     this.postService   = postService;
     this.personService = personService;
 }
Ejemplo n.º 27
0
        public void UploadAndDeleteTest()
        {
            //Arrange
            setUp();
            var f = MockRepository.GenerateStub <HttpPostedFileBase>();

            f.Stub(x => x.FileName).Return("foo.bar");
            f.Stub(x => x.ContentLength).Return(100);

            //Act
            var u = new UploadService();

            u.Create(f);

            //Assert
            var Repository = new DocuRepository(MockContext);

            Assert.AreEqual(Repository.GetDocuments(), 2);
            Assert.AreEqual(Repository.GetDocumentByName("foo.bar"), 1);
            Assert.AreEqual(Repository.GetDocumentByName("foo.bar").FileSize, 100);

            u.Delete("fileName/bar.foo");
            Assert.AreEqual(Repository.GetDocuments(), 1);
            Assert.AreEqual(Repository.GetDocumentByName("bar.foo"), 0);
        }
 // Constructor
 public MainPage()
 {
     InitializeComponent();
     photoChooserTask = new PhotoChooserTask();
     photoChooserTask.Completed += new EventHandler<PhotoResult>(photoChooserTask_Completed);
     uploadservice = serviceApi.BuildUploadService();
     userService = serviceApi.BuildUserService();
 }
Ejemplo n.º 29
0
 public PublicationsController(MyInstagramContext db, IHostEnvironment environment,
                               UploadService uploadService, UserService userService)
 {
     _db            = db;
     _environment   = environment;
     _uploadService = uploadService;
     _userService   = userService;
 }
Ejemplo n.º 30
0
        //Pre: N/A
        //Post: OnlineStorage class is initialized
        //Description: This method initializes the online storage class.
        public static void Initialize()
        {
            App42API.Initialize(KEY_API, KEY_SECRET);

            ServiceAPI api = new ServiceAPI(KEY_API, KEY_SECRET);

            uploadService = api.BuildUploadService();
        }
 public DishesController(StarkitContext db, IHostEnvironment environment, UploadService uploadService,
                         UserManager <User> userManager)
 {
     _db            = db;
     _environment   = environment;
     _uploadService = uploadService;
     _userManager   = userManager;
 }
        /// <summary>
        /// SCORM Engine Service constructor that takes a single configuration parameter
        /// </summary>
        /// <param name="config">The Configuration object to be used to configure the Scorm Engine Service client</param>
        public ScormEngineService(Configuration config)
        {
            System.Net.ServicePointManager.Expect100Continue = false;

            configuration = config;
            courseService = new CourseService(configuration, this);
            dispatchService = new DispatchService(configuration, this);
            registrationService = new RegistrationService(configuration, this);
            invitationService = new InvitationService(configuration, this);
            uploadService = new UploadService(configuration, this);
            ftpService = new FtpService(configuration, this);
            exportService = new ExportService(configuration, this);
            reportingService = new ReportingService(configuration, this);
            debugService = new DebugService(configuration, this);
        }
 public ServicesPage()
 {
     App42API.Initialize(Constants.apiKey,Constants.secretKey );
     App42Log.SetDebug(true);
     InitializeComponent();
     userService = App42API.BuildUserService();
     storageService = App42API.BuildStorageService();
     gameService = App42API.BuildGameService();
     scoreBoardService = App42API.BuildScoreBoardService();
     uploadService = App42API.BuildUploadService();
     photoChooserTask = new PhotoChooserTask();
     photoChooserTask.Completed += new EventHandler<PhotoResult>(photoChooserTask_Completed);
     photoChooserTask2 = new PhotoChooserTask();
     photoChooserTask2.Completed += new EventHandler<PhotoResult>(photoChooserTask2_Completed);
 }
Ejemplo n.º 34
0
 void fs_DownloadCompleted(object sender, UploadService.DownloadCompletedEventArgs e)
 {            
     if (e.Error == null)
     {
         if (e.Result != null)
         {                    
             UploadService.PictureFile imageDownload = e.Result;
             stream = new MemoryStream(imageDownload.PictureStream);                                                      
             stream.WriteTo(outStream);
             outStream.Flush();
             outStream.Close();
             imageDownload.PictureStream = null;
             //stream.Close();
             MessageBox.Show("Đã lưu file hướng dẫn !");
         }
         else
         {
             MessageBox.Show("File help không tồn tại !");
         }
     }
 }
Ejemplo n.º 35
0
    void OnGUI()
    {
        GUILayout.BeginVertical();

        GUILayout.Label(uploadedImage,GUILayout.Height(317),GUILayout.Width(150));

        //======================================Loading_Message==========================================
        GUILayout.Label(loadingMessage2);
        //======================================Loading_Message==========================================

        //======================================File_Browser_Content==========================================
        if (m_fileBrowser != null)
        {
            GUI.skin = gameSkin;
            m_fileBrowser.OnGUI();
           GUI.skin = null;
        }
        else
        {
            OnGUIMain();
        }
        //======================================File_Browser_Content==========================================

        GUILayout.Label(path ?? "None selected");
        GUILayout.BeginHorizontal();
        //======================================UploadFile==========================================
        if (showAllFilesBtn == true && showUploadBtn == true && showBtn == true && GUILayout.Button("Upload File" , GUILayout.Width(150), GUILayout.Height(30)))
        {

                showUploadBtn = false;
                showBtn = false;
                Debug.Log("PATH IS ::: " + path);
                loadingMessage2 = "Please Wait...";
            if(path ==null || path.Equals(""))
            {
                loadingMessage2 = "Please Select A File";
            }
                fileName = "testFile11"+DateTime.Now.Millisecond;
                uploadService = sp.BuildUploadService(); // Initializing Upload Service.
                uploadService.UploadFile(fileName, path, "IMAGE", "Description", callBack); //Using App42 Unity UploadService.
            }
        //================================================================================
        GUILayout.EndVertical();
        GUILayout.Space(40);
        GUILayout.BeginArea(new Rect(155,5,200,371));
        GUILayout.BeginVertical();
        //========Setting Up ScrollView====================================================
        scrollPosition = GUILayout.BeginScrollView(scrollPosition, GUILayout.Width(155));
        if(listOfImages.Count > 1)
        {
            for(int i=0; i<listOfImages.Count; i++)
            {
                Texture2D myImage = (Texture2D)listOfImages[i];
                GUILayout.Label(myImage,GUILayout.Height(100),GUILayout.Width(100));
            }
            loadingMessage = "";
        }
         GUILayout.EndScrollView();
        //========ScrollView===============================================================

        //======================================Loading_Message==========================================
        GUILayout.Label(loadingMessage);
        //======================================Loading_Message==========================================

        //======================================GetAllFiles===============================
        if (showAllFilesBtn == true && GUILayout.Button("Get All Files" , GUILayout.Width(150), GUILayout.Height(30)))
            {
                loadingMessage = "Loading...";
                uploadService = sp.BuildUploadService(); // Initializing Upload Service.
                uploadService.GetAllFiles(allFilesCallBack);
            }
        //================================================================================
        GUILayout.EndHorizontal();
        GUILayout.EndVertical();
        GUILayout.EndArea();
    }
Ejemplo n.º 36
0
 //=============================GUI_CONTENT===========================================
 // Use this for initialization
 void Start()
 {
     App42API.Initialize("APP_API_KEY","APP_SECRET_KEY");
     uploadService = App42API.BuildUploadService(); // Initializing Upload Service.
 }
Ejemplo n.º 37
0
        void fs_GetDateTimeCompleted(object sender, UploadService.GetDateTimeCompletedEventArgs e)
        {
            if (e.Error == null)
            {
                if (e.Result != null)
                {
                    App.Current_d = e.Result;
                    //if (App.Current_d.Day == 1 || App.Current_d.Day == 2 || Convert.ToInt16(App.Current_d.DayOfWeek)==1)
                    //    App.m_ngaymin = 2;
                    //else
                    //    App.m_ngaymin = 1;

                    App.Min_Date = App.Current_d.AddDays(-2);
                    App.Min_Date = App.Min_Date.AddHours(-App.Min_Date.Hour);
                    App.Min_Date = App.Min_Date.AddMinutes(-App.Min_Date.Minute);
                    App.Min_Date = App.Min_Date.AddSeconds(-App.Min_Date.Second);
                }
                else
                {
                    MessageBox.Show("Không lấy được thời gian trên server !");
                }
            }
        }
Ejemplo n.º 38
0
 void client_GetSessionTimeOutCompleted(object sender, UploadService.GetSessionTimeOutCompletedEventArgs e)
 {
     int result = e.Result;
    // MessageBox.Show("232");
 }
Ejemplo n.º 39
0
 //=============================GUI_CONTENT===========================================
 // Use this for initialization
 void Start()
 {
     sp = new ServiceAPI("YOUR_API_KEY","YOUR_SECRET_KEY");
     uploadService = sp.BuildUploadService(); // Initializing Upload Service.
 }
Ejemplo n.º 40
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            System.Diagnostics.Debug.WriteLine("On navigated to loading");
            timeout = 0;

            MediaElementData[0] = t1;
            MediaElementData[1] = t2;

            Global.MyAudio[0] = App.GlobalMediaElement0;
            Global.MyAudio[1] = App.GlobalMediaElement1;
            Global.MyAudio[2] = App.GlobalMediaElement2;
            Global.MyAudio[3] = App.GlobalMediaElement3;
            Global.MyAudio[4] = App.GlobalMediaElement4;

            Global.opponentUsername = "";
            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                ready.Text = Global.localUsername + " \nvs\n";
            });

            _dispatcherTimer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(1) };
            _dispatcherTimer.Tick += UpdateMediaData;
            _dispatcherTimer.Start();

            i = 0;
            k = 0;
            B(false);

            requestCallback = this;
            App42API.Initialize(Constants.API_KEY, Constants.SECRET_KEY);
            App42Log.SetDebug(true);

            ServiceAPI api = new ServiceAPI(Constants.API_KEY, Constants.SECRET_KEY);

            storage = api.BuildStorageService();
            uploadService = api.BuildUploadService();

            System.Diagnostics.Debug.WriteLine("Before warp");

            WarpClient.initialize(Constants.API_KEY, Constants.SECRET_KEY);

            WarpClient.setRecoveryAllowance(60);

            Global.warpClient = WarpClient.GetInstance();


            //trivia
            if ((int)settings["trigger"] == 0)
                TriviaTB.Text = Global.TriviaB[(new Random()).Next(Global.TriviaB.Length)];
            else
                TriviaTB.Text = Global.TriviaH[(new Random()).Next(Global.TriviaH.Length)];

            Global.disconnectSuccess = false;
            Global.deleteSuccess = false;
            Global.conListenObj = new ConnectionListener(this);
            Global.roomReqListenerObj = new RoomReqListener(this);
            Global.zoneReqListenerObj = new ZoneRequestListener(this);
            Global.notificationListenerObj = new NotificationListener(this);
     
            Global.warpClient.AddConnectionRequestListener(Global.conListenObj);
            Global.warpClient.AddRoomRequestListener(Global.roomReqListenerObj);
            Global.warpClient.AddNotificationListener(Global.notificationListenerObj);
            Global.warpClient.AddZoneRequestListener(Global.zoneReqListenerObj);

            Global.warpClient.Connect(Global.localUsername);

            System.Diagnostics.Debug.WriteLine("after warp");
        }