Exemplo n.º 1
0
        public void show_view(Type tp_view, mwa.cmds.cmd c = null)
        {
            try {
                if (def_view.find_def_view(tp_view) == null)
                {
                    throw new Exception($"vista '{tp_view.Name}' non definita!");
                }

                bool is_login = tp_view.Name == typeof(vw_login).Name;

                base_view vw = null;
                if (this.active_view == null || (this.active_view != null && this.active_view.GetType().Name != tp_view.Name))
                {
                    // show
                    int i = _stack_views.FindIndex(x => x.GetType().Name == tp_view.Name);
                    if (i >= 0)
                    {
                        vw = _stack_views[i];
                        _stack_views.RemoveAt(i);
                    }
                    else
                    {
                        vw                 = (base_view)Activator.CreateInstance(tp_view, new object[] { this });
                        vw.TopLevel        = false;
                        vw.FormBorderStyle = FormBorderStyle.None;
                    }

                    // stack
                    if (active_view != null)
                    {
                        if (!is_login && active_view.tp_view.tipo != def_view.type_view.login)
                        {
                            _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, c);
            } catch (Exception ex) { set_status_err(ex); }
        }
Exemplo n.º 2
0
        public void show_view(Type tp_view)
        {
            try {
                // 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();
                bread_crumb.clear_voices();

                // show
                int       i  = _stack_views.FindIndex(x => x.GetType().Name == tp_view.Name);
                base_view vw = null;
                if (i >= 0)
                {
                    vw = _stack_views[i];
                    _stack_views.RemoveAt(i);
                }
                else
                {
                    vw                 = (base_view)Activator.CreateInstance(tp_view, new object[] { this });
                    vw.TopLevel        = false;
                    vw.FormBorderStyle = FormBorderStyle.None;
                }

                // stack
                if (active_view != null)
                {
                    if (tp_view.Name != typeof(vw_login).Name && active_view.tp_view.tipo != def_view.type_view.login)
                    {
                        _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();
                vw.load_view_data();
                Application.DoEvents();
                vw.ActiveControl = vw.first_edit_control();
            } catch (Exception ex) { set_status_err(ex); }
        }
Exemplo n.º 3
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); }
        }
Exemplo n.º 4
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); }
        }
Exemplo n.º 5
0
 public void showed_view(base_view v)
 {
     try {
     } catch { }
 }