private NewPostItem BatchPhotoPost(NewPostItem newPost)
        {
            int    _count    = 0;
            string _tmpStamp = DateTime.Now.Ticks.ToString();

            s_logger.Trace("[" + _tmpStamp + "]" + "BatchPhotoPost:" + newPost.Text + ", Files=" + newPost.Files.Count);

            string _ids = "[";

            while (true)
            {
                if (StartUpload)
                {
                    string _file = newPost.Files[_count];

                    if (newPost.UploadedFiles.Keys.Contains(_file))
                    {
                        _ids += "\"" + newPost.UploadedFiles[_file] + "\"" + ",";

                        s_logger.Trace("[" + _tmpStamp + "]" + "Batch Sended Photo [" + _count + "]" + _file);
                    }
                    else
                    {
                        try
                        {
                            Downloading = true;

                            if (!File.Exists(_file))
                            {
                                // 原始檔案不存在. 作錯誤處裡
                                s_logger.Error("Image File does not exist: [" + _file + "]");

                                if (ShowFileMissDialog != null)
                                {
                                    ShowFileMissDialog(_file);
                                }

                                while (Main.Current.NewPostThreadErrorDialogResult == DialogResult.None)
                                {
                                    Thread.Sleep(500);
                                }

                                switch (Main.Current.NewPostThreadErrorDialogResult)
                                {
                                case DialogResult.Cancel:      // Delete Post
                                    newPost.ErrorAndDeletePost = true;
                                    newPost.PostOK             = false;
                                    return(newPost);

                                case DialogResult.Yes:     // Remove Picture
                                    s_logger.Error("Remove: [" + _file + "]");

                                    newPost.Files.Remove(_file);
                                    newPost.PostOK = false;

                                    UpdateUI(int.MinValue, "");

                                    return(newPost);

                                case DialogResult.Retry:      // DoNothing
                                    s_logger.Error("Ignore & Retry Miss File: [" + _file + "]");

                                    newPost.PostOK = false;
                                    return(newPost);
                                }
                            }

                            if (CheckStoragesUsage() <= 0)
                            {
                                if (CheckStoragesUsage() <= 0) //Hack
                                {
                                    // 雲端個人儲存空間不足. 作錯誤處裡
                                    s_logger.Error("(CheckStoragesUsage() <= 0)");

                                    if (OverQuotaMissDialog != null)
                                    {
                                        OverQuotaMissDialog("");
                                    }

                                    while (Main.Current.NewPostThreadErrorDialogResult == DialogResult.None)
                                    {
                                        Thread.Sleep(500);
                                    }

                                    switch (Main.Current.NewPostThreadErrorDialogResult)
                                    {
                                    case DialogResult.Cancel:     // Delete Post
                                        newPost.ErrorAndDeletePost = true;
                                        newPost.PostOK             = false;
                                        return(newPost);

                                    case DialogResult.Retry:     // DoNothing

                                        newPost.PostOK = false;
                                        return(newPost);
                                    }
                                }
                            }

                            string _text         = new FileName(_file).Name;
                            string _resizedImage = ImageUtility.ResizeImage(_file, _text, newPost.ResizeRatio, 100);

                            MR_attachments_upload _uf = Main.Current.RT.REST.File_UploadFile(_text, _resizedImage, "",
                                                                                             true);
                            if (_uf == null)
                            {
                                newPost.PostOK = false;
                                return(newPost);
                            }

                            _ids += "\"" + _uf.object_id + "\"" + ",";

                            newPost.UploadedFiles.Add(_file, _uf.object_id);

                            s_logger.Trace("[" + _tmpStamp + "]" + "Batch Upload Photo [" + _count + "]" + _file);

                            string _localFile = Main.GCONST.CachePath + _uf.object_id + "_origin_" + _text;
                            File.Copy(_file, _localFile);

                            Downloading = false;
                        }
                        catch (Exception _e)
                        {
                            Downloading = false;

                            NLogUtility.Exception(s_logger, _e, "BatchPhotoPost:File_UploadFile");
                            newPost.PostOK = false;
                            return(newPost);
                        }
                    }

                    _count++;

                    int _counts = newPost.Files.Count;

                    if (UpdateUI != null)
                    {
                        string _msg;

                        if (Items.Count == 1)
                        {
                            _msg = string.Format(I18n.L.T("OnePostUpload"), _count, _counts - _count);
                        }
                        else
                        {
                            _msg = string.Format(I18n.L.T("MultiplePostUpload"), _count, _counts - _count, Items.Count - 1);
                        }

                        UpdateUI(_count * 100 / _counts, _msg);
                    }

                    if (_count == _counts)
                    {
                        break;
                    }
                }
                else
                {
                    newPost.PostOK = false;
                    return(newPost);
                }
            }

            _ids  = _ids.Substring(0, _ids.Length - 1); // 去掉最後一個","
            _ids += "]";

            try
            {
                MR_posts_new _np = Main.Current.RT.REST.Posts_New(newPost.Text, _ids, "", "image");

                if (_np == null)
                {
                    newPost.PostOK = false;
                    return(newPost);
                }

                s_logger.Trace("[" + _tmpStamp + "]" + "Batch Post:" + newPost.Text + ", Files=" + newPost.Files.Count);
            }
            catch (Exception _e)
            {
                NLogUtility.Exception(s_logger, _e, "BatchPhotoPost:File_UploadFile");

                newPost.PostOK = false;
                return(newPost);
            }

            newPost.PostOK = true;
            return(newPost);
        }
        public MR_attachments_upload File_UploadFile(string text, string filePath, string object_id, bool isImage)
        {
            if (!IsNetworkAvailable)
            {
                return(null);
            }

            MR_attachments_upload _ret;
            string _resizedImageFilePath = string.Empty;

            if (isImage)
            {
                if (m_rt.StationMode) //如果有Station則上傳原圖, 否則就上512中圖
                {
                    _ret = m_service.attachments_upload(SessionToken, m_rt.CurrentGroupID, filePath, text, "", "image", "origin", object_id);
                }
                else
                {
                    _resizedImageFilePath = ImageUtility.ResizeImage(filePath, text, "512", 85);

                    _ret = m_service.attachments_upload(SessionToken, m_rt.CurrentGroupID, _resizedImageFilePath, text, "", "image", "medium", object_id);
                }
            }
            else
            {
                _ret = m_service.attachments_upload(SessionToken, m_rt.CurrentGroupID, filePath, text, "", "doc", "", "");
            }

            if (_ret != null)
            {
                if (_ret.status == "401")
                {
                    throw new Station401Exception();
                }

                if (_ret.status == "200")
                {
                    // 如果傳中圖到Cloud, 則要把原圖Cache起來, 待有Station再傳原圖
                    if (_resizedImageFilePath != string.Empty)
                    {
                        string _ext = ".jpg";

                        int _idx = text.IndexOf(".");

                        if (_idx != -1)
                        {
                            _ext = text.Substring(_idx);
                        }

                        string _originCacheFile_OID  = Main.GCONST.ImageUploadCachePath + _ret.object_id + _ext;
                        string _originCacheFile_REAL = Main.GCONST.ImageUploadCachePath + text;

                        File.Copy(filePath, _originCacheFile_OID, true);

                        Main.Current.UploadOriginPhotosToStationManager.Add(_originCacheFile_OID, _originCacheFile_REAL, _ret.object_id);
                    }

                    return(_ret);
                }
            }

            return(null);
        }