void disconect_btn_Click(object sender, RoutedEventArgs e) { if (userGrid.SelectedIndex == -1) { return; } else if (Model.Project.ConnectInfo[rowIndxConn].Connected) { Model.Project.ConnectInfo[rowIndxConn].Connected = false; Model.Project.ConnectInfo.Remove(userGrid.SelectedValue as ConnectionModel); return; } else { Model.Project.ConnectInfo.Remove(userGrid.SelectedValue as ConnectionModel); disconect_btn.Visibility = Visibility.Hidden; } ConnectionModel selected = userGrid.SelectedItem as ConnectionModel; selected.Connected = false; if (api != null) { api.Disconnect(); } else { return; } }
public void Stop() { if (api != null) { try { api.OnConnectProgress -= Api_OnConnectProgress; api.OnQuote -= Api_OnQuote; api.Disconnect(); } catch (Exception e) { //logger.LogError(ViewId + " " + e.Message); } api = null; } }