Пример #1
0
        private void LightGrid_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            string SyncOwnerID = "";

            if (txtLight.Text.Equals("關"))
            {
                SyncOwnerID = clientId;
            }

            Task.Factory.StartNew(() =>
            {
                try
                {
                    SocketClient socketClient = Singleton_Socket.GetInstance(MeetingID, UserID, UserName, false);
                    if (socketClient != null && socketClient.GetIsConnected() == true)
                    {
                        socketClient.setSyncOwner(Socket_FixEmailUserID.ToSocket(SyncOwnerID));
                        return;
                    }
                    else
                    {
                        //AutoClosingMessageBox.Show("同步伺服器尚未啟動,請聯絡議事管理員開啟同步");
                        return;
                    }
                }
                catch (Exception ex)
                {
                    LogTool.Debug(ex);
                }
            });
        }
Пример #2
0
        private void ResetFileItemDB(File_DownloadItemViewModel fileItem)
        {
            if (fileItem == null)
            {
                return;
            }

            fileItem.DownloadBytes  = 0;
            fileItem.TotalBytes     = 0;
            fileItem.LastPercentage = 0;

            if (File.Exists(fileItem.StorageFilePath) == true)
            {
                File.Delete(fileItem.StorageFilePath);
            }
            //寫DB
            string SQL = @"update  FileRow set Url=@1,StorageFileName=@2
                       , DownloadBytes=@3,TotalBytes=@4 where ID=@6 and UserID=@7 and MeetingID=@8";

            int successNum = MSCE.ExecuteNonQuery(SQL
                                                  , fileItem.Url
                                                  , fileItem.StorageFileName
                                                  , fileItem.DownloadBytes.ToString()
                                                  , fileItem.TotalBytes.ToString()
                                                  , fileItem.ID
                                                  , fileItem.UserID
                                                  , fileItem.MeetingID);

            if (successNum < 1)
            {
                LogTool.Debug(new Exception("DB失敗:" + SQL));
            }
        }
        private Bitmap renPdfToBitmap(CACodecTools caTool, string pageFile, byte[] key, int pg, int dpi, float scal, int decodedPageIndex, Border border, bool isSinglePage)
        {
            System.Drawing.Color white = System.Drawing.Color.White;
            Bitmap aBitmap             = null;

            try
            {
                if (decodedPDFPages[decodedPageIndex] == null)
                {
                    decodedPDFPages[decodedPageIndex] = caTool.fileAESDecode(pageFile, key);
                }
            }
            catch (Exception ex)
            {
                decodedPDFPages[decodedPageIndex] = null;
                LogTool.Debug(ex);
            }
            try
            {
                PDFDoc pDFDoc = new PDFDoc();
                pDFDoc.Init("PVD20-M4IRG-QYZK9-MNJ2U-DFTK1-MAJ4L", "PDFX3$Henry$300604_Allnuts#");
                pDFDoc.OpenFromMemory(decodedPDFPages[decodedPageIndex], (uint)decodedPDFPages[decodedPageIndex].Length, 0);
                PXCV_Lib36.PXV_CommonRenderParameters aCommonRenderParams = prepareCommonRenderParameter(pDFDoc, dpi, pg, scal, 0, 0, border, isSinglePage);
                pDFDoc.DrawPageToDIBSection(IntPtr.Zero, pg, white, aCommonRenderParams, out aBitmap);
                pDFDoc.ReleasePageCachedData(pg, 1);
                pDFDoc.Delete();
                return(aBitmap);
            }
            catch (Exception ex2)
            {
                LogTool.Debug(ex2);
                return(aBitmap);
            }
        }
Пример #4
0
    public static SigninData POST(string meetingID)
    {
        SigninData result = null;

        try
        {
            string url    = WsTool.GetUrl();
            string format = "<?xml version=\"1.0\"?><UserInfo><MeetingID>{0}</MeetingID></UserInfo>";
            format = string.Format(format, meetingID);
            Dictionary <string, string> dictionary = new Dictionary <string, string>();
            dictionary["XmlDoc"] = format;
            string text = HttpTool.CreateRequest(url + "/SigninData", "POST", dictionary);
            if (text.Equals(""))
            {
                return(result);
            }
            result = XmlHelper.XmlDeserialize <SigninData>(text, Encoding.UTF8);
            return(result);
        }
        catch (Exception ex)
        {
            LogTool.Debug(ex);
            return(result);
        }
    }
