public static PageTrayHistoryUploadedViewModel GetInstance() { if (PageTrayUpload == null) { lock (locker) { PageTrayUpload = new PageTrayHistoryUploadedViewModel(); } } return(PageTrayUpload); }
void UploadFileEvent(List <string> value) { NameValueCollection data = new NameValueCollection { { "sourceClient", "PC" }, { "audiskflag", "audiskpc" } }; Bll.AUFileDocument document = new AUFileDocument(); string temVal = document.AUDiskFilesCloud(AccountInfo.Token, value.ToArray(), data); JObject jo = (JObject)JsonConvert.DeserializeObject(temVal); if (JObjectHelper.GetStrNum(jo["code"].ToString()) == 200) { for (int i = 0; i < value.Count; i++) { XElement File = new XElement("File"); //File.SetElementValue("Id", UnDownload[Index].Id); File.SetElementValue("FileName", Path.GetFileName(value[i].ToString())); File.SetElementValue("FileUrl", value[i].ToString()); //File.SetElementValue("DownLoadPath", Path.Combine(localDownload, UnDownload[Index].FileName)); File.SetElementValue("CreateTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm")); FileOperationHelper.WriteXml(History, File); } DispatcherHelper.CheckBeginInvokeOnUI(() => { Delete(LocalTray); var trayUpload = PageTrayHistoryUploadedViewModel.GetInstance(); ThreadPool.QueueUserWorkItem(delegate { SynchronizationContext.SetSynchronizationContext( new System.Windows.Threading.DispatcherSynchronizationContext(System.Windows .Application .Current.Dispatcher)); SynchronizationContext.Current.Post(p => { trayUpload.GetLocalTrayHistoryUploaded(); }, null); }); }); } else { DispatcherHelper.CheckBeginInvokeOnUI(() => { MessageBox.Show(jo["message"].ToString()); }); } RunState = false; }