Exemplo n.º 1
0
        BusinessProcess.BusinessProcess LoadBusinessProcess()
        {
            ValueStack = new ValueStack.ValueStack(_exceptionHandler);
            ValueStack.Push("context", this);
            ValueStack.Push("isTablet", UIDevice.CurrentDevice.Model.Contains("iPad"));

            _configuration = ConfigurationFactory.CreateInstance().CreateConfiguration(ValueStack);

            return(BusinessProcessFactory.CreateInstance().CreateBusinessProcess(_configuration.BusinessProcess.File, ValueStack));
        }
Exemplo n.º 2
0
        private IContainer DoIterator(Iterator tag, IContainer parent, XmlNode node, ValueStack.ValueStack stack)
        {
            var collection = (IEnumerable)stack.Evaluate(tag.Value, null, false);

            var status = new IteratorStatus();

            if (!String.IsNullOrEmpty(tag.Status))
            {
                stack.Push(tag.Status, status); //push status variable
            }
            var list   = new ArrayList();
            var reader = collection as IDataReader;

            if (reader != null)
            {
                while (reader.Read())
                {
                    stack.Push(tag.Id, reader);
                    ProcessChildren(parent, node, stack);
                    status.Inc();
                }
            }
            else
            {
                foreach (var item in collection)
                {
                    list.Add(item);
                }

                foreach (var item in list)
                {
                    stack.Push(tag.Id, item);
                    ProcessChildren(parent, node, stack);
                    status.Inc();
                }
            }

            if (!String.IsNullOrEmpty(tag.Status))
            {
                stack.Values.Remove(tag.Status); //remove status variable
            }
            return(parent);
        }
Exemplo n.º 3
0
 private static string InitObjectId(XmlNode node, ValueStack.ValueStack stack, object obj)
 {
     foreach (XmlAttribute a in node.Attributes)
     {
         if (string.IsNullOrEmpty(a.Prefix) && a.Name.ToLower().Equals("id"))
         {
             string aValue = ApplicationContext.Context.DAL.TranslateString(a.Value);
             string id     = stack.Evaluate(aValue).ToString();
             stack.Push(id, obj);
             return(id);
         }
     }
     return(null);
 }
Exemplo n.º 4
0
        void StartApplication()
        {
            _commonData.UserId = DAL.UserId;

            ValueStack = new ValueStack.ValueStack(BitBrowserApp.Current.ExceptionHandler);
            ValueStack.Push("context", this);
            ValueStack.Push("isTablet", IsTablet());

            try
            {
                _configuration = ConfigurationFactory.CreateInstance().CreateConfiguration(ValueStack);
            }
            catch (ResourceNotFoundException e)
            {
                ReturnToStartMenu(e.FriendlyMessage, e.Report);
                return;
            }

            try
            {
                _businessProcess = BusinessProcessFactory.CreateInstance().CreateBusinessProcess(_configuration.BusinessProcess.File, ValueStack);
            }
            catch (ResourceNotFoundException e)
            {
                ReturnToStartMenu(e.FriendlyMessage, e.Report);
                return;
            }

            LoadingProgress = null;

            _loadComplete();
            _loadComplete = null;

            _settings.SetClearCacheDisabled();

            _businessProcess.Start(this);
        }
Exemplo n.º 5
0
        private IContainer DoPush(Push tag, IContainer parent, ValueStack.ValueStack stack, object newObject = null)
        {
            object expr = newObject;

            if (expr == null)
            {
                Type type = null;
                if (!String.IsNullOrEmpty(tag.Type))
                {
                    type = GetType().Assembly.GetType(tag.Type, false, true);
                }

                /*
                 * if (!String.IsNullOrEmpty(tag.Value))
                 *  if (!tag.Value.StartsWith("$")) //TODO
                 *      throw new ArgumentException(String.Format("Invalid Push expression '{0}'. Should start with '$'", tag.Value));
                 */
                expr = stack.Evaluate(tag.Value, type);
            }

            stack.Push(tag.Id, expr);
            return(parent);
        }
Exemplo n.º 6
0
        void StartApplication()
        {
            _commonData.UserId = DAL.UserId;

            ValueStack = new ValueStack.ValueStack(BitBrowserApp.Current.ExceptionHandler);
            ValueStack.Push("context", this);
            ValueStack.Push("isTablet", IsTablet());

            try
            {
                _configuration = ConfigurationFactory.CreateInstance().CreateConfiguration(ValueStack);
            }
            catch (ResourceNotFoundException e)
            {
                ReturnToStartMenu(e.FriendlyMessage, e.Report);
                return;
            }

            try
            {
                _businessProcess = BusinessProcessFactory.CreateInstance().CreateBusinessProcess(_configuration.BusinessProcess.File, ValueStack);
            }
            catch (ResourceNotFoundException e)
            {
                ReturnToStartMenu(e.FriendlyMessage, e.Report);
                return;
            }

            LoadingProgress = null;

            _loadComplete();
            _loadComplete = null;

            _settings.SetClearCacheDisabled();

            _businessProcess.Start(this);
        }
