private void btnOpen_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { MouseTool.ShowLoading(); try { _003C_003Ec__DisplayClass14 _003C_003Ec__DisplayClass = new _003C_003Ec__DisplayClass14(); _003C_003Ec__DisplayClass._003C_003E4__this = this; ClickOnceTool.GetFilePath(); _003C_003Ec__DisplayClass._bookPath = lawItem.UnZipFilePath; _003C_003Ec__DisplayClass._bookId = ""; _003C_003Ec__DisplayClass._account = ""; _003C_003Ec__DisplayClass._userName = ""; _003C_003Ec__DisplayClass._email = ""; _003C_003Ec__DisplayClass._meetingId = ""; _003C_003Ec__DisplayClass._watermark = ""; _003C_003Ec__DisplayClass._dbPath = Path.Combine(ClickOnceTool.GetDataPath(), Settings.Default.bookInfo_Path); _003C_003Ec__DisplayClass._isSync = false; _003C_003Ec__DisplayClass._isSyncOwner = false; _003C_003Ec__DisplayClass._webServiceUrl = WsTool.GetUrl() + "/AnnotationUpload"; _003C_003Ec__DisplayClass._socketMessage = ""; _003C_003Ec__DisplayClass.cbBooksData = null; _003C_003Ec__DisplayClass.Home_Window = Enumerable.FirstOrDefault(Enumerable.OfType <Home>(Application.Current.Windows)); _003C_003Ec__DisplayClass.Home_Window.CloseAllWindow("", true); Task.Factory.StartNew(new Action(_003C_003Ec__DisplayClass._003CbtnOpen_MouseLeftButtonDown_003Eb__12)); } catch (Exception ex) { LogTool.Debug(ex); } MouseTool.ShowArrow(); }
private void btnOpen_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { MouseTool.ShowLoading(); try { //string AppPath = AppDomain.CurrentDomain.BaseDirectory; string filePath = ClickOnceTool.GetFilePath(); //string _bookPath = System.IO.Path.Combine(AppPath, lawItem.UnZipFilePath); string _bookPath = lawItem.UnZipFilePath; string _bookId = ""; string _account = ""; string _userName = ""; string _email = ""; string _meetingId = ""; string _watermark = ""; string _dbPath = System.IO.Path.Combine(ClickOnceTool.GetDataPath(), PaperLess_Emeeting.Properties.Settings.Default.bookInfo_Path); bool _isSync = false; bool _isSyncOwner = false; string _webServiceUrl = WsTool.GetUrl() + "/AnnotationUpload"; string _socketMessage = ""; // 呼叫一個事件取得 BookVMs //Dictionary<string, BookVM> cbBooksData = new Dictionary<string, BookVM>(); //if (LawListCT_GetBookVMs_ByMeetingFileCate_Event != null) // cbBooksData = LawListCT_GetBookVMs_ByMeetingFileCate_Event(lawItem); Dictionary <string, BookVM> cbBooksData = null; Home Home_Window = Application.Current.Windows.OfType <Home>().FirstOrDefault(); Home_Window.CloseAllWindow("", true); Task.Factory.StartNew(() => { this.Dispatcher.BeginInvoke((Action)(() => { ReadWindow rw = new ReadWindow(cbBooksData, Home_Window.OpenBookFromReader, _bookPath, _bookId, _account , _userName, _email, _meetingId , _watermark, _dbPath, _isSync , _isSyncOwner, _webServiceUrl, _socketMessage, null); rw.HideCollectFile = true; rw.WindowStyle = WindowStyle.None; rw.WindowStartupLocation = WindowStartupLocation.CenterScreen; rw.WindowState = WindowState.Maximized; if (PaperLess_Emeeting.Properties.Settings.Default.AssemblyName.Contains("TPI4F") == true) { //rw.WindowStyle = WindowStyle.SingleBorderWindow; } rw.Show(); })); }); } catch (Exception ex) { LogTool.Debug(ex); } MouseTool.ShowArrow(); }
private void AccessTableAction(string sql) { try { BookManager bookManager = new BookManager(Path.Combine(ClickOnceTool.GetDataPath(), Settings.Default.bookInfo_Path)); bookManager.sqlCommandNonQuery(sql); } catch (Exception ex) { LogTool.Debug(ex); } }
private void CheckDBVersion() { try { // DB最小版本為0; int InitDBVersion = 0; int LocalDBVersion = 0; int ToDBVersion = PaperLess_Emeeting.Properties.Settings.Default.NowDBVersion; string DB_FilePath = Path.Combine(ClickOnceTool.GetDataPath(), PaperLess_Emeeting.Properties.Settings.Default.PaperLessDB_Path); string ConfigIni_FilePath = Path.Combine(ClickOnceTool.GetDataPath(), PaperLess_Emeeting.Properties.Settings.Default.ConfigIni_Path); if (File.Exists(ConfigIni_FilePath) == true) { IniFileTool ini = new IniFileTool(ConfigIni_FilePath); try { int.TryParse(ini.IniReadValue("DB", "Version"), out LocalDBVersion); } catch (Exception ex) { LogTool.Debug(ex); } bool Success = UpdateDBVersion(LocalDBVersion); if (Success == true) { ini.IniWriteValue("DB", "Version", ToDBVersion.ToString()); } else { throw new Exception("DB更新失敗!"); } } else { //在嘗試更新一次,避免DB沒有更新到 UpdateDBVersion(LocalDBVersion); using (var writer = new FileStream(ConfigIni_FilePath, FileMode.OpenOrCreate)) { } IniFileTool ini = new IniFileTool(ConfigIni_FilePath); ini.IniWriteValue("DB", "Version", ToDBVersion.ToString()); } } catch (Exception ex) { LogTool.Debug(ex); } }
private void CheckDBVersion() { try { int result = 0; int nowDBVersion = Settings.Default.NowDBVersion; Path.Combine(ClickOnceTool.GetDataPath(), Settings.Default.PaperLessDB_Path); string text = Path.Combine(ClickOnceTool.GetDataPath(), Settings.Default.ConfigIni_Path); if (File.Exists(text)) { IniFileTool iniFileTool = new IniFileTool(text); try { int.TryParse(iniFileTool.IniReadValue("DB", "Version"), out result); } catch (Exception ex) { LogTool.Debug(ex); } if (!UpdateDBVersion(result)) { throw new Exception("DB更新失敗!"); } iniFileTool.IniWriteValue("DB", "Version", nowDBVersion.ToString()); } else { UpdateDBVersion(result); using (new FileStream(text, FileMode.OpenOrCreate)) { } IniFileTool iniFileTool2 = new IniFileTool(text); iniFileTool2.IniWriteValue("DB", "Version", nowDBVersion.ToString()); } } catch (Exception ex2) { LogTool.Debug(ex2); } }
private void CallOpenBook(bool HasOpenFinishedFileVersion = false) { MouseTool.ShowLoading(); try { Action action = null; Action action2 = null; Action action3 = null; _003C_003Ec__DisplayClass2a _003C_003Ec__DisplayClass2a = new _003C_003Ec__DisplayClass2a(); _003C_003Ec__DisplayClass2a._003C_003E4__this = this; _003C_003Ec__DisplayClass2a.Home_Window = Enumerable.FirstOrDefault(Enumerable.OfType <Home>(Application.Current.Windows)); if (_003C_003Ec__DisplayClass2a.Home_Window.IsInSync && !_003C_003Ec__DisplayClass2a.Home_Window.IsSyncOwner) { AutoClosingMessageBox.Show("同步中需由主控人員進行操作"); return; } string filePath = ClickOnceTool.GetFilePath(); string file_UnZipFileFolder = Settings.Default.File_UnZipFileFolder; _003C_003Ec__DisplayClass2a._bookPath = fileItem.UnZipFilePath; if (HasOpenFinishedFileVersion) { DataTable dataTable = MSCE.GetDataTable("SELECT FinishedFileVersion FROM FileRow where ID=@1 and UserID=@2 and MeetingID=@3", meetingDataDownloadFileFile.ID, UserID, MeetingID); if (dataTable.Rows.Count > 0) { _003C_003Ec__DisplayClass2a._bookPath = filePath + "\\" + file_UnZipFileFolder + "\\" + UserID + "\\" + MeetingID + "\\" + fileItem.ID + "\\" + dataTable.Rows[0]["FinishedFileVersion"].ToString(); } } _003C_003Ec__DisplayClass2a._bookId = fileItem.ID; _003C_003Ec__DisplayClass2a._account = UserID; _003C_003Ec__DisplayClass2a._userName = UserName; _003C_003Ec__DisplayClass2a._email = UserEmail; _003C_003Ec__DisplayClass2a._meetingId = MeetingID; _003C_003Ec__DisplayClass2a._watermark = ""; if (MeetingDataCT_GetWatermark_Event != null) { _003C_003Ec__DisplayClass2a._watermark = MeetingDataCT_GetWatermark_Event(); } _003C_003Ec__DisplayClass2a._dbPath = Path.Combine(ClickOnceTool.GetDataPath(), Settings.Default.bookInfo_Path); _003C_003Ec__DisplayClass2a._isSync = _003C_003Ec__DisplayClass2a.Home_Window.IsInSync; _003C_003Ec__DisplayClass2a._isSyncOwner = _003C_003Ec__DisplayClass2a.Home_Window.IsSyncOwner; _003C_003Ec__DisplayClass2a._webServiceUrl = WsTool.GetUrl() + "/AnnotationUpload"; _003C_003Ec__DisplayClass2a._socketMessage = ""; _003C_003Ec__DisplayClass2a._socket = null; SocketClient instance = Singleton_Socket.GetInstance(MeetingID, UserID, UserName, _003C_003Ec__DisplayClass2a.Home_Window.IsInSync); if (instance != null && instance.GetIsConnected()) { _003C_003Ec__DisplayClass2a._socket = instance; } _003C_003Ec__DisplayClass2a.cbBooksData = new Dictionary <string, BookVM>(); if (MeetingDataCT_GetBookVMs_ByMeetingFileCate_Event != null) { _003C_003Ec__DisplayClass2a.cbBooksData = MeetingDataCT_GetBookVMs_ByMeetingFileCate_Event(fileItem); } _003C_003Ec__DisplayClass2a.Home_Window.CloseAllWindow("", true); switch (fileItem.FileCate) { case MeetingFileCate.電子書: { InitSyncCenter(_003C_003Ec__DisplayClass2a._dbPath, _003C_003Ec__DisplayClass2a._bookId, _003C_003Ec__DisplayClass2a._account, _003C_003Ec__DisplayClass2a._meetingId); TaskFactory factory2 = Task.Factory; if (action == null) { action = new Action(_003C_003Ec__DisplayClass2a._003CCallOpenBook_003Eb__20); } factory2.StartNew(action); break; } case MeetingFileCate.Html5投影片: { _003C_003Ec__DisplayClass2a._bookPath = _003C_003Ec__DisplayClass2a._bookPath + "\\" + new FileInfo(Directory.GetFiles(_003C_003Ec__DisplayClass2a._bookPath)[0]).Name; InitSyncCenter(_003C_003Ec__DisplayClass2a._dbPath, _003C_003Ec__DisplayClass2a._bookId, _003C_003Ec__DisplayClass2a._account, _003C_003Ec__DisplayClass2a._meetingId); TaskFactory factory3 = Task.Factory; if (action2 == null) { action2 = new Action(_003C_003Ec__DisplayClass2a._003CCallOpenBook_003Eb__22); } factory3.StartNew(action2); break; } case MeetingFileCate.影片檔: { _003C_003Ec__DisplayClass2a._bookPath = _003C_003Ec__DisplayClass2a._bookPath + "\\" + new FileInfo(Directory.GetFiles(_003C_003Ec__DisplayClass2a._bookPath)[0]).Name; TaskFactory factory = Task.Factory; if (action3 == null) { action3 = new Action(_003C_003Ec__DisplayClass2a._003CCallOpenBook_003Eb__24); } factory.StartNew(action3); break; } } if (_003C_003Ec__DisplayClass2a.Home_Window.IsInSync && _003C_003Ec__DisplayClass2a.Home_Window.IsSyncOwner) { _003C_003Ec__DisplayClass2c _003C_003Ec__DisplayClass2c = new _003C_003Ec__DisplayClass2c(); _003C_003Ec__DisplayClass2c.CS_0024_003C_003E8__locals2b = _003C_003Ec__DisplayClass2a; _003C_003Ec__DisplayClass2c.socketClient = Singleton_Socket.GetInstance(MeetingID, UserID, UserName, _003C_003Ec__DisplayClass2a.Home_Window.IsInSync); Task.Factory.StartNew(new Action(_003C_003Ec__DisplayClass2c._003CCallOpenBook_003Eb__26)); } } catch (Exception ex) { LogTool.Debug(ex); } MouseTool.ShowArrow(); }
private void CallOpenBook(bool HasOpenFinishedFileVersion = false) { MouseTool.ShowLoading(); try { Home Home_Window = Application.Current.Windows.OfType <Home>().FirstOrDefault(); if (Home_Window.IsInSync == true && Home_Window.IsSyncOwner == false) { AutoClosingMessageBox.Show("同步中需由主控人員進行操作"); return; } // string filePath = ClickOnceTool.GetFilePath(); //string _bookPath = System.IO.Path.Combine(filePath, fileItem.UnZipFilePath); string UnZipFileFolder = PaperLess_Emeeting.Properties.Settings.Default.File_UnZipFileFolder; //string _bookPath = filePath + "\\" + UnZipFileFolder + "\\" + UserID + "\\" + MeetingID + "\\"+ fileItem.ID +"\\"+fileItem.FileVersion.ToString(); // 等於上面那個路徑 string _bookPath = fileItem.UnZipFilePath; // 從資料庫查詢上一次完成的檔案版本 if (HasOpenFinishedFileVersion == true) { DataTable dt = MSCE.GetDataTable("SELECT FinishedFileVersion FROM FileRow where ID=@1 and UserID=@2 and MeetingID=@3" , meetingDataDownloadFileFile.ID , UserID , MeetingID); if (dt.Rows.Count > 0) { _bookPath = filePath + "\\" + UnZipFileFolder + "\\" + UserID + "\\" + MeetingID + "\\" + fileItem.ID + "\\" + dt.Rows[0]["FinishedFileVersion"].ToString(); } } string _bookId = fileItem.ID; string _account = UserID; string _userName = UserName; string _email = UserEmail; string _meetingId = MeetingID; string _watermark = ""; if (MeetingDataCT_GetWatermark_Event != null) { _watermark = MeetingDataCT_GetWatermark_Event(); } string _dbPath = System.IO.Path.Combine(ClickOnceTool.GetDataPath(), PaperLess_Emeeting.Properties.Settings.Default.bookInfo_Path); bool _isSync = Home_Window.IsInSync; bool _isSyncOwner = Home_Window.IsSyncOwner; string _webServiceUrl = WsTool.GetUrl() + "/AnnotationUpload"; string _socketMessage = ""; SocketClient _socket = null; SocketClient tmpSocket = Singleton_Socket.GetInstance(MeetingID, UserID, UserName, Home_Window.IsInSync); if (tmpSocket != null && tmpSocket.GetIsConnected() == true) { _socket = tmpSocket; } //if (_socket.GetIsConnected() == false) // _socket = null; //if (Home_Window.IsInSync == false) // _socket = null; // 呼叫一個事件取得 BookVMs Dictionary <string, BookVM> cbBooksData = new Dictionary <string, BookVM>(); if (MeetingDataCT_GetBookVMs_ByMeetingFileCate_Event != null) { cbBooksData = MeetingDataCT_GetBookVMs_ByMeetingFileCate_Event(fileItem); } // debug //BooksData["cAF6-P"] = new BookVM("cAF6-P", filePath + "\\" + UnZipFileFolder + "\\" + UserID + "\\" + MeetingID + "\\" + "cAF6-P"); //BooksData["cAF3-P"] = new BookVM("cAF3-P", filePath + "\\" + UnZipFileFolder + "\\" + UserID + "\\" + MeetingID + "\\" + "cAF3-P"); Home_Window.CloseAllWindow("", true); switch (fileItem.FileCate) { case MeetingFileCate.電子書: InitSyncCenter(_dbPath, _bookId, _account, _meetingId); Task.Factory.StartNew(() => { this.Dispatcher.BeginInvoke((Action)(() => { byte[] ReaderKey = new byte[1]; try { if (fileItem.EncryptionKey.Equals("") == false) { ReaderKey = ReaderDecodeTool.GetReaderKey(fileItem.EncryptionKey); } } catch (Exception ex) { LogTool.Debug(ex); } ReadWindow rw = new ReadWindow(cbBooksData, Home_Window.OpenBookFromReader, _bookPath, _bookId, _account , _userName, _email, _meetingId , _watermark, _dbPath, _isSync , _isSyncOwner, _webServiceUrl, ReaderKey, _socketMessage, _socket); //ReadWindow rw = new ReadWindow(cbBooksData, Home_Window.OpenBookFromReader, _bookPath, _bookId, _account // , _userName, _email, _meetingId // , _watermark, _dbPath, _isSync // , _isSyncOwner, _webServiceUrl, _socketMessage, _socket); rw.FolderID = this.FolderID; rw.WindowStyle = WindowStyle.None; rw.WindowStartupLocation = WindowStartupLocation.CenterScreen; rw.WindowState = WindowState.Maximized; if (PaperLess_Emeeting.Properties.Settings.Default.AssemblyName.Contains("TPI4F") == true) { //rw.WindowStyle = WindowStyle.SingleBorderWindow; } rw.Show(); })); }); break; case MeetingFileCate.Html5投影片: _bookPath = _bookPath + @"\" + new FileInfo(Directory.GetFiles(_bookPath)[0]).Name; InitSyncCenter(_dbPath, _bookId, _account, _meetingId); Task.Factory.StartNew(() => { this.Dispatcher.BeginInvoke((Action)(() => { HTML5ReadWindow Html5rw = new HTML5ReadWindow(cbBooksData, Home_Window.OpenBookFromReader, _bookPath, _bookId, _account , _userName, _email, _meetingId , _watermark, _dbPath, _isSync , _isSyncOwner, _webServiceUrl, _socketMessage, _socket); Html5rw.FolderID = this.FolderID; Html5rw.WindowStyle = WindowStyle.None; Html5rw.WindowStartupLocation = WindowStartupLocation.CenterScreen; Html5rw.WindowState = WindowState.Maximized; if (PaperLess_Emeeting.Properties.Settings.Default.AssemblyName.Contains("TPI4F") == true) { //Html5rw.WindowStyle = WindowStyle.SingleBorderWindow; } Html5rw.Show(); })); }); break; case MeetingFileCate.影片檔: _bookPath = _bookPath + @"\" + new FileInfo(Directory.GetFiles(_bookPath)[0]).Name; Task.Factory.StartNew(() => { this.Dispatcher.BeginInvoke((Action)(() => { MVWindow mvWindow = new MVWindow(cbBooksData, Home_Window.OpenBookFromReader, _bookPath, _bookId); mvWindow.WindowStyle = WindowStyle.None; mvWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen; mvWindow.WindowState = WindowState.Maximized; if (PaperLess_Emeeting.Properties.Settings.Default.AssemblyName.Contains("TPI4F") == true) { //mvWindow.WindowStyle = WindowStyle.SingleBorderWindow; } mvWindow.Show(); })); }); break; } if (Home_Window.IsInSync == true && Home_Window.IsSyncOwner == true) { SocketClient socketClient = Singleton_Socket.GetInstance(MeetingID, UserID, UserName, Home_Window.IsInSync); Task.Factory.StartNew(() => { if (socketClient != null && socketClient.GetIsConnected() == true) { string OB = "{\"bookId\":\"" + meetingDataDownloadFileFile.ID + "\",\"cmd\":\"R.OB\"}"; socketClient.broadcast(OB); } else { //AutoClosingMessageBox.Show("同步伺服器尚未啟動,請聯絡議事管理員開啟同步"); } }); } } catch (Exception ex) { LogTool.Debug(ex); } MouseTool.ShowArrow(); }