Example #1
0
 /// <summary>
 /// コンストラクタ
 /// </summary>
 public HttpSendJob(PicData dataToSend, DateTime expire)
     : base(dataToSend, expire)
 {
     //デフォルト値の設定
     Credentials = CredentialCache.DefaultNetworkCredentials;
     Timeout = 20;
 }
Example #2
0
 /// <summary>
 /// コンストラクタ
 /// </summary>
 public LocalSendJob(PicData dataToSend, DateTime expire)
     : base(dataToSend, expire)
 {
 }
Example #3
0
 /// <summary>
 /// 撮影イベントを発生させる
 /// </summary>
 /// <param name="pd"></param>
 private void OnPictureTaken(PicData pd)
 {
     if (PictureTaken != null)
     {
         PictureTaken(this, new DataEventArgs(pd));
     }
 }
Example #4
0
        /// <summary>
        /// データをHTTPで送信する
        /// </summary>
        /// <param name="dataToSend"></param>
        /// <returns></returns>
        private bool SendHttp(PicData dataToSend)
        {
            //位置情報等
            Dictionary<string, string> formValues = new Dictionary<string, string>();

            formValues["Accuracy"] = dataToSend.Location.Accuracy.ToString("G17");
            formValues["Altitude"] = dataToSend.Location.Altitude.ToString("G17");
            formValues["Latitude"] = dataToSend.Location.Latitude.ToString("G17");
            formValues["Longitude"] = dataToSend.Location.Longitude.ToString("G17");
            formValues["Provider"] = dataToSend.Location.Provider;
            formValues["Speed"] = dataToSend.Location.Speed.ToString("G17");
            formValues["Time"] = dataToSend.Location.Time.ToString("yyyy/MM/dd HH:mm:ss");
            formValues["TimeStamp"] = dataToSend.TimeStamp.ToString("yyyy/MM/dd HH:mm:ss");

            //画像データを添付
            using (MemoryStream ms = new MemoryStream(dataToSend.Data))
            {

                bool sendOK =  HttpUploadFile(this.Url,
                                             this.Credentials,
                                             MakeFileName(dataToSend.TimeStamp),
                                             ms,
                                             "file",
                                             "image/jpeg",
                                             formValues,
                                             TimeSpan.FromSeconds(this.Timeout));

                return sendOK;
            }
        }
Example #5
0
 public DataEventArgs(PicData pd)
 {
     this.Data = pd;
 }