Exemplo n.º 7
0
        public bool OpenScreen(string screenName, String controllerName
            , Dictionary<string, object> parameters = null
            , bool isBackCommand = false
            , bool isRefresh = false)
        {
            try
            {
                ActionHandler.Busy = true;
                ActionHandlerEx.Busy = true;

                _baseActivity.ClearNavigationEvents();

                DateTime startLoading = DateTime.Now;

                ValueStack = new ValueStack.ValueStack(BitBrowserApp.Current.ExceptionHandler);
                ValueStack.Push("common", _commonData);
                ValueStack.Push("context", this);
                ValueStack.Push("dao", DAL.DAO);
                ValueStack.Push("activity", _baseActivity);

                foreach (var variable in GlobalVariables)
                    ValueStack.Push(variable.Key, variable.Value);

                if (parameters != null)
                    foreach (KeyValuePair<String, object> item in parameters)
                        ValueStack.Push(item.Key, item.Value);

                var controller = ControllerFactory.CreateInstance().CreateController<Controllers.ScreenController>(controllerName);
                ValueStack.Push("controller", controller);
                screenName = controller.GetView(screenName);

                var scr = (Screen)ScreenFactory.CreateInstance().CreateScreen<AndroidStyleSheet>(screenName, ValueStack, controller);
                var currentScreen = new ScreenData(screenName, controllerName, scr);

                FlipScreen(scr.View, isBackCommand, isRefresh);

                if (Settings.DevelopModeEnabled)
                {
                    string message = string.Format("{0}\n{1}"
                        , screenName
                        , (DateTime.Now - startLoading).ToString("ss\\.ff"));
                    Toast.MakeText(_baseActivity, message, ToastLength.Short).Show();
                }

                ThreadPool.QueueUserWorkItem(Finish, CurrentScreen);

                CurrentScreen = currentScreen;

                return true;
            }
            catch (Exception e)
            {
                HandleException(e);

                return false;
            }
        }
Exemplo n.º 8
0
        public bool OpenScreen(string screenName, String controllerName
                               , Dictionary <string, object> parameters = null
                               , bool isBackCommand = false
                               , bool isRefresh     = false)
        {
            try
            {
                ActionHandler.Busy   = true;
                ActionHandlerEx.Busy = true;

                _baseActivity.ClearNavigationEvents();

                DateTime startLoading = DateTime.Now;

                ValueStack = new ValueStack.ValueStack(BitBrowserApp.Current.ExceptionHandler);
                ValueStack.Push("common", _commonData);
                ValueStack.Push("context", this);
                ValueStack.Push("dao", DAL.DAO);
                ValueStack.Push("activity", _baseActivity);

                foreach (var variable in GlobalVariables)
                {
                    ValueStack.Push(variable.Key, variable.Value);
                }

                if (parameters != null)
                {
                    foreach (KeyValuePair <String, object> item in parameters)
                    {
                        ValueStack.Push(item.Key, item.Value);
                    }
                }

                var controller = ControllerFactory.CreateInstance().CreateController <Controllers.ScreenController>(controllerName);
                ValueStack.Push("controller", controller);
                screenName = controller.GetView(screenName);

                var scr           = (Screen)ScreenFactory.CreateInstance().CreateScreen <AndroidStyleSheet>(screenName, ValueStack, controller);
                var currentScreen = new ScreenData(screenName, controllerName, scr);

                FlipScreen(scr.View, isBackCommand, isRefresh);

                if (Settings.DevelopModeEnabled)
                {
                    string message = string.Format("{0}\n{1}"
                                                   , screenName
                                                   , (DateTime.Now - startLoading).ToString("ss\\.ff"));
                    Toast.MakeText(_baseActivity, message, ToastLength.Short).Show();
                }

                ThreadPool.QueueUserWorkItem(Finish, CurrentScreen);

                CurrentScreen = currentScreen;

                return(true);
            }
            catch (Exception e)
            {
                HandleException(e);

                return(false);
            }
        }
