Esempio n. 1
0
        public static BoxInfo RetrieveBoxInfo(long id)
        {
            BoxInfo boxInfo = new BoxInfo();

            boxInfo.ID     = id;
            boxInfo.WebUrl = string.Format("http://www.box.com/files#/files/0/f/0/1/f_{0}", id);

            boxInfo.SquareThumbnailUrl = string.Format("https://www.box.net/api/1.0/download/{0}/{1}", config.boxToken, id);
            boxInfo.OriginalUrl        = boxInfo.SquareThumbnailUrl;
            boxInfo.Timestamp          = DateTime.Now;

            using (BoxNet.boxnetPortClient client = BoxUtils.SoapClient())
            {
                BoxNet.SOAPFileInfo info;
                client.get_file_info(out info, BoxUtils.Box_API_KEY, config.boxToken, id);
                if (info != null)
                {
                    boxInfo.Description = info.description;
                    boxInfo.Title       = info.file_name;
                    if (info.shared == 1)
                    {
                        boxInfo.WebUrl = string.Format("http://www.box.net/shared/{0}", info.public_name);
                    }
                }
            }
            return(boxInfo);
        }
Esempio n. 2
0
        public static void DeleteBoxImage(BoxInfo BoxInfo)
        {
            config.runtimeBoxHistory.Remove(BoxInfo.ID.ToString());
            config.BoxUploadHistory.Remove(BoxInfo.ID.ToString());

            using (BoxNet.boxnetPortClient client = BoxUtils.SoapClient())
            {
                client.delete(BoxUtils.Box_API_KEY, config.boxToken, "file", BoxInfo.ID);
            }
            BoxInfo.Image = null;
        }
Esempio n. 3
0
        void ButtonOKClick(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(boxTicket))
            {
                using (BoxNet.boxnetPortClient client = BoxUtils.SoapClient())
                {
                    string auth_token = string.Empty;

                    BoxNet.SOAPUser user = new BoxNet.SOAPUser();
                    client.get_auth_token(out auth_token, out user, BoxUtils.Box_API_KEY, boxTicket);

                    textBoxAuthToken.Text = auth_token;
                    this.DialogResult     = DialogResult.OK;
                }
            }
            else
            {
                this.DialogResult = DialogResult.OK;
            }
        }
Esempio n. 4
0
        private void buttonAuthenticate_Click(object sender, EventArgs e)
        {
            using (BoxNet.boxnetPortClient client = BoxUtils.SoapClient())
            {
                if (string.IsNullOrEmpty(boxTicket))
                {
                    string result = client.get_ticket(out boxTicket, BoxUtils.Box_API_KEY);
                    System.Diagnostics.Process.Start(string.Format("https://www.box.net/api/1.0/auth/{0}", boxTicket));
                }
                else
                {
                    string auth_token = string.Empty;

                    BoxNet.SOAPUser user   = new BoxNet.SOAPUser();
                    string          result = client.get_auth_token(out auth_token, out user, BoxUtils.Box_API_KEY, boxTicket);

                    boxTicket             = string.Empty;
                    textBoxAuthToken.Text = auth_token;
                }
            }
        }