Пример #1
0
 public static void execute_js(RubyModule /*!*/ self, [NotNull] String /*!*/ strScript)
 {
     try
     {
         RHODESAPP().processInvokeScript(strScript);
     }
     catch (Exception ex)
     {
         Exception rubyEx = self.Context.CurrentException;
         if (rubyEx == null)
         {
             rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
         }
         LOG.ERROR("execute_js", ex);
         throw rubyEx;
     }
 }
Пример #2
0
 public static void Navigate(RubyModule /*!*/ self, [NotNull] String /*!*/ url)
 {
     try
     {
         RHODESAPP().processWebNavigate(url);
     }
     catch (Exception ex)
     {
         Exception rubyEx = self.Context.CurrentException;
         if (rubyEx == null)
         {
             rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
         }
         LOG.ERROR("navigate", ex);
         throw rubyEx;
     }
 }
Пример #3
0
 public static void Remove(RubyModule /*!*/ self)
 {
     try
     {
         RhodesApp.removeToolBar();
     }
     catch (Exception ex)
     {
         Exception rubyEx = self.Context.CurrentException;
         if (rubyEx == null)
         {
             rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
         }
         LOG.ERROR("remove", ex);
         throw rubyEx;
     }
 }
Пример #4
0
 public static int nativeTabBarGetCurrentTab(RubyModule /*!*/ self)
 {
     try
     {
         return(RhodesApp.getCurrentTab());
     }
     catch (Exception ex)
     {
         Exception rubyEx = self.Context.CurrentException;
         if (rubyEx == null)
         {
             rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
         }
         LOG.ERROR("native_tabbar_get_current_tab", ex);
         throw rubyEx;
     }
 }
Пример #5
0
 public static void setMenuItems(RubyModule /*!*/ self, Hash valMenu)
 {
     try
     {
         RHODESAPP().setMenuItems(valMenu);
     }
     catch (Exception ex)
     {
         Exception rubyEx = self.Context.CurrentException;
         if (rubyEx == null)
         {
             rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
         }
         LOG.ERROR("set_menu_items", ex);
         throw rubyEx;
     }
 }
Пример #6
0
 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;
     }
 }
Пример #7
0
 public static void createNativeToolBar(RubyModule /*!*/ self, int barType, Object args)
 {
     try
     {
         Create(self, barType, args);
     }
     catch (Exception ex)
     {
         Exception rubyEx = self.Context.CurrentException;
         if (rubyEx == null)
         {
             rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
         }
         LOG.ERROR("create_native_toolbar", ex);
         throw rubyEx;
     }
 }
Пример #8
0
 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;
     }
 }
Пример #9
0
 public static void nativeTabBarSetTabBadge(RubyModule /*!*/ self, int index, MutableString /*!*/ val)
 {
     try
     {
         RhodesApp.setTabBadge(index, val);
     }
     catch (Exception ex)
     {
         Exception rubyEx = self.Context.CurrentException;
         if (rubyEx == null)
         {
             rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
         }
         LOG.ERROR("native_tabbar_set_tab_badge", ex);
         throw rubyEx;
     }
 }
Пример #10
0
 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;
     }
 }
Пример #11
0
 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;
     }
 }
Пример #12
0
 public static void set_objectnotify_url(RubyModule /*!*/ self, [DefaultProtocol, NotNull] string /*!*/ url)
 {
     try
     {
         SyncNotify.setObjectNotifyUrl(url);
     }
     catch (Exception ex)
     {
         Exception rubyEx = self.Context.CurrentException;
         if (rubyEx == null)
         {
             rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
         }
         LOG.ERROR("set_objectnotify_url", ex);
         throw rubyEx;
     }
 }
Пример #13
0
 public static void set_source_property(RubyModule /*!*/ self, [NotNull] int /*!*/ nSrcID, [NotNull] String /*!*/ strPropName, [NotNull] String /*!*/ strPropValue)
 {
     try
     {
         SyncEngine.getSourceOptions().setProperty(nSrcID, strPropName, strPropValue);
     }
     catch (Exception ex)
     {
         Exception rubyEx = self.Context.CurrentException;
         if (rubyEx == null)
         {
             rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
         }
         LOG.ERROR("set_source_property", ex);
         throw rubyEx;
     }
 }
Пример #14
0
 public static void update_blob_attribs(RubyModule /*!*/ self, [NotNull] String /*!*/ strPartition, [NotNull] int /*!*/ srcID)
 {
     try
     {
         DBAdapter db = DBAdapter.getDB(strPartition);
         db.getAttrMgr().loadBlobAttrs(db);
     }
     catch (Exception ex)
     {
         Exception rubyEx = self.Context.CurrentException;
         if (rubyEx == null)
         {
             rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
         }
         LOG.ERROR("update_blob_attribs", ex);
         throw rubyEx;
     }
 }
Пример #15
0
 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;
     }
 }
Пример #16
0
 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;
     }
 }
Пример #17
0
        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
                    {
                        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);
        }
Пример #18
0
        public static void set_property_by_name(RubyModule /*!*/ self, [NotNull] String /*!*/ name, Object value)
        {
            try
            {
                RhoConf.getInstance().setString(name, value as String, true);

                RhoLogger.getLogConf().loadFromConf(RhoConf.getInstance());
            }
            catch (Exception ex)
            {
                Exception rubyEx = self.Context.CurrentException;
                if (rubyEx == null)
                {
                    rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
                }
                LOG.ERROR("set_property_by_name", ex);
                throw rubyEx;
            }
        }
Пример #19
0
 public static void Cancel(RubyModule /*!*/ self)
 {
     try
     {
         if (CAsyncHttp.getInstance() != null)
         {
             CAsyncHttp.getInstance().cancelRequest("*");
         }
     }
     catch (Exception ex)
     {
         Exception rubyEx = self.Context.CurrentException;
         if (rubyEx == null)
         {
             rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
         }
         LOG.ERROR("cancel", ex);
         throw rubyEx;
     }
 }
Пример #20
0
        public static MutableString /*!*/ Inspect(RubyContext /*!*/ context, Exception /*!*/ self)
        {
            object message   = RubyExceptionData.GetInstance(self).Message;
            string className = RubyUtils.GetClassName(context, self);

            MutableString result = MutableString.CreateMutable();

            result.Append("#<");
            result.Append(className);
            result.Append(": ");
            if (message != null)
            {
                result.Append(KernelOps.Inspect(context, message));
            }
            else
            {
                result.Append(className);
            }
            result.Append('>');
            return(result);
        }
Пример #21
0
        public static MutableString /*!*/ Inspect(UnaryOpStorage /*!*/ inspectStorage, ConversionStorage <MutableString> /*!*/ tosConversion, Exception /*!*/ self)
        {
            object message   = RubyExceptionData.GetInstance(self).Message;
            string className = inspectStorage.Context.GetClassDisplayName(self);

            MutableString result = MutableString.CreateMutable(inspectStorage.Context.GetIdentifierEncoding());

            result.Append("#<");
            result.Append(className);
            result.Append(": ");
            if (message != null)
            {
                result.Append(KernelOps.Inspect(inspectStorage, tosConversion, message));
            }
            else
            {
                result.Append(className);
            }
            result.Append('>');
            return(result);
        }
Пример #22
0
            public static object parse(RubyModule /*!*/ self, [NotNull] string /*!*/ strData)
            {
                object res = null;

                try
                {
                    res = fastJSON.RJSONTokener.JsonDecode(strData);
                }
                catch (Exception ex)
                {
                    Exception rubyEx = self.Context.CurrentException;
                    if (rubyEx == null)
                    {
                        rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
                    }
                    LOG.ERROR("parse", ex);
                    throw rubyEx;
                }

                return(res);
            }
