我的問題是,我調試我的程序後,它不會加載我的應用程序,這是我看到的唯一的東西:http://prntscr.com/98oybj 我不能找到它在谷歌,使非常沮喪。 構建應用程序時,我沒有收到任何錯誤或錯誤,但應用程序無法啓動。 即使在等待它仍然不啓動應用程序。甚至認爲VS說''部署成功''visual studio:調試器沒有啓動應用程序後部署
這真的很煩人,這也發生在其他項目。順便說一句,我沒有自己做這個代碼,它是從書:微軟的Visual C#步步2013年
下面是代碼:
public sealed partial class GraphWindow : Page
{
// Reduce pixelWidth and pixelHeight if there is insufficient memory available
private int pixelWidth = 12000;
private int pixelHeight = 7500;
private WriteableBitmap graphBitmap = null;
private int bytesPerPixel = 4;
private byte[] data;
private byte redValue, greenValue, blueValue;
private CancellationTokenSource tokenSource = null;
public GraphWindow()
{
this.InitializeComponent();
int dataSize = bytesPerPixel * pixelWidth * pixelHeight;
data = new byte[dataSize];
graphBitmap = new WriteableBitmap(pixelWidth, pixelHeight);
}
private void cancelButton_Click(object sender, RoutedEventArgs e)
{
if (tokenSource != null)
{
tokenSource.Cancel();
}
}
private void plotButton_Click(object sender, RoutedEventArgs e)
{
Random rand = new Random();
redValue = (byte)rand.Next(0xFF);
greenValue = (byte)rand.Next(0xFF);
blueValue = (byte)rand.Next(0xFF);
tokenSource = new CancellationTokenSource();
CancellationToken token = tokenSource.Token;
Stopwatch watch = Stopwatch.StartNew();
try
{
generateGraphData(data, 0, pixelWidth/2, token);
duration.Text = string.Format("Duration (ms): {0}", watch.ElapsedMilliseconds);
}
catch (OperationCanceledException oce)
{
duration.Text = oce.Message;
}
Stream pixelStream = graphBitmap.PixelBuffer.AsStream();
pixelStream.Seek(0, SeekOrigin.Begin);
pixelStream.Write(data, 0, data.Length);
graphBitmap.Invalidate();
graphImage.Source = graphBitmap;
}
private void generateGraphData(byte[] data, int partitionStart, int partitionEnd, CancellationToken token)
{
int a = pixelWidth/2;
int b = a * a;
int c = pixelHeight/2;
for (int x = partitionStart; x < partitionEnd; x++)
{
int s = x * x;
double p = Math.Sqrt(b - s);
for (double i = -p; i < p; i += 3)
{
token.ThrowIfCancellationRequested();
double r = Math.Sqrt(s + i * i)/a;
double q = (r - 1) * Math.Sin(24 * r);
double y = i/3 + (q * c);
plotXY(data, (int)(-x + (pixelWidth/2)), (int)(y + (pixelHeight/2)));
plotXY(data, (int)(x + (pixelWidth/2)), (int)(y + (pixelHeight/2)));
}
}
}
private void plotXY(byte[] data, int x, int y)
{
int pixelIndex = (x + y * pixelWidth) * bytesPerPixel;
data[pixelIndex] = blueValue;
data[pixelIndex + 1] = greenValue;
data[pixelIndex + 2] = redValue;
data[pixelIndex + 3] = 0xBF;
}
}
你是如何部署應用程序? – stuartd
我對此很新,所以我儘量給你提供儘可能多的信息。它調試爲winrt(通用Windows 8.1(商店)應用程序開發)。雖然沒有改變任何設置,所以它使用標準的調試器爲win 8.1應用程序。 – wouterrobot