Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
            public void _003CbtnOpen_MouseLeftButtonDown_003Eb__13()
            {
                ReadWindow readWindow = new ReadWindow(cbBooksData, new Home_OpenBookFromReader_Function(Home_Window.OpenBookFromReader), _bookPath, _bookId, _account, _userName, _email, _meetingId, _watermark, _dbPath, _isSync, _isSyncOwner, _webServiceUrl, _socketMessage);

                readWindow.WindowStyle           = WindowStyle.None;
                readWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                readWindow.WindowState           = WindowState.Maximized;
                Settings.Default.AssemblyName.Contains("TPI4F");
                readWindow.Show();
            }
Exemplo n.º 3
0
        public override IEnumerable <KeyValuePair <string, string> > GetLoadedOptionsPairs()
        {
            yield return(new KeyValuePair <string, string>("IP", Ip));

            yield return(new KeyValuePair <string, string>("TCP PORT", TcpPort.ToString()));

            yield return(new KeyValuePair <string, string>("HTTP PORT", HttpPort.ToString()));

            yield return(new KeyValuePair <string, string>("TIMEOUT", Timeout.ToString()));

            yield return(new KeyValuePair <string, string>("READ WINDOW", ReadWindow.ToString()));

            yield return(new KeyValuePair <string, string>("WRITE WINDOW", WriteWindow.ToString()));

            yield return(new KeyValuePair <string, string>("PING WINDOW", PingWindow.ToString()));
        }
Exemplo n.º 4
0
            public void _003CCallOpenBook_003Eb__21()
            {
                byte[] defaultKey = new byte[1];
                try
                {
                    if (!_003C_003E4__this.fileItem.EncryptionKey.Equals(""))
                    {
                        defaultKey = ReaderDecodeTool.GetReaderKey(_003C_003E4__this.fileItem.EncryptionKey);
                    }
                }
                catch (Exception ex)
                {
                    LogTool.Debug(ex);
                }
                ReadWindow readWindow = new ReadWindow(cbBooksData, new Home_OpenBookFromReader_Function(Home_Window.OpenBookFromReader), _bookPath, _bookId, _account, _userName, _email, _meetingId, _watermark, _dbPath, _isSync, _isSyncOwner, _webServiceUrl, defaultKey, _socketMessage, _socket);

                readWindow.WindowStyle           = WindowStyle.None;
                readWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                readWindow.WindowState           = WindowState.Maximized;
                Settings.Default.AssemblyName.Contains("TPI4F");
                readWindow.Show();
            }
Exemplo n.º 5
0
        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();
        }