Пример #5
0
        public bool SyncServerAlreadyStarted(string meetingID)
        {
            bool rtn = false;

            try
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendFormat("<?xml version=\"1.0\" encoding=\"UTF-8\"?>")
                .AppendFormat("<MeetingList date=\"{0}\" >", DateTime.Now.ToString("yyyyMMddHHmmss"))
                .AppendFormat("</MeetingList>");

                XDocument xml = XDocument.Parse(PostToSyncServer("/GetMeetingList", sb.ToString()));
                var       q   = from x in xml.Element("MeetingList").Elements("Meeting")
                                select new
                {
                    ID = x.Attribute("ID").Value.Trim(),
                };
                foreach (var item in q)
                {
                    if (item.ID.Equals(meetingID) == true)
                    {
                        return(true);
                    }
                }
            }
            catch (Exception ex)
            {
                rtn = false;
                LogTool.Debug(ex);
            }

            return(rtn);
        }
Пример #6
0
    public static User POST(string UserID, string UserPWD, string UserDateBegin, string UserDateEnd)
    {
        User result = null;

        try
        {
            string url    = WsTool.GetUrl();
            string format = "<?xml version=\"1.0\"?><UserInfo><UserID><![CDATA[{0}]]></UserID><UserPW><![CDATA[{1}]]></UserPW><UserDevice>1</UserDevice><UserDateBegin>{2}</UserDateBegin><UserDateEnd>{3}</UserDateEnd></UserInfo>";
            format = string.Format(format, UserID, UserPWD, UserDateBegin, UserDateEnd);
            Dictionary <string, string> dictionary = new Dictionary <string, string>();
            dictionary["XmlDoc"] = format;
            string text = HttpTool.CreateRequest(url + "/UserData", "POST", dictionary);
            if (text.Equals(""))
            {
                return(result);
            }
            result = XmlHelper.XmlDeserialize <User>(text, Encoding.UTF8);
            return(result);
        }
        catch (Exception ex)
        {
            LogTool.Debug(ex);
            return(result);
        }
    }
Пример #7
0
        private void ConfirmWindow_Loaded(object sender, RoutedEventArgs e)
        {
            IntPtr hwnd = new WindowInteropHelper(this).Handle;

            SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) & ~WS_SYSMENU);

            Task.Factory.StartNew(() =>
            {
                InitSelectDB();
                //this.Dispatcher.BeginInvoke(DispatcherPriority.Send, new Action(() =>
                this.Dispatcher.BeginInvoke(new Action(() =>
                {
                    try
                    {
                        InitUI();
                        InitEvent();
                    }
                    catch (Exception ex)
                    {
                        LogTool.Debug(ex);
                    }
                    MouseTool.ShowArrow();
                }));
            });
        }
Пример #8
0
    public static bool POST(string MeetingID, string UserID, string AgendaID, string AgendaStatus)
    {
        bool result = false;

        try
        {
            string url    = WsTool.GetUrl();
            string format = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><UserInfo><MeetingID>{0}</MeetingID><UserID><![CDATA[{1}]]></UserID><UpdateList><UpdateAgenda><AgendaID>{2}</AgendaID><AgendaStatus>{3}</AgendaStatus></UpdateAgenda></UpdateList></UserInfo>";
            format = string.Format(format, MeetingID, UserID, AgendaID, AgendaStatus);
            Dictionary <string, string> dictionary = new Dictionary <string, string>();
            dictionary["XmlDoc"] = format;
            string text = HttpTool.CreateRequest(url + "/ProgressUpload", "POST", dictionary);
            if (!text.Contains("</succes>"))
            {
                return(result);
            }
            result = true;
            return(result);
        }
        catch (Exception ex)
        {
            LogTool.Debug(ex);
            return(result);
        }
    }
        private void _003CInitEvent_003Eb__8(Task <bool> task)
        {
            Action action = null;
            _003C_003Ec__DisplayClass12 _003C_003Ec__DisplayClass = new _003C_003Ec__DisplayClass12();

            _003C_003Ec__DisplayClass.task = task;
            _003C_003Ec__DisplayClass._003C_003E4__this = this;
            try
            {
                Dispatcher dispatcher = base.Dispatcher;
                if (action == null)
                {
                    action = new Action(_003C_003Ec__DisplayClass._003CInitEvent_003Eb__9);
                }
                dispatcher.BeginInvoke(action);
                if (_003C_003Ec__DisplayClass.task.Result)
                {
                    try
                    {
                        _003C_003Ec__DisplayClass14 _003C_003Ec__DisplayClass2 = new _003C_003Ec__DisplayClass14();
                        _003C_003Ec__DisplayClass2.CS_0024_003C_003E8__locals13 = _003C_003Ec__DisplayClass;
                        _003C_003Ec__DisplayClass2.socketClient = Singleton_Socket.GetInstance(MeetingID, UserID, UserName, false);
                        Task.Factory.StartNew(new Action(_003C_003Ec__DisplayClass2._003CInitEvent_003Eb__a));
                    }
                    catch (Exception ex)
                    {
                        LogTool.Debug(ex);
                    }
                }
            }
            catch (Exception ex2)
            {
                LogTool.Debug(ex2);
            }
        }
Пример #10
0
 public void _003CGetHttpImage_003Eb__10()
 {
     try
     {
         _003C_003Ec__DisplayClass15 _003C_003Ec__DisplayClass = new _003C_003Ec__DisplayClass15();
         _003C_003Ec__DisplayClass.CS_0024_003C_003E8__locals14 = this;
         WebClient webClient = new WebClient();
         webClient.CachePolicy = new RequestCachePolicy(RequestCacheLevel.Revalidate);
         byte[] buffer = webClient.DownloadData(imgUrl);
         _003C_003Ec__DisplayClass.bitmapImage = new BitmapImage();
         using (MemoryStream streamSource = new MemoryStream(buffer))
         {
             _003C_003Ec__DisplayClass.bitmapImage.BeginInit();
             _003C_003Ec__DisplayClass.bitmapImage.CacheOption  = BitmapCacheOption.OnLoad;
             _003C_003Ec__DisplayClass.bitmapImage.StreamSource = streamSource;
             _003C_003Ec__DisplayClass.bitmapImage.EndInit();
             _003C_003Ec__DisplayClass.bitmapImage.Freeze();
         }
         _003C_003E4__this.Dispatcher.BeginInvoke(new Action(_003C_003Ec__DisplayClass._003CGetHttpImage_003Eb__11));
     }
     catch (Exception ex)
     {
         LogTool.Debug(ex);
     }
 }
Пример #11
0
        public void _003CAsyncPOST_003Eb__0(HttpWebResponse response)
        {
            bool obj = false;

            try
            {
                string text = "";
                using (Stream stream = response.GetResponseStream())
                {
                    using (StreamReader streamReader = new StreamReader(stream, Encoding.UTF8))
                    {
                        text = streamReader.ReadToEnd();
                    }
                }
                if (text.Contains("</succes>"))
                {
                    obj = true;
                }
            }
            catch (Exception ex)
            {
                if (ErrorAction != null)
                {
                    ErrorAction();
                }
                LogTool.Debug(ex);
            }
            DoAction(obj);
        }
Пример #12
0
 public static void ClearInstance()
 {
     try
     {
         //20150421
         //不要Abort因為Line:188~189
         //直接instance=null
         //Thread就會結束。
         //if (thread != null)
         //{
         //    thread.Abort();
         //}
         //instance = null;
         if (thread != null)
         {
             thread.Abort();
             //thread = null;
         }
     }
     catch (Exception ex)
     {
         LogTool.Debug(ex);
     }
     Thread.Sleep(10);
     thread   = null;
     instance = null;
 }
Пример #13
0
 private void UpdateToDB(File_DownloadItemViewModel fileItem, bool IsFinished = false)
 {
     if (fileItem != null)
     {
         string text = "";
         int    num  = 0;
         try
         {
             if (IsFinished)
             {
                 text = "update FileRow set Url=@1,StorageFileName=@2\r\n                           , DownloadBytes=@3,TotalBytes=@4 ,FileVersion=@5,FinishedFileVersion=@6 where ID=@7 and UserID=@8 and MeetingID=@9";
                 fileItem.CanUpdate = false;
                 num = MSCE.ExecuteNonQuery(text, fileItem.Url, fileItem.StorageFileName, fileItem.DownloadBytes.ToString(), fileItem.TotalBytes.ToString(), fileItem.FileVersion.ToString(), fileItem.FileVersion.ToString(), fileItem.ID, fileItem.UserID, fileItem.MeetingID);
             }
             else
             {
                 text = "update FileRow set Url=@1,StorageFileName=@2\r\n                           , DownloadBytes=@3,TotalBytes=@4 where ID=@6 and UserID=@7 and MeetingID=@8";
                 num  = MSCE.ExecuteNonQuery(text, fileItem.Url, fileItem.StorageFileName, fileItem.DownloadBytes.ToString(), fileItem.TotalBytes.ToString(), fileItem.ID, fileItem.UserID, fileItem.MeetingID);
             }
         }
         catch (Exception ex)
         {
             LogTool.Debug(ex);
         }
         if (num < 1)
         {
             LogTool.Debug(new Exception("DB失敗:" + text));
         }
     }
 }
Пример #14
0
 public static int CheckNetwork()
 {
     if (!Settings.Default.HasOfflineMode)
     {
         return(1);
     }
     try
     {
         HttpRequest httpRequest = new HttpRequest();
         string      text        = "";
         string      text2       = "";
         text  = WsTool.GetUrl();
         text2 = new Uri(text).DnsSafeHost;
         if (!GetDomainNameIP(text2, 1000).Equals("") && httpRequest.checkNetworkStatus("", text) == NetworkStatusCode.OK)
         {
             return(1);
         }
         return(0);
     }
     catch (Exception ex)
     {
         LogTool.Debug(ex);
         return(1);
     }
 }
    public static void AsyncPOST(string UserID, string PinCode, Action <string> DoAction, Action ErrorAction = null)
    {
        Action <HttpWebResponse>   action = null;
        _003C_003Ec__DisplayClass2 _003C_003Ec__DisplayClass = new _003C_003Ec__DisplayClass2();

        _003C_003Ec__DisplayClass.DoAction    = DoAction;
        _003C_003Ec__DisplayClass.ErrorAction = ErrorAction;
        try
        {
            string url    = WsTool.GetUrl();
            string format = "<?xml version=\"1.0\"?><UserInfo><UserID><![CDATA[{0}]]></UserID><PinCode>{1}</PinCode></UserInfo>";
            format = string.Format(format, UserID, PinCode);
            Dictionary <string, string> dictionary = new Dictionary <string, string>();
            dictionary["XmlDoc"] = format;
            HttpWebRequest httpWebRequest = HttpTool.GetHttpWebRequest(url + "/NewMeeting", "POST", dictionary);
            if (action == null)
            {
                action = new Action <HttpWebResponse>(_003C_003Ec__DisplayClass._003CAsyncPOST_003Eb__0);
            }
            HttpTool.DoWithResponse(httpWebRequest, action);
        }
        catch (Exception ex)
        {
            LogTool.Debug(ex);
        }
    }
