private void ConnectMeItemMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { if (!connectWindow.IsVisible) { connectWindow = new ConnectWindow(); connectWindow.ReConnectEvent += reConnectEvent; connectWindow.Show(); } }
private void init() { //数据配置 pointMetaData = new List <PointMetadata>(); //Meu窗口配置 searchWin = new SearchWindow() { SignalDisplayList = signalList, ClientAsync = clientAsync }; connectWindow = new ConnectWindow(); SignalMeItem.AddHandler(MouseLeftButtonDownEvent, new MouseButtonEventHandler(signalMeItemMouseLeftButtonDown), true); ConnectMeItem.AddHandler(MouseLeftButtonDownEvent, new MouseButtonEventHandler(ConnectMeItemMouseLeftButtonDown), true); ///连接到服务端配置 EthernetSetUp setUp = new EthernetSetUp("127.0.0.1", 9527); ILog log = new DefaultLog("SignalMonitor"); TimeOut timeOut = new TimeOut("SignalMonitor", 1000, log); clientAsync = new FreedomClientAsync(setUp, timeOut, log); //读服务器元数据 clientAsync.AsyncReadMetaData += asyncReadMetaData; //订阅client操作事件 clientAsync.AsyncReadOrSubsEvent += asyncReadOrSubsEvent; clientAsync.AsyncWriteEvent += ayncWriteEvent; clientAsync.DisconnectEvent += disconnectEvent; //断线重连事件 reTime = new System.Timers.Timer(3000); reTime.Elapsed += ReTime_Elapsed; if (clientAsync.Connect()) { clientAsync.ReadMetaData(); } }