public SessionClient(IPAddress address, int Port, int type, int mode) { this.address = address; this.port = Port; this.type = type; this.mode = mode; switch (type) { case KEYBOARD: case MOUSE: Task.Factory.StartNew(new Action(() => { MouseTracker mt = new MouseTracker(this); mt.Show(); }), CancellationToken.None, TaskCreationOptions.None, TaskScheduler.FromCurrentSynchronizationContext()); break; case FILEVIEW: Task.Factory.StartNew(new Action(() => { FileViewer fv = new FileViewer(this); fv.Show(); }), CancellationToken.None, TaskCreationOptions.None, TaskScheduler.FromCurrentSynchronizationContext()); break; case SMSVIEW: break; default: throw new Exception("Неизвестный тип сессии"); } }