Пример #16
0
 private void _003CbtnServerCtrl_MouseLeftButtonDown_003Eb__16()
 {
     try
     {
         _003C_003Ec__DisplayClass1e _003C_003Ec__DisplayClass1e = new _003C_003Ec__DisplayClass1e();
         _003C_003Ec__DisplayClass1e._003C_003E4__this = this;
         _003C_003Ec__DisplayClass1e.success           = StartSyncServer(MeetingID);
         base.Dispatcher.BeginInvoke(new Action(_003C_003Ec__DisplayClass1e._003CbtnServerCtrl_MouseLeftButtonDown_003Eb__17));
         if (_003C_003Ec__DisplayClass1e.success)
         {
             AutoClosingMessageBox.Show("啟動成功");
             try
             {
                 _003C_003Ec__DisplayClass20 _003C_003Ec__DisplayClass = new _003C_003Ec__DisplayClass20();
                 _003C_003Ec__DisplayClass.CS_0024_003C_003E8__locals1f = _003C_003Ec__DisplayClass1e;
                 _003C_003Ec__DisplayClass.socketClient = Singleton_Socket.GetInstance(MeetingID, UserID, UserName, false);
                 Task.Factory.StartNew(new Action(_003C_003Ec__DisplayClass._003CbtnServerCtrl_MouseLeftButtonDown_003Eb__18));
             }
             catch (Exception ex)
             {
                 LogTool.Debug(ex);
             }
         }
         else
         {
             AutoClosingMessageBox.Show("啟動失敗");
         }
     }
     catch (Exception ex2)
     {
         LogTool.Debug(ex2);
     }
 }
    public static SigninDataUpload POST(string MeetingID, string UserID, string DeptId, string filePath)
    {
        SigninDataUpload result = null;

        try
        {
            string url    = WsTool.GetUrl();
            string format = "<?xml version=\"1.0\"?><UserInfo><MeetingID>{0}</MeetingID><UserID><![CDATA[{1}]]></UserID><DeptId><![CDATA[{2}]]></DeptId></UserInfo>";
            format = string.Format(format, MeetingID, UserID, DeptId);
            Dictionary <string, string> dictionary = new Dictionary <string, string>();
            dictionary["XmlDoc"] = format;
            string text = HttpTool.CreateRequestWithFile(url + "/SigninDataUpload", "", filePath);
            if (text.Equals(""))
            {
                return(result);
            }
            result = XmlHelper.XmlDeserialize <SigninDataUpload>(text, Encoding.UTF8);
            return(result);
        }
        catch (Exception ex)
        {
            LogTool.Debug(ex);
            return(result);
        }
    }
