Exemple #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);
        }
        void IViewExplorer.AddView(Viewing.View viewBase, Viewing.View parentView)
        {
            TreeNode parent   = null;
            TreeNode newChild = null;

            newChild      = new TreeNode();
            newChild.Text = viewBase.ViewName;
            newChild.Tag  = viewBase;

            _tvw_imglist.Images.Add(viewBase.Icon);
            newChild.ImageIndex         = _tvw_imglist.Images.Count - 1;
            newChild.SelectedImageIndex = _tvw_imglist.Images.Count - 1;

            if (parentView != null)
            {
                foreach (TreeNode childNode in _tvw.Nodes)
                {
                    if (childNode.Tag == parentView)
                    {
                        parent = childNode;
                    }
                }
            }
            else
            {
                parent = _root;
            }


            parent.Nodes.Add(newChild);
        }
Exemple #3
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);
        }
        void IViewExplorer.AddView(Viewing.View viewBase, Viewing.View parentView)
        {
            AfniLink viewLink = new AfniLink();

            viewLink.Tag    = viewBase;
            viewLink.Icon   = viewBase.Icon;
            viewLink.Text   = viewBase.ViewName;
            viewLink.Click += new EventHandler(this.viewLink_Clicked);
            _viewsBox.Tasks.Add(viewLink);
        }
        /// <summary>
        /// Event handler for a "view" link being clicked on.
        /// In this case, we just rip out the View object from
        /// the tag property of the Afni Link and load it.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void viewLink_Clicked(object sender, EventArgs e)
        {
            AfniLink viewLink = (AfniLink)sender;

            Viewing.View view = (Viewing.View)viewLink.Tag;
            _tasksBox.Tasks.Clear();
            foreach (AfniLink task in view.Tasks)
            {
                _tasksBox.Tasks.Add(task);
            }
            _app.LoadView(view);
        }
Exemple #6
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);
        }
Exemple #7
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);
        }