Exemplo n.º 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;
     }
 }
Exemplo n.º 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;
     }
 }
Exemplo n.º 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;
     }
 }
Exemplo n.º 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;
     }
 }
Exemplo n.º 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;
     }
 }
Exemplo n.º 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;
     }
 }
Exemplo n.º 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;
     }
 }
Exemplo n.º 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;
     }
 }
Exemplo n.º 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;
     }
 }
Exemplo n.º 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;
     }
 }
Exemplo n.º 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;
     }
 }
Exemplo n.º 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;
     }
 }
Exemplo n.º 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;
     }
 }
Exemplo n.º 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;
     }
 }
Exemplo n.º 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;
     }
 }
Exemplo n.º 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;
     }
 }
Exemplo n.º 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);
        }
Exemplo n.º 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;
            }
        }
Exemplo n.º 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;
     }
 }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
            }
Exemplo n.º 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;
     }
 }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
            }
Exemplo n.º 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);
        }