Пример #23
0
 public static void choosePicture(RubyModule /*!*/ self, [NotNull] String /*!*/ callback)
 {
     try
     {
         m_callback = callback;
         PhotoChooserTask photoChooserTask;
         photoChooserTask            = new PhotoChooserTask();
         photoChooserTask.Completed += new EventHandler <PhotoResult>(cameraTask_Completed);
         photoChooserTask.Show();
     }
     catch (Exception ex)
     {
         Exception rubyEx = self.Context.CurrentException;
         if (rubyEx == null)
         {
             rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
         }
         LOG.ERROR("take_picture", ex);
         throw rubyEx;
     }
 }
Пример #24
0
        public static String currentLocation(RubyModule /*!*/ self)
        {
            String res = "";

            try
            {
                res = RHODESAPP().getCurrentUrl(0);
            }
            catch (Exception ex)
            {
                Exception rubyEx = self.Context.CurrentException;
                if (rubyEx == null)
                {
                    rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
                }
                LOG.ERROR("current_location", ex);
                throw rubyEx;
            }

            return(res);
        }
Пример #25
0
        public static Boolean isStarted(RubyModule /*!*/ self)
        {
            Boolean res = false;

            try
            {
                res = RhodesApp.barIsStarted;
            }
            catch (Exception ex)
            {
                Exception rubyEx = self.Context.CurrentException;
                if (rubyEx == null)
                {
                    rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
                }
                LOG.ERROR("started", ex);
                throw rubyEx;
            }

            return(res);
        }
Пример #26
0
        public static bool is_blob_attr(RubyModule /*!*/ self, [NotNull] String /*!*/ strPartition, [NotNull] int /*!*/ nSrcID, [NotNull] String /*!*/ strAttrName)
        {
            bool res = false;

            try
            {
                res = DBAdapter.getDB(strPartition).getAttrMgr().isBlobAttr(nSrcID, strAttrName);
            }
            catch (Exception ex)
            {
                Exception rubyEx = self.Context.CurrentException;
                if (rubyEx == null)
                {
                    rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
                }
                LOG.ERROR("is_blob_attr", ex);
                throw rubyEx;
            }

            return(res);
        }
Пример #27
0
        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);
        }
Пример #28
0
        public static Thread /*!*/ CreateThread(RubyContext /*!*/ context, BlockParam startRoutine, object self, [NotNull] params object[] /*!*/ args)
        {
            if (startRoutine == null)
            {
                throw new ThreadError("must be called with a block");
            }
            ThreadGroup group  = Group(Thread.CurrentThread);
            Thread      result = new Thread(new ThreadStart(delegate() {
                RubyThreadInfo info = RubyThreadInfo.FromThread(Thread.CurrentThread);
                info.Group          = group;

                try {
                    object threadResult;
                    // TODO: break?
                    startRoutine.Yield(args, out threadResult);
                    info.Result = threadResult;
#if !SILVERLIGHT
                } catch (ThreadInterruptedException) {
                    // Do nothing with this for now
#endif
                } catch (Exception e) {
                    info.Exception = e;

                    Utils.Log(
                        e.Message + "\r\n\r\n" +
                        e.StackTrace + "\r\n\r\n" +
                        IListOps.Join(context, RubyExceptionData.GetInstance(e).Backtrace).ToString(),
                        "THREAD"
                        );

                    if (_globalAbortOnException || info.AbortOnException)
                    {
                        throw;
                    }
                }
            }));

            result.Start();
            return(result);
        }
Пример #29
0
            public static object quote_value(RubyModule /*!*/ self, [NotNull] string /*!*/ strData)
            {
                object res = null;

                try
                {
                    String strRes = rho.json.JSONEntry.quoteValue(strData);
                    res = CRhoRuby.Instance.createString(strRes);
                }
                catch (Exception ex)
                {
                    Exception rubyEx = self.Context.CurrentException;
                    if (rubyEx == null)
                    {
                        rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
                    }
                    LOG.ERROR("quote_value", ex);
                    throw rubyEx;
                }

                return(res);
            }
Пример #30
0
        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);
        }