http://www.aspnetwebpages.nl Check out this website! It is in English, and has two example ASP.NET Web Pages websites made with WebMatrix using Razor.
Ranger49
Posts
-
ASP.NET Web Pages fanpage -
SQL Compact doesn't work in Windows AzureSQL Compact cannot be used in Windows Azure. You need Windows Azure SQL Database for this.
-
WebMatrix, SQL Compact and Windows AzureI use WebMatrix 3. I've got an ASP.NET Web Pages site that draws fractals, it uses a SQL Compact database and works fine locally. But after I published it to the Azure Cloud and tried it, I get an error in the Database.cshtml that it doesn't work. Error: Failed to find or load the registered .Net Framework Data Provider. The URL is: http://aljo-fractals.azurewebsites.net Click on the option Database and you'll get to see the error. I guess I need to add a framework to use the database, where do I get that? This must be easy to fix, but how...
-
SQL Compact doesn't work in Windows Azuredusty_dex wrote:
Use the regular Desktop frameworks
Do I need to use NuGet? What is the exact name of the framework I need? The point is, it works fine locally in Webmatrix. Does it have to do with a connectionstring in de configuration file?
-
SQL Compact doesn't work in Windows AzureI've got an ASP.NET Web Pages site that draws fractals, it uses a SQL Compact database and works fine locally. But now I want to publish it to the Azure Cloud and I get an error in the Database.cshtml that it doesn't work. Is it true that SQL Compact doesn't work in the Azure Cloud? The URL is: http://aljo-fractals.azurewebsites.net Error: Failed to find or load the registered .Net Framework Data Provider. I use WebMatrix 3 I guess I need to add the framework to use the database, where do I get that? This must be easy to fix, but how...
-
ProgressBarThis is fun, I understand your point, will try it! Thanks, Ranger.
-
ProgressBarI will read chapters about Threading in the books I use to learn about WPF and C# 2008. This matter is really tricky, but that this is a challenge at the same time. I reckon it isn't possible to turn the DoWork method into the UI Thread and the ProgressChanged in the backgroundworker Thread? But I find this really interesting. Thanks, Ranger.
-
ProgressBarSomehow, it seems to me, that the DoWork method should do the work and that the ProgressChanged method should update the progressBar. Unfortunately this doesn't work, I get an error message at runtime.
public void bw\_DoWork(object sender, DoWorkEventArgs e) { Random rnd = new Random(); Pen p = new Pen(); byte red, green, blue; Line line = new Line(); for (int i = 0; i < 100; i++) { SolidColorBrush brush = new SolidColorBrush(); red = (byte)rnd.Next(0, 255); green = (byte)rnd.Next(0, 255); blue = (byte)rnd.Next(0, 255); Color col = new Color(); col.R = red; col.G = green; col.B = blue; col.A = 255; brush.Color = col; line.X2 = rnd.Next(0, (int)canvas1.ActualWidth); line.Y2 = rnd.Next(0, (int)canvas1.ActualHeight); line.X1 = rnd.Next(0, (int)canvas1.ActualWidth); line.Y1 = rnd.Next(0, (int)canvas1.ActualHeight); line.Stroke = brush; line.StrokeThickness = 1.0; canvas1.Children.Add(line); bw.ReportProgress(i); } } public void bw\_ProgressChanged(object sender, ProgressChangedEventArgs e) { progressbar1.Value = e.ProgressPercentage; }
When I tried this, I got an exception in the line:
Line line = new Line();
because the thread doesn't have enough resources it should be a STA Thread, which means that this method uses up so much capacity that it needs to be the only Thread running. I am new to this. I never made a program that used more than one thread, I tried but didn't succeed. If anybody has any pointers for me, I would appreciate it. Ranger.modified on Monday, June 29, 2009 3:44 PM
-
ProgressBarprivate void button1\_Click(object sender, RoutedEventArgs e) { Random rnd = new Random(); Pen p = new Pen(); byte red, green, blue; for (int i = 0; i < 100; i++) { SolidColorBrush brush = new SolidColorBrush(); Line line = new Line(); red = (byte)rnd.Next(0, 255); green = (byte)rnd.Next(0, 255); blue = (byte)rnd.Next(0, 255); Color col = new Color(); col.R = red; col.G = green; col.B = blue; col.A = 255; brush.Color = col; line.X2 = rnd.Next(0, (int)canvas1.ActualWidth); line.Y2 = rnd.Next(0, (int)canvas1.ActualHeight); line.X1 = rnd.Next(0, (int)canvas1.ActualWidth); line.Y1 = rnd.Next(0, (int)canvas1.ActualHeight); line.Stroke = brush; line.StrokeThickness = 1.0; canvas1.Children.Add(line); } }
I would like to use a ProgressBar for this loop, but when I tried it my ProgressBar only updated itself once after the loop had been completed when it went from 0% to 100%. I reckon canvas1.Children.Add(line) functions like a stack, maybe I need to override some virtual method to make the ProgessBar show progress. Could anybody here give me a hint on how to do this? Thankyou, Ranger. PS, What I tried was in the i-loop a command
this.progressBar.Value = i;
I tried my code in a sample program that only had an i-loop that did nothing and there my progressBar worked fine... -
Why doesn't this work?Thankyou, It works now. A Brush isn't like a class which you have to distruct first before you can create a new instance. Thanks again, Ranger.
-
Why doesn't this work?protected override void OnRender(DrawingContext drawCtx) { // Do parent rendering. base.OnRender(drawCtx); // Add our custom rendering. Rect rect = new Rect(); rect.Width = rectWidth; rect.Height = rectHeight; drawCtx.DrawRectangle(Brushes.LightBlue, new Pen(Brushes.Blue, 5), rect); Random rnd = new Random(); SolidColorBrush brush = new SolidColorBrush(); Pen p = new Pen(); byte red, green, blue; Point start = new Point(); Point end = new Point(); for (int i = 0; i < 100; i++) { red = (byte)rnd.Next(0, 255); green = (byte)rnd.Next(0, 255); blue = (byte)rnd.Next(0, 255); brush.Color = Color.FromArgb(255, red, green, blue); start.X = rnd.Next(0, 200); start.Y = rnd.Next(0, 200); end.X = rnd.Next(0, 200); end.Y = rnd.Next(0, 200); drawCtx.DrawLine(new Pen(brush, 3), start, end); //Color.FromArgb(255, red, green, blue), 5.0 } }
When I try this, I get 100 random lines on my screen like I wanted, but the colors of the lines are all the same instead of a new color for every line, so for some reason my code doesn't change the color of the brush. I wouldn't have a clue what could be the reason for this. The rectangle is drawn fine, I added the code for the lines later myself. Would someone be able to help me? Thankyou, Ranger.
-
XmlWriterThanks... I will study this. Ranger
-
XmlWriterOk, I see... What I would want to do is write an XML file with data to the server where the Silverlight application is situated. Is this possible at all? Or is the only option Isolated Storage on the computer of the person who is viewing the Silverlight application? Thanks! Ranger.
-
XmlWriterusing System; using System.Text; using System.Collections.Generic; using System.Linq; using System.Xml.Linq; using System.Xml; using System.Net; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Shapes; using System.IO; namespace LinqToXmlSilverlight090322 { public partial class Page : UserControl { public Page() { InitializeComponent(); StringBuilder sb = new StringBuilder("test.xml", 10); XmlWriterSettings xws = new XmlWriterSettings(); xws.OmitXmlDeclaration = true; xws.Indent = true; using (XmlWriter xw = XmlWriter.Create(sb, xws)) { XDocument xd = new XDocument( new XElement("MyFractals", new XElement("first", new XAttribute("range", "1,5"), new XAttribute("startRe", "1,0"), new XAttribute("startIm", "-0,7"), new XAttribute("startColor", "100") ), new XElement("second", new XAttribute("range", "0,5"), new XAttribute("startRe", "0,105"), new XAttribute("startIm", "-0,6"), new XAttribute("startColor", "160") ), new XElement("third", new XAttribute("range", "0,75"), new XAttribute("startRe", "0,5"), new XAttribute("startIm", "0,204"), new XAttribute("startColor", "60") ) ) ); xd.Save(xw); } using (XmlReader reader = XmlReader.Create(new StringReader(sb.ToString()))) { XDocument xd2 = XDocument.Load(reader); XElement rt = xd2.Element(XName.Get("MyFractals")); var xyz = from e in rt.Elements() select e; //foreach (XElement x in xyz) } } } }
Why doesn't this work? There is no test.xml file created and when the program tries to open the xml file (which I manually placed) I get -
XmlWriterI just discovered that I hadn't included a using System.Xml; line in the header. But where do you specify the filename of the xml-file you are trying to save? Ranger.
-
XmlWriterusing System; using System.Text; using System.Collections.Generic; using System.IO; using System.Net; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Shapes; using System.Xml; using System.Xml.Linq; namespace SilverlightApplication1 { public partial class Page : UserControl { public Page() { InitializeComponent(); StringBuilder sb = new StringBuilder(); XmlWriterSettings xws = new XmlWriterSettings(); xws.OmitXmlDeclaration = true; xws.Indent = true; using (XmlWriter xw = XmlWriter.Create(sb, xws)) { XDocument xd = new XDocument(
I tried with this code to wite an XML file to the server (local host). But that VWDExpress doesn't see the XmlWriterSettings and XmlWriter. I think I am using the wrong references. Can anybody tell me in what reference XmlWriterSettings and XmlWriter can be found? Thanks, Ranger. PS, If anybody can get me a sample project I would appreciate it. -
DirectX installation.It turned out I had only installed the DirectX SDK and not the runtime library. It seems that new books about DirectX (like version 10) no longer use the C# programming language but use the C++ language instead. From what I have read about DirectX I figure it is much more complicated than OpenGL, so I will stick to the latter... Ranger.
-
DirectX installationIt turned out I had only installed the DirectX SDK and not the runtime library. It seems that new books about DirectX (like version 10) no longer use the C# programming language but use the C++ language instead. From what I have read about DirectX I figure it is much more complicated than OpenGL, so I will stick to the latter... Ranger.
-
DirectX installation.I downloaded the DirectX 9.0c SDK (C#) from the Microsoft site and then installed it. After that I wanted to compile a sample C# source and discovered that the References to DirectX were not available! How do I get the DirectX assemblies on my PC so that I can use DirectX namespace(s)? Do I need to download and install some more software for this? What do I need and where do I get it from? Please some advice. Thank you, Ranger.
-
DirectX installationI downloaded the DirectX 9.0c SDK (C#) from the Microsoft site and then installed it. After that I wanted to compile a sample C# source and discovered that the References to DirectX were not available! How do I get the DirectX assemblies on my PC so that I can use DirectX namespace(s)? Do I need to download and install some more software for this? What do I need and where do I get it from? Please some advice. Thank you, Ranger.