예제 #1
0
        private void DelCallback(bool obj)
        {
            if (obj)
            {
                GetUserFile.AsyncPOST(UserID, UserPWD, FolderID, (fd) => {
                    this.Dispatcher.BeginInvoke(new Action(() => {
                        this.VM = fd;
                        WP.Children.Clear();
                        txtTitle.Text = fd.Folder.Name;
                        txtCount.Text = $"收藏共 {fd.Folder.FileList.Count}個檔案";
                        int i         = 0;

                        if (fd.Folder.FileList.File != null && fd.Folder.FileList.File.Length > 0)
                        {
                            foreach (XML2.FolderDataFolderFileListFile item in fd.Folder.FileList.File)
                            {
                                i++;
                                WP.Children.Add(new FileRoom(UserID, UserPWD, item, DelCallback, FolderID));
                            }
                        }
                    }));
                    SaveData(fd);
                });
            }
        }
예제 #2
0
        private void SaveData(XML2.FolderData fd)
        {
            MSCE.ExecuteNonQuery("DELETE FROM [UserFile] WHERE userid=@1"
                                 , UserID);

            if (fd.Folder.FileList.File != null)
            {
                foreach (var item in fd.Folder.FileList.File)
                {
                    MSCE.ExecuteNonQuery("insert into UserFile (FolderID,UserID,fileID,meetingID,Meetingname,BeginTime) values(@1,@2,@3,@4,@5,@6)"
                                         , fd.Folder.ID.ToString()
                                         , UserID
                                         , item.ID
                                         , item.Meeting.ID
                                         , item.Meeting.Name
                                         , item.Meeting.BeginTime);
                }
            }
        }
예제 #3
0
        private void GetUserFolder_DoAction(XML2.FolderData fd)
        {
            //先判斷是否要invoke
            if (this.Dispatcher.CheckAccess() == false)
            {
                // 這裡是下載事件處理,優先權設定為ContextIdle => 列舉值為 3。 幕後作業完成後,會處理作業。
                this.Dispatcher.BeginInvoke(new Action <XML2.FolderData>(GetUserFolder_DoAction), fd);
            }
            else
            {
                if (fd != null)
                {
                    this.VM       = fd;
                    txtTitle.Text = fd.Folder.Name;
                    txtCount.Text = $"收藏共 {fd.Folder.FileList.Count}個檔案";
                    int i = 0;

                    if (fd.Folder.FileList.File != null && fd.Folder.FileList.File.Length > 0)
                    {
                        foreach (XML2.FolderDataFolderFileListFile item in fd.Folder.FileList.File)
                        {
                            i++;
                            WP.Children.Add(new FileRoom(UserID, UserPWD, item, DelCallback, FolderID));
                        }
                    }

                    //foreach (XML2.FolderDataFolderList item in fd.Folder.FileList)
                    //{
                    //    i++;
                    //    WP.Children.Add(new FileRoom(UserID, UserPWD, item));
                    //}

                    SaveData(fd);
                }
                else
                {
                    AutoClosingMessageBox.Show("無法取得資料,請稍後再試");
                }
                MouseTool.ShowArrow();
            }
        }