Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
R

Ranger49

@Ranger49
About
Posts
72
Topics
27
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • ASP.NET Web Pages fanpage
    R Ranger49

    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.

    ASP.NET asp-net csharp tutorial

  • SQL Compact doesn't work in Windows Azure
    R Ranger49

    SQL Compact cannot be used in Windows Azure. You need Windows Azure SQL Database for this.

    Cloud Computing database cloud help csharp asp-net

  • WebMatrix, SQL Compact and Windows Azure
    R Ranger49

    I 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...

    ASP.NET database cloud help csharp asp-net

  • SQL Compact doesn't work in Windows Azure
    R Ranger49

    dusty_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?

    Cloud Computing database cloud help csharp asp-net

  • SQL Compact doesn't work in Windows Azure
    R Ranger49

    I'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...

    Cloud Computing database cloud help csharp asp-net

  • ProgressBar
    R Ranger49

    This is fun, I understand your point, will try it! Thanks, Ranger.

    WPF data-structures tutorial question lounge

  • ProgressBar
    R Ranger49

    I 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.

    WPF data-structures tutorial question lounge

  • ProgressBar
    R Ranger49

    Somehow, 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

    WPF data-structures tutorial question lounge

  • ProgressBar
    R Ranger49
        private 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...

    WPF data-structures tutorial question lounge

  • Why doesn't this work?
    R Ranger49

    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.

    WCF and WF help question lounge

  • Why doesn't this work?
    R Ranger49
    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.

    WCF and WF help question lounge

  • XmlWriter
    R Ranger49

    Thanks... I will study this. Ranger

    WPF csharp linq sysadmin xml question

  • XmlWriter
    R Ranger49

    Ok, 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.

    WPF csharp linq sysadmin xml question

  • XmlWriter
    R Ranger49

    using 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

    WPF csharp linq sysadmin xml question

  • XmlWriter
    R Ranger49

    I 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.

    WPF csharp linq sysadmin xml question

  • XmlWriter
    R Ranger49

    using 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.

    WPF csharp linq sysadmin xml question

  • DirectX installation.
    R Ranger49

    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.

    Graphics question csharp graphics game-dev

  • DirectX installation
    R Ranger49

    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.

    C# question csharp graphics game-dev

  • DirectX installation.
    R Ranger49

    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.

    Graphics question csharp graphics game-dev

  • DirectX installation
    R Ranger49

    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.

    C# question csharp graphics game-dev
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups