private async Task PerformClusteringAsync() { Clusters clustering = new Clusters(); int.TryParse(numClusters, out int maxClusters); GCHandle handle = GCHandle.Alloc(data, GCHandleType.Pinned); IntPtr pointer = handle.AddrOfPinnedObject(); var clusters = clustering.DoCluster(pointer, 2, data.GetLength(0), maxClusters, useSpectral); eventAggregator.GetEvent <ClustersFoundEvent>().Publish(clusters); }