Пример #18
0
        private void _003CbtnServerCtrl_MouseLeftButtonDown_003Eb__19()
        {
            Action action = null;

            try
            {
                _003C_003Ec__DisplayClass23 _003C_003Ec__DisplayClass = new _003C_003Ec__DisplayClass23();
                _003C_003Ec__DisplayClass._003C_003E4__this = this;
                _003C_003Ec__DisplayClass.success           = StopSyncServer(MeetingID);
                base.Dispatcher.BeginInvoke(new Action(_003C_003Ec__DisplayClass._003CbtnServerCtrl_MouseLeftButtonDown_003Eb__1a));
                if (_003C_003Ec__DisplayClass.success)
                {
                    AutoClosingMessageBox.Show("停止成功");
                    Dispatcher dispatcher = base.Dispatcher;
                    if (action == null)
                    {
                        action = new Action(_003CbtnServerCtrl_MouseLeftButtonDown_003Eb__1b);
                    }
                    dispatcher.BeginInvoke(action);
                }
                else
                {
                    AutoClosingMessageBox.Show("停止失敗");
                }
            }
            catch (Exception ex)
            {
                LogTool.Debug(ex);
            }
        }
 private void DownloadFileCompleted(Law_DownloadItemViewModel lawItem)
 {
     if (lawItem != null)
     {
         if (lawItem.StorageFileName.EndsWith(".update"))
         {
             lawItem.FileType = LawFileType.更新檔已下載完成;
             File.Move(lawItem.StorageFilePath, lawItem.StorageFilePath.Replace(".update", ""));
             lawItem.StorageFileName = lawItem.StorageFileName.Replace(".update", "");
         }
         else
         {
             lawItem.FileType = LawFileType.已下載完成;
         }
         UnzipTrigger(lawItem);
         if (this.LawListCT_DownloadFileCompleted_Event != null)
         {
             this.LawListCT_DownloadFileCompleted_Event(lawItem);
         }
         string text = "update  LawRow set AtDownloadFinished_XmlUpDate=@1\r\n                       , Link=@2,StorageFileName=@3\r\n                       , DownloadBytes=@4,TotalBytes=@5 where ID=@6 and UserID=@7";
         int    num  = MSCE.ExecuteNonQuery(text, lawItem.UpDate.ToString("yyyy/MM/dd HH:mm:ss"), lawItem.Link, lawItem.StorageFileName, lawItem.DownloadBytes.ToString(), lawItem.TotalBytes.ToString(), lawItem.ID, lawItem.UserID);
         if (num < 1)
         {
             LogTool.Debug(new Exception("DB失敗:" + text));
         }
     }
 }
        public bool SyncServerAlreadyStarted(string meetingID)
        {
            bool result = false;

            try
            {
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.AppendFormat("<?xml version=\"1.0\" encoding=\"UTF-8\"?>").AppendFormat("<MeetingList date=\"{0}\" >", DateTime.Now.ToString("yyyyMMddHHmmss")).AppendFormat("</MeetingList>");
                XDocument xDocument           = XDocument.Parse(PostToSyncServer("/GetMeetingList", stringBuilder.ToString()));
                IEnumerable <XElement> source = xDocument.Element("MeetingList").Elements("Meeting");
                if (CS_0024_003C_003E9__CachedAnonymousMethodDelegate9 == null)
                {
                    CS_0024_003C_003E9__CachedAnonymousMethodDelegate9 = new Func <XElement, _003C_003Ef__AnonymousType0 <string> >(_003CSyncServerAlreadyStarted_003Eb__8);
                }
                IEnumerable <_003C_003Ef__AnonymousType0 <string> > enumerable = Enumerable.Select(source, CS_0024_003C_003E9__CachedAnonymousMethodDelegate9);
                foreach (_003C_003Ef__AnonymousType0 <string> item in enumerable)
                {
                    if (item.ID.Equals(meetingID))
                    {
                        return(true);
                    }
                }
                return(result);
            }
            catch (Exception ex)
            {
                result = false;
                LogTool.Debug(ex);
                return(result);
            }
        }
Пример #21
0
        private void btnDelete_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            MessageBoxResult result = MessageBox.Show("您確定要刪除檔案?", "系統訊息", MessageBoxButton.YesNo);

            if (result == MessageBoxResult.No)
            {
                return;
            }

            string SQL     = @"update  LawRow set DownloadBytes=0,TotalBytes=0 where ID=@1 and UserID=@2";
            int    success = MSCE.ExecuteNonQuery(SQL, lawDataLaw.ID, UserID);


            if (success < 1)
            {
                AutoClosingMessageBox.Show("刪除失敗");

                LogTool.Debug(new Exception(@"DB失敗: " + SQL));
                return;
            }

            if (File.Exists(lawItem.StorageFilePath) == true)
            {
                File.Delete(lawItem.StorageFilePath);
            }

            ShowNeverDownload(true);
        }
        private string PostToSyncServer(string subUrl, string sentXml)
        {
            string result = "";

            try
            {
                string str     = SocketTool.GetUrl();
                string url_Imp = SocketTool.GetUrl_Imp();
                if (MeetingID.ToLower().StartsWith("i"))
                {
                    str = url_Imp;
                }
                HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(str + subUrl);
                byte[]         bytes          = Encoding.UTF8.GetBytes(sentXml);
                httpWebRequest.Method        = "POST";
                httpWebRequest.ContentType   = "text/xml; encoding='utf-8'";
                httpWebRequest.ContentLength = bytes.Length;
                Stream requestStream = httpWebRequest.GetRequestStream();
                requestStream.Write(bytes, 0, bytes.Length);
                requestStream.Close();
                WebResponse response = httpWebRequest.GetResponse();
                requestStream = response.GetResponseStream();
                StreamReader streamReader = new StreamReader(requestStream);
                result = streamReader.ReadToEnd();
                streamReader.Close();
                requestStream.Close();
                response.Close();
                return(result);
            }
            catch (Exception ex)
            {
                LogTool.Debug(ex);
                return(result);
            }
        }
