Beispiel #1
0
        public void show_view(base_view vw, bool from_back = false)
        {
            try {
                if (def_view.find_def_view(vw.GetType()) == null)
                {
                    throw new Exception($"vista '{vw.GetType().Name}' non definita!");
                }

                bool is_login = vw.GetType().Name == typeof(vw_login).Name;

                if (this.active_view == null || (this.active_view != null && this.active_view.GetType().Name != vw.GetType().Name))
                {
                    vw.TopLevel        = false;
                    vw.FormBorderStyle = FormBorderStyle.None;

                    // stack
                    int i = _stack_views.FindIndex(x => x.GetType().Name == vw.GetType().Name);
                    if (i >= 0)
                    {
                        _stack_views.RemoveAt(i);
                    }

                    if (active_view != null)
                    {
                        if (!is_login && active_view.tp_view.tipo != def_view.type_view.login)
                        {
                            if (!from_back)
                            {
                                _stack_views.Insert(0, active_view);
                            }
                            active_view.Hide();
                        }
                        else
                        {
                            active_view.Close();
                        }
                        pnl_main.Controls.Remove(active_view);
                    }

                    pnl_main.Controls.Add(vw);
                    vw.Dock = DockStyle.Fill;
                    vw.Show();
                }
                else
                {
                    vw = this.active_view;
                }

                show_view2(vw, from_back: true);
            } catch (Exception ex) { set_status_err(ex); }
        }
Beispiel #2
0
        protected void show_view2(base_view vw, mwa.cmds.cmd c = null, bool from_back = false)
        {
            try {
                bool is_login = vw.GetType().Name == typeof(vw_login).Name;

                // pulisco
                //if(pnl_main.Controls.Count > 0) {
                //  base_view v = pnl_main.Controls[0] as base_view;
                //  if(v == null) throw new Exception("situazione anomala, vista errata!");
                //  v.Close();
                //  v.Dispose();
                //}

                this.foot.clear();
                this.set_title();

                this.active_path = null;

                vw.from_back = from_back;
                after_show a = vw.load_view(c);
                if (!is_login)
                {
                    set_title(!string.IsNullOrEmpty(vw.title_view) ? vw.title_view : vw.tp_view.title_view);
                }

                cmb_cmds.showed_view(vw);
                if (!a.focus_on_view)
                {
                    focus_cmd_line();
                }

                if (vw.tp_view.image_32 != null)
                {
                    set_image(vw.tp_view.image_32);
                }
                else
                {
                    set_default_image();
                }
            } catch (Exception ex) { set_status_err(ex); }
        }