|
|
I have been consuming (looking at) the results I see from a web service that I am going to obtain to call. As part of the process, I started a shell C# 2010 app that will look at the information obtained from the web service. I have been able to obtain the PDF documents by specifying where those files should be located in an app.config file.
However my problem is obtaining the results of an xml and an xsd file. The xml/xsd information is not saved to any file. This information is displayed in a dos prompt window when I run a command script. I have been able to save the output to a text file by doing a redirection statement to write the information to a text file.
However I would like to know how I can capture the xsd/xml file so that I can parse through the information to extract the specific information I am looking for.
Thus, can you tell me and/or point me to a reference that will tell me how to accomplish this task?
|
|
|
|
|
If you're starting the process with Process.Start, you can redirect its stdout to a stream you control. See here[^].
|
|
|
|
|
Thank you!
I have the following addtional questions:
1. How can I save the data in an xml format that I can parse through?
2. How can I parse through the xml data? Would I use something like an xml.exe and/or xsd.exe to create the classes? How would this help me parse through the data?
|
|
|
|
|
You can use XSD to create auto-generated classes from a schema, and then there's some easy way to load a file into a class hierarchy based on that (which I currently forget, sorry about that, it's a while since I did any of that stuff). If you have a fixed schema that's probably the way to go.
You should be able to push the redirected stdout into a MemoryStream, and then use that to create an object tree, without needing to ever create a file.
|
|
|
|
|
I have one additional question.
The information appears in a dos popup window. Can you tell me how to obtain the information from a dos popup window?
|
|
|
|
|
If you're redirecting the standard streams then the console shouldn't appear any more, if it's a normal command line process. The fact that you can > redirect the output suggests it is going to stdout.
Are you using Process.Start to start this process? You need to set UseShellExecute to false (I think that was in the link I posted before) and RedirectStandardOutput, Error and Input to true to make the console disappear, if I remember right.
|
|
|
|
|
Hi All,
I have created a user control which draws some items on a bitmap. This control is scrollable and we can also pan it.
I am using Microsof.Gesture/PhysicsEngine library for controlling gestures.
The full scenario is like I create the full bitmap only once and after that when I do any gesture like scroll or pan i just show particuler portion of the bitmap but it has lot of flickering. Following is the code sample:
protected override void OnPaintBackground(PaintEventArgs e)
{
}
private Bitmap _cachedBitmap;
protected override void OnPaint(PaintEventArgs e)
{
using (Graphics g = e.Graphics)
{
if (!_isPainted)
{
_cachedBitmap = new Bitmap(ClientRectangle.Width, ClientRectangle.Height);
InitilizeBitmap(g);
_isPainted = true;
}
Rectangle rec = new Rectangle(0, _bitmapLocation.Y, ClientRectangle.Width, ClientRectangle.Height);
g.DrawImage(_bmpControl, 0, 0, rec, GraphicsUnit.Pixel);
}
}
Any idea how can I avoid flickering ?
Praveen Sharma
|
|
|
|
|
|
I am using .Net Compact Framework FYI.
There is nothing like:
DoubleBuffered = true;
Praveen Sharma
|
|
|
|
|
Sorry, missed that. It looks like the old fashioned SetStyle call isn't there either.
|
|
|
|
|
Have a look at this[^] article to get some ideas on double buffering in Compact Framework.
|
|
|
|
|
This article is just bad, just for kids to play.
Praveen Sharma
|
|
|
|
|
How big is the bitmap?
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
It's 200 * 2000 (width * height )
Praveen Sharma
|
|
|
|
|
Care to link to an example? I'm wondering whether that 2000 could be reduced.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
I got this error in my code:
Cannot add part for the specified URI because it is already in the package
At this line:
var chart = xlSheets.Drawings.AddChart(dataSet.DataSetName, OfficeOpenXml.Drawing.Chart.eChartType.ColumnClustered);
I am trying to create multiple sheets.
Anyone know how to fix this?
THANKS in advanced~
|
|
|
|
|
As this is a CodePlex project, the best place to ask would be the support forums for that package on CodePlex itself. When you post a question there, the developers will be notified.
|
|
|
|
|
Anyone know how to set title for Xaxis and Yaxis?
I can't find it.
|
|
|
|
|
I cannot figure out the syntax for using the LINQ extensions on IList (and other interfaces) to search for values that are in nested objects.
For instance, I have a List<foo>, where object foo contains two other objects, each of which have field "data".
How do I use List.Contains<foo>("hello") to search for a foo object where foo.nestedobject.data = hello?
|
|
|
|
|
Why not ask in the LINQ forum where the LINQ guru's hang out?
|
|
|
|
|
Thanks. I asked here because it's not obvious that object.contains() is actually a LINQ extension. Sadly, you can't do what I want with object.contains(), which does not let you compare nested values directly.
Turns out that what I need is
foo.Any(f => f.bar.data == "hello")
Which makes me a little sad, because
foo.Contains(nested value I was looking for)
would have been a lot simpler than having to break out my book and re-learn lambdas. Oh well, wave of the future
|
|
|
|
|
How could Contains() have any "idea" in which properties of foo to look for some value?
For instance, should it look in all properties that are the same type as the value to find? What if it is nested arbitrarily deep?
The only rational behavior is for the developer to be responsible to structure the query.
Re: lambdas... they're not that hard!
|
|
|
|
|
How would Contains know to look inside its member items?
You can either use Any with a lambda as you've discovered, or you can implement equality checking on the class Foo and do
List.Contains(new Foo("hello"))
... if that makes any sense for the actual class you're using. I'd generally use the lambda, that makes it crystal clear what the test you're actually doing is.
|
|
|
|
|
Help with visual c# software developing? The first tab will deal with a persons details. The tab will havea combo box which will contain the names of people. The user will select a person and the drtails will be displayed in the relevent controls. A second combo box will allow the user to choose whther the person is an employee ir a client. If the person is a client, his/her name, surname, age and telephone number must be stored. The category must be stored or displayed as well.
The second tab will have a combo box which will contain the type or description of the product. The user will select type or description and the products details will be displayed. Details will be; type/description, quantity, price (these must be stored coming from textbox controls) and price including VAT (displayed in a text box)
Each tab must have add and remove buttons to remove and add new details.
Details will be stored in two separwte arraylists.
Create a product class, with constructors, properties for the type, quantity, price and a method to calculate the price including VAT.
Create a person class with properties for name, surname, age and category. Include relevent constructors.
Include two more classes (employee and client) which inherit from person class . The employee class will have a property for its position. The client class will have a property for its telephone number. Include constructors for both child classes.
Include error trapping.
Format the values displayed for pricing to a currency type.
Ensure that the price including VAT updates as the user types the price for the product
Ensure relevent comboboxes areupdated as you move from one tab to another.
I NEED HELP WITH THIS, i am doing a part time course, and i am confused on wat to do, and how to do it. I have an idea with working this, but i am confused by the above.
|
|
|
|