Exemplo n.º 9
0
        public bool OpenScreen(String screenName
                               , string controllerName, Dictionary <String
                                                                    , object> parameters = null
                               , bool isBackCommand = false
                               , bool isRefresh     = false)
        {
            try {
                Busy = true;

                _back    = null;
                _forward = null;

                ValueStack = new ValueStack.ValueStack(_exceptionHandler);
                ValueStack.Push("common", _commonData);
                ValueStack.Push("context", this);
                ValueStack.Push("dao", DAL.DAO);

                foreach (var variable in GlobalVariables)
                {
                    ValueStack.Push(variable.Key, variable.Value);
                }

                if (parameters != null)
                {
                    foreach (KeyValuePair <String, object> item in parameters)
                    {
                        ValueStack.Push(item.Key, item.Value);
                    }
                }

                Controllers.ScreenController newController =
                    ControllerFactory.CreateInstance().CreateController <Controllers.ScreenController> (controllerName);
                ValueStack.Push("controller", newController);
                screenName = newController.GetView(screenName);

                TabOrderManager.Create(this);

                Screen scr = (Screen)Factory.ScreenFactory.CreateInstance().CreateScreen <IOSStyleSheet> (screenName, ValueStack, newController);

                if (CurrentScreen != null)
                {
                    ((IDisposable)CurrentScreen.Screen).Dispose();
                }
                CurrentScreen = new ScreenData(screenName, controllerName, scr);

                ScreenController viewController = new ScreenController(scr.View);

                if (!isRefresh)
                {
                    _controller.SetViewControllers(new UIViewController[] {
                        _controller.TopViewController
                    }, false);

                    if (!isBackCommand)
                    {
                        _controller.PushViewController(viewController, true);
                    }
                    else
                    {
                        _controller.SetViewControllers(new UIViewController[] {
                            viewController,
                            _controller.TopViewController
                        }, false);
                        _controller.PopViewControllerAnimated(true);
                    }
                }
                else
                {
                    _controller.PopViewControllerAnimated(false);
                    _controller.PushViewController(viewController, false);
                }
            } catch (Exception ex) {
                HandleException(ex);
            } finally {
                ActionHandler.Busy   = false;
                ActionHandlerEx.Busy = false;
                Busy = false;
            }
            return(true);
        }
Exemplo n.º 10
0
		BusinessProcess.BusinessProcess LoadBusinessProcess ()
		{
			ValueStack = new ValueStack.ValueStack (_exceptionHandler);
			ValueStack.Push ("context", this);
			ValueStack.Push ("isTablet", UIDevice.CurrentDevice.Model.Contains ("iPad"));

			_configuration = ConfigurationFactory.CreateInstance ().CreateConfiguration (ValueStack);

			return BusinessProcessFactory.CreateInstance ().CreateBusinessProcess (_configuration.BusinessProcess.File, ValueStack);
		}
Exemplo n.º 11
0
		public bool OpenScreen (String screenName
			, string controllerName, Dictionary<String
			, object> parameters = null
			, bool isBackCommand = false
			, bool isRefresh = false)
		{
			try {

				Busy = true;

				_back = null;
				_forward = null;

				ValueStack = new ValueStack.ValueStack (_exceptionHandler);
				ValueStack.Push ("common", _commonData);
				ValueStack.Push ("context", this);
				ValueStack.Push ("dao", DAL.DAO);

				foreach (var variable in GlobalVariables)
					ValueStack.Push (variable.Key, variable.Value);

				if (parameters != null) {
					foreach (KeyValuePair<String, object> item in parameters) {
						ValueStack.Push (item.Key, item.Value);
					}
				}

				Controllers.ScreenController newController = 
					ControllerFactory.CreateInstance ().CreateController<Controllers.ScreenController> (controllerName);
				ValueStack.Push ("controller", newController);
				screenName = newController.GetView (screenName);

				TabOrderManager.Create (this);

				Screen scr = (Screen)Factory.ScreenFactory.CreateInstance ().CreateScreen<IOSStyleSheet> (screenName, ValueStack, newController);

				if (CurrentScreen != null)
					((IDisposable)CurrentScreen.Screen).Dispose ();
				CurrentScreen = new ScreenData (screenName, controllerName, scr);

				ScreenController viewController = new ScreenController (scr.View);

				if (!isRefresh) {
					_controller.SetViewControllers (new UIViewController[] {
						_controller.TopViewController
					}, false);

					if (!isBackCommand) {
						_controller.PushViewController (viewController, true);
					} else {
						_controller.SetViewControllers (new UIViewController[] {
							viewController,
							_controller.TopViewController
						}, false);
						_controller.PopViewControllerAnimated (true);
					}
				} else {
					_controller.PopViewControllerAnimated (false);
					_controller.PushViewController (viewController, false);
				}
			} catch (Exception ex) {
				HandleException (ex);
			} finally {
				ActionHandler.Busy = false;
				ActionHandlerEx.Busy = false;
				Busy = false;
			}
			return true;
		}