Пример #23
0
        public bool StopSyncServer(string meetingID)
        {
            bool rtn = false;

            try
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendFormat("<?xml version=\"1.0\" encoding=\"UTF-8\"?>")
                .AppendFormat("<Sync>")
                .AppendFormat("<Stop ID=\"{0}\" />", MeetingID)
                .AppendFormat("</Sync>");

                if (PostToSyncServer("/StopSyncServer", sb.ToString()).Contains("成功"))
                {
                    rtn = true;
                }
            }
            catch (Exception ex)
            {
                rtn = false;
                LogTool.Debug(ex);
            }

            return(rtn);
        }
Пример #24
0
 public void _003CInitSyncCenter_003Eb__1c()
 {
     try
     {
         SyncCenter syncCenter = new SyncCenter();
         syncCenter.bookManager = new BookManager(dbPath);
         int bookPath = _003C_003E4__this.getBookPath(dbPath, bookId, account, meetingId);
         Dictionary <string, object> dictionary = new Dictionary <string, object>();
         dictionary.Add("SBookmark", new BookMarkData());
         dictionary.Add("SAnnotation", new NoteData());
         dictionary.Add("SSpline", new StrokesData());
         dictionary.Add("SLastPage", new LastPageData());
         Dictionary <string, object> dictionary2 = dictionary;
         foreach (KeyValuePair <string, object> item in dictionary2)
         {
             string key                      = item.Key;
             Type   typeFromHandle           = typeof(SyncManager <>);
             Type   type                     = typeFromHandle.MakeGenericType(item.Value.GetType());
             AbstractSyncManager syncManager = (AbstractSyncManager)Activator.CreateInstance(type, account, "free", bookId, bookPath, key, 0, "0", WsTool.GetAbstractSyncCenter_BASE_URL());
             syncCenter.addSyncConditions(key, syncManager);
         }
     }
     catch (Exception ex)
     {
         LogTool.Debug(ex);
     }
 }
Пример #25
0
        public bool StartSyncServer(string meetingID)
        {
            bool rtn = false;

            //string getXml = "";

            try
            {
                StringBuilder sb = new StringBuilder();
                sb.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>")
                .Append("<Sync>")
                .AppendFormat("<Start ID=\"{0}\" MaxClient=\"{1}\" />", meetingID, 100)
                .AppendFormat("<Init>{0}</Init>", PaperLess_Emeeting.Properties.Settings.Default.InitConfig)
                .Append("</Sync>");

                XmlDocument doc = new XmlDocument();
                doc.LoadXml(PostToSyncServer("/StartSyncServer", sb.ToString()));
                XmlNode root = doc.DocumentElement;
                string  ip   = root.SelectSingleNode("/Sync/Start/@IP").Value;
                int     port = int.Parse(root.SelectSingleNode("/Sync/Start/@Port").Value);
                if (ip.Equals("") == false && port >= 1 && port <= 65535)
                {
                    rtn = true;
                }
            }
            catch (Exception ex)
            {
                rtn = false;
                LogTool.Debug(ex);
            }

            return(rtn);
        }
Пример #26
0
        private int getBookPath(string dbPath, string bookId, string account, string meetingId)
        {
            int result = 0;

            try
            {
                BookManager bookManager = new BookManager(dbPath);
                result = getUserBookSno(dbPath, bookId, account, meetingId);
                if (!result.Equals(-1))
                {
                    return(result);
                }
                string text  = "Insert into bookInfo( bookId, account, meetingId )";
                string text2 = text;
                text = text2 + " values('" + bookId + "', '" + account + "', '" + meetingId + "')";
                bookManager.sqlCommandNonQuery(text);
                result = getBookPath(dbPath, bookId, account, meetingId);
                return(result);
            }
            catch (Exception ex)
            {
                LogTool.Debug(ex);
                return(result);
            }
        }
