public ClientThread() { ConfigManager = new Config.Manager(); ClientListener = new ClientListener(); Manager = new ClientManager(ClientListener, "teamscreen"); ClientListener.SetManager(Manager); }
public MainWindow() : base(Gtk.WindowType.Toplevel) { Build(); connectionStatus = new System.Timers.Timer(1000); connectionStatus.Elapsed += Connection_Elapsed; ConfigManager = new Common.Config.Manager(); Manager.HostListener.OnConnected += new EventHandler <ConnectedEventArgs>(Network_OnConnected); Manager.HostListener.OnClientInitalizeConnected += (object sender, Common.EventArgs.Network.Host.ClientInitalizeConnectedEventArgs e) => { this.lblStatus.Text = "Initaliziere Verbindung"; }; Manager.HostListener.OnClientConnected += (object sender, ClientConnectedEventArgs e) => { if (e.PasswordOk) { this.lblStatus.Text = "Passwort Ok Verbunden mit: " + e.SystemId; } else { this.lblStatus.Text = "Passwort Falsch Verbindung abgebrochen von: " + e.SystemId; } }; Manager.HostListener.OnMouseMove += (object sender, MouseMoveEventArgs e) => { Mouse.Move((int)e.X, (int)e.Y); }; Manager.HostListener.OnKey += (object sender, Common.EventArgs.Network.KeyEventArgs e) => { if (e.Mode == Network.Messages.Connection.OneWay.KeyMessage.KeyMode.Down) { Keyboard.Down(e.Key); } else { Keyboard.Up(e.Key); } }; Manager.HostListener.OnMouseClick += (object sender, MouseClickEventArgs e) => { if (e.DoubleClick) { switch (e.Button) { case MouseClickEventArgs.ButtonType.Left: Mouse.DoubleClickLeft((int)e.X, (int)e.Y); break; case MouseClickEventArgs.ButtonType.Middle: Mouse.DoubleClickMiddle((int)e.X, (int)e.Y); break; case MouseClickEventArgs.ButtonType.Right: Mouse.DoubleClickRight((int)e.X, (int)e.Y); break; } return; } if (e.Down) { switch (e.Button) { case MouseClickEventArgs.ButtonType.Left: Mouse.ClickDownLeft((int)e.X, (int)e.Y); break; case MouseClickEventArgs.ButtonType.Middle: Mouse.ClickDownMiddle((int)e.X, (int)e.Y); break; case MouseClickEventArgs.ButtonType.Right: Mouse.ClickDownRight((int)e.X, (int)e.Y); break; } return; } if (e.Up) { switch (e.Button) { case MouseClickEventArgs.ButtonType.Left: Mouse.ClickUpLeft((int)e.X, (int)e.Y); break; case MouseClickEventArgs.ButtonType.Middle: Mouse.ClickUpMiddle((int)e.X, (int)e.Y); break; case MouseClickEventArgs.ButtonType.Right: Mouse.ClickUpRight((int)e.X, (int)e.Y); break; } return; } switch (e.Button) { case MouseClickEventArgs.ButtonType.Left: Mouse.ClickLeft((int)e.X, (int)e.Y); break; case MouseClickEventArgs.ButtonType.Middle: Mouse.ClickMiddle((int)e.X, (int)e.Y); break; case MouseClickEventArgs.ButtonType.Right: Mouse.ClickRight((int)e.X, (int)e.Y); break; } }; Manager.HostListener.OnFileTransferCopy += HostListener_OnFileTransferCopy; Manager.HostListener.OnScreenshotRequest += HostListener_OnScreenshotRequest; Manager.HostListener.OnClientClose += HostListener_OnClientClose; Display.SetManager(Manager.Manager); Manager.HostListener.onPeerConnected += HostListener_onPeerConnected; Manager.HostListener.onPeerDisconnected += HostListener_onPeerDisconnected; Manager.HostListener.onNetworkError += HostListener_onNetworkError; Manager.HostListener.OnFileTransferListing += HostListener_OnFileTransferListing; Manager.Start(); }