Example #1
0
        /// <summary>
        /// Loads the view contained in the viewitem and
        /// brings up the record associated with it.
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        public bool LoadViewItem(ViewItem item)
        {
            bool load_ok = true;

            try
            {
                if (_view != null && _view != item.View && item.View != null)
                {
                    /* need to swap views.  Push current view
                     * onto the back stack, and clear the
                     * forward stack.*/
                    _view.Hide();
                    _back_viewstack.Push(_view);
                    _forward_viewstack.Clear();
                    _parent_form.BackButton.Enabled    = true;
                    _parent_form.ForwardButton.Enabled = false;
                }

                if (item.View != null)
                {
                    _view       = item.View;
                    _activeform = _view.ViewedForm;
                    _view.Show(item);
                }
            }
            catch (System.Exception ex)
            {
                _last_error = ex;
                _errors.Add(ex);
                load_ok = false;
            }

            return(load_ok);
        }
Example #2
0
        /// <summary>
        /// Moves to the previous view
        /// on the back viewstack.
        /// </summary>
        /// <returns></returns>
        public bool MovePrevView()
        {
            bool prev_ok = true;

            try
            {
                if (_back_viewstack.Peek() != null)
                {
                    /* hide current view and push it onto the
                     * forward view stack */
                    _view.Hide();

                    if (_view.AllowsForwardNavigation)
                    {
                        _forward_viewstack.Push(_view);
                        _parent_form.ForwardButton.Enabled = true;
                    }
                    else
                    {
                        _parent_form.ForwardButton.Enabled = false;
                    }

                    /*pop previous view off the back stack and
                     * show it */
                    _view = (Viewing.View)_back_viewstack.Pop();
                    _view.Show();

                    /*may need to switch app states... */
                    //if(_app_state == ApplicationState.Disposition)
                    //	SwitchAppState(ApplicationStates.CallActive);


                    /*finally, update the navigation buttons */
                    if (_back_viewstack.Count == 0)
                    {
                        _parent_form.BackButton.Enabled = false;
                    }
                    else
                    {
                        _parent_form.BackButton.Enabled = true;
                    }
                    _activeform = _view.ViewedForm;
                }
                else
                {
                    prev_ok = false;
                }
            }

            catch (System.Exception ex)
            {
                _last_error = ex;
                _errors.Add(ex);
                prev_ok = false;
            }

            return(prev_ok);
        }
Example #3
0
        /// <summary>
        /// Loads the view with the default item
        /// onto the screen.
        /// </summary>
        /// <param name="view"></param>
        /// <returns></returns>
        public bool LoadView(Viewing.View view)
        {
            if ((_view != null) && (_view != view))
            {
                _view.Hide();
                _back_viewstack.Push(_view);
                _parent_form.BackButton.Enabled    = true;
                _parent_form.ForwardButton.Enabled = false;
            }

            _view       = view;
            _activeform = _view.ViewedForm;
            _view.Show();
            return(true);
        }
Example #4
0
        /// <summary>
        /// Moves to the next view on the
        /// forward stack.
        /// </summary>
        /// <returns></returns>
        public bool MoveNextView()
        {
            bool next_ok = true;

            try
            {
                if (_forward_viewstack.Peek() != null)
                {
                    /* hide current view and push it onto the back stack */
                    _view.Hide();
                    _back_viewstack.Push(_view);

                    /* pop the next view off the forward stack and load it */
                    _view = (Viewing.View)_forward_viewstack.Pop();
                    _view.Show();

                    /* if there's nothing left in the forward stack,
                     * disable the "next" button.*/
                    if (_forward_viewstack.Count == 0)
                    {
                        _parent_form.ForwardButton.Enabled = false;
                    }
                    else
                    {
                        _parent_form.ForwardButton.Enabled = true;
                    }
                    _parent_form.BackButton.Enabled = true;
                    _activeform = _view.ViewedForm;
                }
                else
                {
                    next_ok = false;
                }
            }
            catch (System.Exception ex)
            {
                _last_error = ex;
                _errors.Add(ex);
                next_ok = false;
            }

            return(next_ok);
        }