예제 #1
0
        /// <summary>
        /// Example #6.
        /// Wait ten seconds and check the status of both files.
        /// </summary>
        public static void Example6()
        {
            Console.WriteLine("Example #6 - Wait ten seconds and check the status of both files.");
            Console.Write("  Waiting... ");

            Thread.Sleep(10 * 1000);

            Console.WriteLine("done.");
            Console.Write("  Checking statuses... ");

            try
            {
                var documents = BoxView.FindDocuments(createdAfter: Start);

                Document doc1 = documents[0];
                Document doc2 = documents[1];

                Console.WriteLine("success :)");
                Console.WriteLine("  Status for file #1 (id=" + doc1.Id + ") is " + doc1.Status + ".");
                Console.WriteLine("  Status for file #2 (id=" + doc2.Id + ") is " + doc2.Status + ".");
            }
            catch (BoxViewException e)
            {
                Console.WriteLine("failed :(");
                Console.WriteLine("  Error Code: " + e.Code);
                Console.WriteLine("  Error Message: " + e.Message);
            }

            Console.WriteLine();
        }
예제 #2
0
        /// <summary>
        /// Example #5.
        /// List the documents we've uploaded since starting these Examples.
        /// </summary>
        public static void Example5()
        {
            Console.WriteLine("Example #5 - List the documents we've uploaded so far.");
            Console.Write("  Listing documents... ");

            try
            {
                var documents = BoxView.FindDocuments(createdAfter: Start);

                var doc1 = documents[1];
                var doc2 = documents[0];

                Console.WriteLine("success :)");
                Console.WriteLine("  File #1 ID is " + doc1.Id + ".");
                Console.WriteLine("  File #1 status is " + doc1.Status + ".");
                Console.WriteLine("  File #1 name is " + doc1.Name + ".");
                Console.WriteLine("  File #1 was created on " + doc1.CreatedAt + ".");
                Console.WriteLine("  File #2 ID is " + doc2.Id + ".");
                Console.WriteLine("  File #2 status is " + doc2.Status + ".");
                Console.WriteLine("  File #2 name is " + doc2.Name + ".");
                Console.WriteLine("  File #2 was created on " + doc2.CreatedAt + ".");
            }
            catch (BoxViewException e)
            {
                Console.WriteLine("failed :(");
                Console.WriteLine("  Error Code: " + e.Code);
                Console.WriteLine("  Error Message: " + e.Message);
            }

            Console.WriteLine();
        }