Пример #27
0
        public void _003CAsyncPOST_003Eb__0(HttpWebResponse response)
        {
            LawData obj = null;

            try
            {
                string text = "";
                using (Stream stream = response.GetResponseStream())
                {
                    using (StreamReader streamReader = new StreamReader(stream, Encoding.UTF8))
                    {
                        text = streamReader.ReadToEnd();
                    }
                }
                if (!text.Equals(""))
                {
                    obj = XmlHelper.XmlDeserialize <LawData>(text, Encoding.UTF8);
                }
            }
            catch (Exception ex)
            {
                if (ErrorAction != null)
                {
                    ErrorAction();
                }
                LogTool.Debug(ex);
            }
            DoAction(obj);
        }
    public static MeetingData POST(string UserID, string PinCode)
    {
        MeetingData result = null;

        try
        {
            string url    = WsTool.GetUrl();
            string format = "<?xml version=\"1.0\"?><UserInfo><UserID><![CDATA[{0}]]></UserID><PinCode>{1}</PinCode></UserInfo>";
            format = string.Format(format, UserID, PinCode);
            Dictionary <string, string> dictionary = new Dictionary <string, string>();
            dictionary["XmlDoc"] = format;
            string text = HttpTool.CreateRequest(url + "/NewMeeting", "POST", dictionary);
            if (text.Equals(""))
            {
                return(result);
            }
            result = XmlHelper.XmlDeserialize <MeetingData>(text, Encoding.UTF8);
            return(result);
        }
        catch (Exception ex)
        {
            LogTool.Debug(ex);
            return(result);
        }
    }
        private void getPHEJSingleBitmapImageAsync(CACodecTools caTool, byte[] curKey, string pagePath, float scal, int curPageIndex, Border border, EventHandler <imageSourceRenderedResultEventArgs> ImageSourceRendered, bool isSinglePage)
        {
            BitmapImage bitmapImage = new BitmapImage();
            Bitmap      bitmap      = (curKey == null || curKey.Length <= 1) ? renPdfToBitmap(pagePath, curKey, 0, PDFdpi, scal, 0, border, isSinglePage) : renPdfToBitmap(caTool, pagePath, curKey, 0, PDFdpi, scal, 0, border, isSinglePage);

            using (MemoryStream memoryStream = new MemoryStream())
            {
                try
                {
                    bitmap.Save(memoryStream, ImageFormat.Bmp);
                    bitmapImage.BeginInit();
                    bitmapImage.StreamSource = memoryStream;
                    bitmapImage.CacheOption  = BitmapCacheOption.OnLoad;
                    bitmapImage.EndInit();
                    bitmapImage.CacheOption = BitmapCacheOption.None;
                    bitmapImage.StreamSource.Close();
                    bitmapImage.StreamSource = null;
                    bitmapImage.Freeze();
                    memoryStream.Dispose();
                    memoryStream.Close();
                    bitmap.Dispose();
                    bitmap = null;
                }
                catch (Exception ex)
                {
                    LogTool.Debug(ex);
                }
            }
            if (ImageSourceRendered != null)
            {
                ImageSourceRendered(this, new imageSourceRenderedResultEventArgs(bitmapImage, curPageIndex, scal));
            }
        }
Пример #30
0
        private void _003CPreLoadMeeting_003Eb__3(MeetingData md)
        {
            ThreadStart threadStart = null;

            try
            {
                PreLoadMeetingData = md;
                if (CacheMinuteTTL > 0)
                {
                    if (CacheThread != null)
                    {
                        CacheThread.Abort();
                    }
                    if (threadStart == null)
                    {
                        threadStart = new ThreadStart(_003CPreLoadMeeting_003Eb__4);
                    }
                    CacheThread = new Thread(threadStart);
                    CacheThread.IsBackground = false;
                    CacheThread.Start();
                }
            }
            catch (Exception ex)
            {
                LogTool.Debug(ex);
            }
        }