コード例 #1
0
ファイル: DockManagerVm.cs プロジェクト: GFLEE/FunnyDation
 internal void ClosePanel(DockPanelVm panel)
 {
     if (panel == null || panel.CrlVm == null)
     {
         return;
     }
     panel.CrlVm.ActionClose = null;
     panel.Crl = null;
     Panels.Remove(panel);
 }
コード例 #2
0
ファイル: DockManagerVm.cs プロジェクト: GFLEE/FunnyDation
        private DockPanelVm CreatePanel(DockPanelParam dockPanelParam, string targetName, string templateName)
        {
            if (dockPanelParam.ProcessStyle.Equals(EuProcessStyle.New))
            {
                dockPanelParam.CrlVm.ViewIdentity.ReKey();
            }
            var key  = dockPanelParam.CrlVm.ViewIdentity.Key;
            var pane = Panels.FirstOrDefault(p => p.Key.Equals(key));

            if (pane != null)
            {
                if (dockPanelParam.ProcessStyle.Equals(EuProcessStyle.Open))
                {
                    return(pane);
                }
                if (dockPanelParam.ProcessStyle.Equals(EuProcessStyle.CloseAndNew))
                {
                    pane.Close();
                    if (pane.Crl != null)
                    {
                        return(pane);
                    }
                }
                else
                {
                    pane.IsClosed = false;
                    pane.IsActive = true;
                    pane.Caption  = dockPanelParam.Caption;
                    pane.ToolTip  = dockPanelParam.ToolTip;
                    if (dockPanelParam.ProcessStyle.Equals(EuProcessStyle.Active))
                    {
                        return(pane);
                    }
                    if (dockPanelParam.ProcessStyle.Equals(EuProcessStyle.UpdateVm))
                    {
                        pane.CrlVm.ActionClose = null;
                        pane.Crl = dockPanelParam.Crl;
                        return(pane);
                    }

                    if (dockPanelParam.ProcessStyle.Equals(EuProcessStyle.UpdateVmData))
                    {
                        pane.CrlVm.VmData       = dockPanelParam.CrlVm.VmData;
                        pane.CrlVm.SourceVm     = dockPanelParam.CrlVm.SourceVm;
                        pane.CrlVm.ViewIdentity = dockPanelParam.CrlVm.ViewIdentity;
                        return(pane);
                    }
                }
            }

            DockPanelVm dockPanelVm = null;

            dockPanelVm = new DockPanelVm(targetName)
            {
                Caption      = dockPanelParam.Caption,
                ToolTip      = dockPanelParam.ToolTip,
                DockManager  = this,
                TemplateName = templateName,
                Crl          = dockPanelParam.Crl,
                IsActive     = true
            };
            dockPanelVm.CrlVm.ActionClose = (crl) => GetPanel(crl.ViewIdentity.Key).Close();
            Panels.Add(dockPanelVm);

            return(dockPanelVm);
        }