public void Init(WebBrowser browser) { initAppUrls(); RhoLogger.InitRhoLog(); LOG.INFO("Init"); CRhoFile.recursiveCreateDir(CFilePath.join(getBlobsDirPath(), " ")); m_webBrowser = browser; m_httpServer = new CHttpServer(CFilePath.join(getRhoRootPath(), "apps")); CRhoResourceMap.deployContent(); RhoRuby.Init(m_webBrowser); DBAdapter.initAttrManager(); LOG.INFO("Starting sync engine..."); SyncThread sync = null; try{ sync = SyncThread.Create(); }catch (Exception exc) { LOG.ERROR("Create sync failed.", exc); } if (sync != null) { //sync.setStatusListener(this); } RhoRuby.InitApp(); RhoRuby.call_config_conflicts(); RHOCONF().conflictsResolved(); }
public static object dosearch(RubyModule /*!*/ self, [NotNull] RubyArray /*!*/ arSourcesR, [NotNull] String /*!*/ from, [NotNull] String /*!*/ strParams, [NotNull] bool /*!*/ bSearchSyncChanges, [NotNull] int /*!*/ nProgressStep, String /*!*/ strCallback, String /*!*/ strCallbackParams) { object res = null; try { SyncThread.stopSync(); if (strCallback != null && strCallback.Length > 0) { SyncThread.getSyncEngine().getNotify().setSearchNotification(strCallback, strCallbackParams); } Vector <String> arSources = RhoRuby.makeVectorStringFromArray(arSourcesR); SyncThread.getInstance().addQueueCommand(new SyncThread.SyncSearchCommand(from, strParams, arSources, bSearchSyncChanges, nProgressStep)); res = SyncThread.getInstance().getRetValue(); } catch (Exception ex) { Exception rubyEx = self.Context.CurrentException; if (rubyEx == null) { rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message); } LOG.ERROR("dosearch", ex); throw rubyEx; } return(res); }
public void startApp() { LOG.INFO("startApp"); CRhoResourceMap.deployContent(); RhoRuby.Init(m_webBrowser); DBAdapter.initAttrManager(); LOG.INFO("Starting sync engine..."); SyncThread sync = null; try{ sync = SyncThread.Create(); }catch (Exception exc) { LOG.ERROR("Create sync failed.", exc); } if (sync != null) { //sync.setStatusListener(this); } RhoRuby.InitApp(); RhoRuby.call_config_conflicts(); RHOCONF().conflictsResolved(); }
public static int set_pollinterval(RubyModule /*!*/ self, [NotNull] int /*!*/ nInterval) { int nOldInterval = SyncThread.getInstance().getPollInterval(); SyncThread.getInstance().setPollInterval(nInterval); return(nOldInterval); }
public void ThreadSyncTest() { SyncThread syncTestThread = new SyncThread(); syncTestThread.Run(); Thread.Sleep(100000); }
public static void set_syncserver(RubyModule /*!*/ self, [NotNull] String /*!*/ syncserver) { try { SyncThread.stopSync(); SyncThread.getSyncEngine().setSyncServer(syncserver); if (syncserver != null && syncserver.length() > 0) { SyncThread.getInstance().start(SyncThread.epLow); if (ClientRegister.getInstance() != null) { ClientRegister.getInstance().startUp(); } } } catch (Exception ex) { Exception rubyEx = self.Context.CurrentException; if (rubyEx == null) { rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message); } LOG.ERROR("set_syncserver", ex); throw rubyEx; } }
public void TriggerCacheSync([FromBody] AgilityPublishRequest publishRequest) { ValidateRequest(publishRequest.WebsiteName, publishRequest.SecurityKey); WebTrace.WriteVerboseLine(string.Format("Cache sync triggered: Domain:{0}, Website:{1}, Key:{2}", publishRequest.WebsiteDomain, publishRequest.WebsiteName, publishRequest.SecurityKey)); SyncThread.QueueSyncThread(publishRequest, false); }
private void processToolBarCommand(object sender, EventArgs e, String strAction) { if (strAction == "back") { if (m_backHistory.Count > 0) { Uri destination = m_backHistory.Peek(); m_webBrowser.Navigate(destination); } return; } if (strAction == "forward" && m_forwardHistory.Count > 0) { Uri destination = m_forwardHistory.Peek(); m_webBrowser.Navigate(destination); return; } if (strAction == "home") { String strHomePage = RhoRuby.getStartPage(); strHomePage = canonicalizeRhoUrl(strHomePage); m_webBrowser.Navigate(new Uri(strHomePage)); return; } if (strAction == "log") { showLogScreen(); return; } if (strAction == "options") { String curUrl = RhoRuby.getOptionsPage(); curUrl = canonicalizeRhoUrl(curUrl); m_webBrowser.Navigate(new Uri(curUrl)); return; } if (strAction == "refresh" && m_currentUri != null) { m_webBrowser.Navigate(m_currentUri); return; } if (strAction == "sync") { SyncThread.doSyncAllSources(true); return; } strAction = canonicalizeRhoUrl(strAction); m_webBrowser.Navigate(new Uri(strAction)); }
public static bool is_syncing(RubyModule /*!*/ self) { try { return(SyncThread.getSyncEngine().isSyncing()); } catch (Exception ex) { LOG.HandleRubyException(ex, RhoRuby.rubyContext.CurrentException, "is_syncing"); return(false); } }
public void stopApp() { string[] ar1 = CRhoFile.enumDirectory("db"); RhoRuby.Stop(); SyncThread.getInstance().Destroy(); RhoLogger.close(); m_UIWaitEvent.Close(); string[] ar2 = CRhoFile.enumDirectory("db"); int i = 0; //net::CAsyncHttp::Destroy(); }
public static void set_syncserver(RubyModule /*!*/ self, [NotNull] String /*!*/ syncserver) { SyncThread.stopSync(); SyncThread.getSyncEngine().setSyncServer(syncserver); if (syncserver != null && syncserver.length() > 0) { SyncThread.getInstance().start(SyncThread.epLow); if (ClientRegister.getInstance() != null) { ClientRegister.getInstance().startUp(); } } }
public void stopApp() { //string[] ar1 = CRhoFile.enumDirectory("db"); RhoRuby.callUIDestroyed(); SyncThread.getInstance().Destroy(); CAsyncHttp.Destroy(); RhoRuby.Stop(); //string[] ar2 = CRhoFile.enumDirectory("db"); //int i = 0; //net::CAsyncHttp::Destroy(); }
public void BeginSync(SyncThread behavior) { if (OnSyncStart != null) OnSyncStart(this, EventArgs.Empty); if (behavior == SyncThread.BackgroundThread) { bgThreadState = BackgroundThreadState.Running; worker.RunWorkerAsync(); } else { List<ProductInfo> products = GetNewData(); MergeNewData(products); } }
public static object dosync(RubyModule /*!*/ self, params object[] args) { object res = null; try { boolean bShowStatus = true; String query_params = ""; if (args != null && args.Length > 0) { if (args[0] is int) { bShowStatus = ((int)args[0]).Equals(1); } else if (args[0] is bool) { bShowStatus = (bool)args[0]; } else { String str = ((MutableString)args[0]).ToString(); //bShowStatus = args[0].Equals(RubyConstant.QTRUE)||"true".equalsIgnoreCase(str); bShowStatus = "true".equalsIgnoreCase(str); } } if (args != null && args.Length > 1) { query_params = ((MutableString)args[1]).ToString(); } SyncThread.getInstance().addQueueCommand(new SyncThread.SyncCommand(SyncThread.scSyncAll, bShowStatus, query_params)); res = SyncThread.getInstance().getRetValue(); } catch (Exception ex) { Exception rubyEx = self.Context.CurrentException; if (rubyEx == null) { rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message); } LOG.ERROR("dosync", ex); throw rubyEx; } return(res); }
public static object dosearch(RubyModule /*!*/ self, [NotNull] RubyArray /*!*/ arSourcesR, [NotNull] String /*!*/ from, [NotNull] String /*!*/ strParams, [NotNull] bool /*!*/ bSearchSyncChanges, [NotNull] int /*!*/ nProgressStep, String /*!*/ strCallback, String /*!*/ strCallbackParams) { SyncThread.stopSync(); if (strCallback != null && strCallback.Length > 0) { SyncThread.getSyncEngine().getNotify().setSearchNotification(strCallback, strCallbackParams); } Vector <String> arSources = RhoRuby.makeVectorStringFromArray(arSourcesR); SyncThread.getInstance().addQueueCommand(new SyncThread.SyncSearchCommand(from, strParams, arSources, bSearchSyncChanges, nProgressStep)); return(SyncThread.getInstance().getRetValue()); }
public static void enable_status_popup(RubyModule /*!*/ self, bool /*!*/ bEnable) { try { SyncThread.getSyncEngine().getNotify().enableStatusPopup(bEnable); } catch (Exception ex) { Exception rubyEx = self.Context.CurrentException; if (rubyEx == null) { rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message); } LOG.ERROR("enable_status_popup", ex); throw rubyEx; } }
public static object login(RubyModule /*!*/ self, [NotNull] String /*!*/ name, [NotNull] String /*!*/ pwd, [NotNull] String /*!*/ callback) { try{ SyncThread.stopSync(); SyncThread.getInstance().addQueueCommand(new SyncThread.SyncLoginCommand(name, pwd, callback, new SyncNotify.SyncNotification(callback, "", false))); return(SyncThread.getInstance().getRetValue()); } catch (Exception e) { LOG.ERROR("SyncEngine.login", e); RhoRuby.raise_RhoError(RhoAppAdapter.ERR_RUNTIME); } return(null); }
public static void clean_objectnotify(RubyModule /*!*/ self) { try { SyncThread.getSyncEngine().getNotify().cleanObjectNotifications(); } catch (Exception ex) { Exception rubyEx = self.Context.CurrentException; if (rubyEx == null) { rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message); } LOG.ERROR("clean_objectnotify", ex); throw rubyEx; } }
public static void add_objectnotify(RubyModule /*!*/ self, [NotNull] int /*!*/ nSrcID, [NotNull] string /*!*/ strObject) { try { SyncThread.getSyncEngine().getNotify().addObjectNotify(nSrcID, strObject); } catch (Exception ex) { Exception rubyEx = self.Context.CurrentException; if (rubyEx == null) { rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message); } LOG.ERROR("add_objectnotify", ex); throw rubyEx; } }
public static void stop_sync(RubyModule /*!*/ self) { try { SyncThread.stopSync(); } catch (Exception ex) { Exception rubyEx = self.Context.CurrentException; if (rubyEx == null) { rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message); } LOG.ERROR("stop_sync", ex); throw rubyEx; } }
public static void set_threaded_mode(RubyModule /*!*/ self, [NotNull] bool /*!*/ bThreadMode) { try { SyncThread.getInstance().setNonThreadedMode(!bThreadMode); SyncThread.getSyncEngine().setNonThreadedMode(!bThreadMode); } catch (Exception ex) { Exception rubyEx = self.Context.CurrentException; if (rubyEx == null) { rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message); } LOG.ERROR("set_threaded_mode", ex); throw rubyEx; } }
public static void set_notification(RubyModule /*!*/ self, [NotNull] int /*!*/ nSrcID, [NotNull] String /*!*/ url, string /*!*/ callback_param) { try { SyncThread.getSyncEngine().getNotify().setSyncNotification(nSrcID, new SyncNotify.SyncNotification(url, callback_param != null ? callback_param : "", nSrcID != -1)); } catch (Exception ex) { Exception rubyEx = self.Context.CurrentException; if (rubyEx == null) { rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message); } LOG.ERROR("set_notification", ex); throw rubyEx; } }
protected override void OnStart(string[] args) { EventLogManager.WriteMessage(new Message() { Description = "Service Start", Type = "Service", Time = DateTime.Now }, EventType.Test); try { syncTestThread = new SyncThread(); syncTestThread.Run(); } catch (Exception e) { EventLogManager.WriteMessage(new Message() { Description = "On Start Method: " + e.Message.ToString(), Type = "Service", Time = DateTime.Now }, EventType.Test); } }
public static object dosync_source(RubyModule /*!*/ self, [NotNull] object /*!*/ srcID, bool /*!*/ show_status_popup) { int nSrcID = 0; String strName = ""; if (srcID is long) { nSrcID = (int)(long)srcID; } else if (srcID is int) { nSrcID = (int)srcID; } else { strName = srcID.ToString(); } SyncThread.getInstance().addQueueCommand(new SyncThread.SyncCommand(SyncThread.scSyncOne, strName, nSrcID, show_status_popup)); return(SyncThread.getInstance().getRetValue()); }
public static int logged_in(RubyModule /*!*/ self) { int res = 0; try { res = SyncThread.getSyncEngine().isLoggedIn() ? 1 : 0; } catch (Exception ex) { Exception rubyEx = self.Context.CurrentException; if (rubyEx == null) { rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message); } LOG.ERROR("logged_in", ex); throw rubyEx; } return(res); }
public static int set_pollinterval(RubyModule /*!*/ self, [NotNull] int /*!*/ nInterval) { int nOldInterval = 0; try { nOldInterval = SyncThread.getInstance().getPollInterval(); SyncThread.getInstance().setPollInterval(nInterval); } catch (Exception ex) { Exception rubyEx = self.Context.CurrentException; if (rubyEx == null) { rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message); } LOG.ERROR("set_pollinterval", ex); throw rubyEx; } return(nOldInterval); }
public static object dosync_source(RubyModule /*!*/ self, [NotNull] object /*!*/ srcID) { object res = null; try { int nSrcID = 0; String strName = ""; if (srcID is long) { nSrcID = (int)(long)srcID; } else if (srcID is int) { nSrcID = (int)srcID; } else { strName = srcID.ToString(); } SyncThread.getInstance().addQueueCommand(new SyncThread.SyncCommand(SyncThread.scSyncOne, strName, nSrcID, true)); res = SyncThread.getInstance().getRetValue(); } catch (Exception ex) { Exception rubyEx = self.Context.CurrentException; if (rubyEx == null) { rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message); } LOG.ERROR("dosync_source", ex); throw rubyEx; } return(res); }
public static object dosync(RubyModule /*!*/ self, bool /*!*/ show_status_popup) { object res = null; try { SyncThread.getInstance().addQueueCommand(new SyncThread.SyncCommand(SyncThread.scSyncAll, show_status_popup)); res = SyncThread.getInstance().getRetValue(); } catch (Exception ex) { Exception rubyEx = self.Context.CurrentException; if (rubyEx == null) { rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message); } LOG.ERROR("dosync", ex); throw rubyEx; } return(res); }
public static int logged_in(RubyModule /*!*/ self) { return(SyncThread.getSyncEngine().isLoggedIn() ? 1 : 0); }
public static object dosync(RubyModule /*!*/ self, bool /*!*/ show_status_popup) { SyncThread.getInstance().addQueueCommand(new SyncThread.SyncCommand(SyncThread.scSyncAll, show_status_popup)); return(SyncThread.getInstance().getRetValue()); }
public static object dosync(RubyModule /*!*/ self) { SyncThread.getInstance().addQueueCommand(new SyncThread.SyncCommand(SyncThread.scSyncAll, false)); return(SyncThread.getInstance().getRetValue()); }