public void ClearWall(int dbUserId) { // close all lauched applications var launchedApp = LaunchedWndHelper.GetInstance().GetLaunchedApps(dbUserId); foreach (int wndIdentifier in launchedApp.Keys) { if (Properties.Settings.Default.Debug) { MessageBox.Show("before clear window identifier: " + wndIdentifier); } Utils.Windows.NativeMethods.PostMessage(new IntPtr(wndIdentifier), Utils.Windows.Constant.WM_CLOSE, IntPtr.Zero, IntPtr.Zero); } // reset the launched list LaunchedWndHelper.GetInstance().ClearAll(dbUserId); var launchedVnc = LaunchedVncHelper.GetInstance().GetLaunchedApps(dbUserId); foreach (int wndIdentifier in launchedVnc.Keys) { if (Properties.Settings.Default.Debug) { MessageBox.Show("before clear vnc identifier: " + wndIdentifier); } Utils.Windows.NativeMethods.PostMessage(new IntPtr(wndIdentifier), Utils.Windows.Constant.WM_CLOSE, IntPtr.Zero, IntPtr.Zero); } // reset the launched list LaunchedVncHelper.GetInstance().ClearAll(dbUserId); var launchedSources = LaunchedSourcesHelper.GetInstance().GetLaunchedApps(dbUserId); foreach (int wndIdentifier in launchedSources.Keys) { if (Properties.Settings.Default.Debug) { MessageBox.Show("before clear source identifier: " + wndIdentifier); } Utils.Windows.NativeMethods.PostMessage(new IntPtr(wndIdentifier), Utils.Windows.Constant.WM_CLOSE, IntPtr.Zero, IntPtr.Zero); } // reset the launched list LaunchedSourcesHelper.GetInstance().ClearAll(dbUserId); }
public void LaunchPresetExternal(int dbUserId, int presetDbId) { // get the rect from the preset table PresetData preset = Server.ServerDbHelper.GetInstance().GetPresetByUserId(dbUserId).First(PresetData => PresetData.Id == presetDbId); ClientAppCmdImpl clientImpl = new ClientAppCmdImpl(); foreach (ApplicationData appData in preset.AppDataList) { int result = clientImpl.LaunchApplication(appData); LaunchedWndHelper.GetInstance().AddLaunchedApp(dbUserId, result, appData.id); } // start vnc foreach (RemoteVncData remoteData in preset.VncDataList) { int result = vncClient.StartClient( remoteData.remoteIp, remoteData.remotePort, remoteData.rect.Left, remoteData.rect.Top, remoteData.rect.Right - remoteData.rect.Left, remoteData.rect.Bottom - remoteData.rect.Top); // add to the connected client info LaunchedVncHelper.GetInstance().AddLaunchedApp(dbUserId, result, remoteData.id); } // start source input foreach (VisionData inputData in preset.InputDataList) { int result = ServerVisionHelper.getInstance().LaunchVisionWindow( inputData.id, inputData.rect.Left, inputData.rect.Top, inputData.rect.Right - inputData.rect.Left, inputData.rect.Bottom - inputData.rect.Top); // add to the connected client info LaunchedSourcesHelper.GetInstance().AddLaunchedApp(dbUserId, result, inputData.id); } }