/// <summary> /// 切换到浮动模式 /// </summary> void HostView_SwitchToFloat() { if (hostContainer == null) { hostContainer = new ControlContainer() { TopMost = Env.ClientConfig.FrameContainerConfig.HostListContainerTopMost, StartPosition = FormStartPosition.Manual, ShowInTaskbar = true }; FrameContainerConfig cfg = Env.ClientConfig.FrameContainerConfig; //还原状态 if (cfg.HostListContainerSize.Width > 0) hostContainer.Size = cfg.HostListContainerSize; if (cfg.HostListContainerWindowState != -1) hostContainer.WindowState = (FormWindowState)cfg.HostListContainerWindowState; if (!cfg.HostListContainerLocation.IsEmpty) hostContainer.Location = cfg.HostListContainerLocation; //绑定属性,以便于记录状态 hostContainer.LocationChanged += (s, e) => { if (hostContainer.WindowState != FormWindowState.Minimized)cfg.HostListContainerLocation = hostContainer.Location; }; hostContainer.SizeChanged += (s, e) => { cfg.HostListContainerWindowState = (int)hostContainer.WindowState; if (hostContainer.WindowState != FormWindowState.Minimized) cfg.HostListContainerSize = hostContainer.Size; }; hostContainer.TopMostChanged += (s, e) => { Env.ClientConfig.FrameContainerConfig.HostListContainerTopMost = hostContainer.TopMost; }; hostContainer.FormClosing += (s, e) => { if (!isSystemOpClose) { if (Env.ClientConfig.FrameContainerConfig.MinimizeToTray) { e.Cancel = true; hostContainer.Visible = false; } else { ShutdownIPM(); } } else { hostContainer.ClearControl(); } }; } hostContainer.EmbedControl(hostView); hostContainer.Show(); this.mainContainer.Panel1Collapsed = true; Env.ClientConfig.FrameContainerConfig.HostListFloat = true; this.Visible = chat.SessionCount > 0; }
/// <summary> /// 切换到浮动模式 /// </summary> void HostView_SwitchToFloat() { if (hostContainer == null) { hostContainer = new ControlContainer() { TopMost = Env.ClientConfig.FrameContainerConfig.HostListContainerTopMost, StartPosition = FormStartPosition.Manual, ShowInTaskbar = true }; FrameContainerConfig cfg = Env.ClientConfig.FrameContainerConfig; //还原状态 if (cfg.HostListContainerSize.Width > 0) { hostContainer.Size = cfg.HostListContainerSize; } if (cfg.HostListContainerWindowState != -1) { hostContainer.WindowState = (FormWindowState)cfg.HostListContainerWindowState; } if (!cfg.HostListContainerLocation.IsEmpty) { hostContainer.Location = cfg.HostListContainerLocation; } //绑定属性,以便于记录状态 hostContainer.LocationChanged += (s, e) => { if (hostContainer.WindowState != FormWindowState.Minimized) { cfg.HostListContainerLocation = hostContainer.Location; } }; hostContainer.SizeChanged += (s, e) => { cfg.HostListContainerWindowState = (int)hostContainer.WindowState; if (hostContainer.WindowState != FormWindowState.Minimized) { cfg.HostListContainerSize = hostContainer.Size; } }; hostContainer.TopMostChanged += (s, e) => { Env.ClientConfig.FrameContainerConfig.HostListContainerTopMost = hostContainer.TopMost; }; hostContainer.FormClosing += (s, e) => { if (!isSystemOpClose) { if (Env.ClientConfig.FrameContainerConfig.MinimizeToTray) { e.Cancel = true; hostContainer.Visible = false; } else { ShutdownIPM(); } } else { hostContainer.ClearControl(); } }; } hostContainer.EmbedControl(hostView); hostContainer.Show(); this.mainContainer.Panel1Collapsed = true; Env.ClientConfig.FrameContainerConfig.HostListFloat = true; this.Visible = chat.SessionCount > 0; }