|
this is my whole code and I want to parameterise the " HtmlEdit uIGenericSearchEdit = this.UIGenericWindowsInterneWindow.UIGenericDocument.UIGenericSearchEdit;
"to supply the name of the object so as not to have a new mthod for each new object type searchedit of different name - i will still give it a unique label -uIGenericSearchEdit1 ,uIGenericSearchEdit2 etc
<br />
namespace proofofconcept1csharp<br />
{<br />
using System;<br />
using System.CodeDom.Compiler;<br />
using System.Collections.Generic;<br />
using System.Drawing;<br />
using System.Text.RegularExpressions;<br />
using System.Windows.Input;<br />
using Microsoft.VisualStudio.TestTools.UITest.Extension;<br />
using Microsoft.VisualStudio.TestTools.UITesting;<br />
using Microsoft.VisualStudio.TestTools.UITesting.HtmlControls;<br />
using Microsoft.VisualStudio.TestTools.UITesting.WinControls;<br />
using Microsoft.VisualStudio.TestTools.UnitTesting;<br />
using Keyboard = Microsoft.VisualStudio.TestTools.UITesting.Keyboard;<br />
using Mouse = Microsoft.VisualStudio.TestTools.UITesting.Mouse;<br />
using MouseButtons = System.Windows.Forms.MouseButtons;<br />
<br />
using System.IO;<br />
using System.Collections;<br />
using System.Configuration;<br />
using System.Data;<br />
using System.Data.OleDb;<br />
using System.Web;<br />
using System.Web.UI;<br />
<br />
<br />
[GeneratedCode("Coded UITest Builder", "10.0.30128.1")]<br />
public partial class UIMap<br />
{<br />
<br />
public void RecordedMethod1()<br />
{<br />
#region Variable Declarations<br />
HtmlEdit uIGenericSearchEdit = this.UIGenericWindowsInterneWindow.UIGenericDocument.UIGenericSearchEdit;<br />
HtmlInputButton uIGenericSearchButton = this.UIGenericWindowsInterneWindow.UIGenericDocument.UIGenericSearchButton;<br />
WinButton uICloseButton = this.UIGenericWindowsInterneWindow.UITestGenericSearchWindTitleBar.UICloseButton;<br />
#endregion<br />
<br />
<br />
this.UIGenericWindowsInterneWindow.LaunchUrl(new System.Uri(this.RecordedMethod1Params.UIGenericWindowsInterneWindowUrl));<br />
<br />
uIGenericSearchEdit.Text = this.RecordedMethod1Params.UIGenericSearchEditText;<br />
<br />
Mouse.Click(uIGenericSearchButton, new Point(47, 19));<br />
<br />
Mouse.Click(uICloseButton, new Point(7, 9));<br />
}<br />
<br />
#region Properties<br />
public virtual RecordedMethod1Params RecordedMethod1Params<br />
{<br />
get<br />
{<br />
if ((this.mRecordedMethod1Params == null))<br />
{<br />
this.mRecordedMethod1Params = new RecordedMethod1Params();<br />
}<br />
return this.mRecordedMethod1Params;<br />
}<br />
}<br />
<br />
public UIGenericWindowsInterneWindow UIGenericWindowsInterneWindow<br />
{<br />
get<br />
{<br />
if ((this.mUIGenericWindowsInterneWindow == null))<br />
{<br />
this.mUIGenericWindowsInterneWindow = new UIGenericWindowsInterneWindow();<br />
}<br />
return this.mUIGenericWindowsInterneWindow;<br />
}<br />
}<br />
#endregion<br />
<br />
#region Fields<br />
private RecordedMethod1Params mRecordedMethod1Params;<br />
<br />
private UIGenericWindowsInterneWindow mUIGenericWindowsInterneWindow;<br />
#endregion<br />
}<br />
<br />
[GeneratedCode("Coded UITest Builder", "10.0.30128.1")]<br />
public class RecordedMethod1Params<br />
{<br />
<br />
#region Fields<br />
public string UIGenericWindowsInterneWindowUrl = "http://www.google.com.au/";<br />
<br />
public string UIGenericSearchEditText = "test";<br />
#endregion<br />
}<br />
<br />
[GeneratedCode("Coded UITest Builder", "10.0.30128.1")]<br />
<br />
public class UIGenericWindowsInterneWindow : BrowserWindow<br />
{<br />
<br />
public UIGenericWindowsInterneWindow()<br />
{<br />
#region Search Criteria<br />
this.SearchProperties[UITestControl.PropertyNames.ClassName] = "IEFrame";<br />
#endregion<br />
}<br />
<br />
public void LaunchUrl(System.Uri url)<br />
{<br />
this.CopyFrom(BrowserWindow.Launch(url));<br />
}<br />
<br />
#region Properties<br />
public UIGenericDocument UIGenericDocument<br />
{<br />
get<br />
{<br />
if ((this.mUIGenericDocument == null))<br />
{<br />
this.mUIGenericDocument = new UIGenericDocument(this);<br />
}<br />
return this.mUIGenericDocument;<br />
}<br />
}<br />
<br />
public UITestGenericSearchWindTitleBar UITestGenericSearchWindTitleBar<br />
{<br />
get<br />
{<br />
if ((this.mUITestGenericSearchWindTitleBar == null))<br />
{<br />
this.mUITestGenericSearchWindTitleBar = new UITestGenericSearchWindTitleBar(this);<br />
}<br />
return this.mUITestGenericSearchWindTitleBar;<br />
}<br />
}<br />
#endregion<br />
<br />
#region Fields<br />
private UIGenericDocument mUIGenericDocument;<br />
<br />
private UITestGenericSearchWindTitleBar mUITestGenericSearchWindTitleBar;<br />
#endregion<br />
}<br />
<br />
[GeneratedCode("Coded UITest Builder", "10.0.30128.1")]<br />
<br />
public class UIGenericDocument : HtmlDocument<br />
{<br />
<br />
public UIGenericDocument(UITestControl searchLimitContainer) :<br />
base(searchLimitContainer)<br />
{<br />
#region Search Criteria<br />
#endregion<br />
}<br />
<br />
#region Properties<br />
public HtmlEdit UIGenericSearchEdit<br />
{<br />
get<br />
{<br />
if ((this.mUIGenericSearchEdit == null))<br />
{<br />
this.mUIGenericSearchEdit = new HtmlEdit(this);<br />
#region Search Criteria<br />
this.mUIGenericSearchEdit.SearchProperties[HtmlEdit.PropertyNames.Id] = null;<br />
this.mUIGenericSearchEdit.SearchProperties[HtmlEdit.PropertyNames.Name] = "q";<br />
this.mUIGenericSearchEdit.SearchProperties[HtmlEdit.PropertyNames.LabeledBy] = null;<br />
this.mUIGenericSearchEdit.SearchProperties[HtmlEdit.PropertyNames.Type] = "SINGLELINE";<br />
#endregion<br />
}<br />
return this.mUIGenericSearchEdit;<br />
}<br />
}<br />
<br />
public HtmlInputButton UIGenericSearchButton<br />
{<br />
get<br />
{<br />
if ((this.mUIGenericSearchButton == null))<br />
{<br />
this.mUIGenericSearchButton = new HtmlInputButton(this);<br />
#region Search Criteria<br />
this.mUIGenericSearchButton.SearchProperties[HtmlButton.PropertyNames.Id] = null;<br />
this.mUIGenericSearchButton.SearchProperties[HtmlButton.PropertyNames.Name] = "btnG";<br />
this.mUIGenericSearchButton.FilterProperties[HtmlButton.PropertyNames.Type] = "submit";<br />
this.mUIGenericSearchButton.FilterProperties[HtmlButton.PropertyNames.Title] = null;<br />
#endregion<br />
}<br />
return this.mUIGenericSearchButton;<br />
}<br />
}<br />
#endregion<br />
<br />
#region Fields<br />
private HtmlEdit mUIGenericSearchEdit;<br />
<br />
private HtmlInputButton mUIGenericSearchButton;<br />
#endregion<br />
}<br />
<br />
[GeneratedCode("Coded UITest Builder", "10.0.30128.1")]<br />
<br />
public class UITestGenericSearchWindTitleBar : WinTitleBar<br />
{<br />
<br />
public UITestGenericSearchWindTitleBar(UITestControl searchLimitContainer) :<br />
base(searchLimitContainer)<br />
{<br />
#region Search Criteria<br />
#endregion<br />
}<br />
<br />
#region Properties<br />
public WinButton UICloseButton<br />
{<br />
get<br />
{<br />
if ((this.mUICloseButton == null))<br />
{<br />
this.mUICloseButton = new WinButton(this);<br />
#region Search Criteria<br />
this.mUICloseButton.SearchProperties[WinButton.PropertyNames.Name] = "Close";<br />
#endregion<br />
}<br />
return this.mUICloseButton;<br />
}<br />
}<br />
#endregion<br />
<br />
#region Fields<br />
private WinButton mUICloseButton;<br />
#endregion<br />
}<br />
}<br />
|
|
|
|
|
If you are trying to modify a GENERATED piece of code, you are in for serious trouble.
I don't really understand the question anymore, so I'll try to rephrase it.
As far as I understand you want to assign a number of variables unique HtmlItem objects :
HtmlEdit uIGenericSearchEdit1 = new HtmlEdit(this);
HtmlEdit uIGenericSearchEdit2 = new HtmlEdit(this);
but you want them initialized like in your example of UIGenericSearchEdit property and the name is a parameter (variable)? Am I correct?
I don't like my signature at all
|
|
|
|
|
Hi,
I have one flat file which contains data in particular format.The file contains data in particular format which generates pages. Each page contains Year in MM/DD/YYYY format which always starts with specific position means specific x,y coordinate, so out of this it will generate N no of pages. There are multiple dates available in one page like YearStarting , YearEnding etc and out of this i want to find out only particular date like YearStarting. I don't want to find out values for YearEnding.
My requirement is that i have to find out each and every YearStarting value contains in the flat file from first line to end of the reports. YearStarting data is having specific position in each pages.
Can some one tell me how to find out each value of Year from the Flat file(or text file) using C#??
Thanks a lot.
|
|
|
|
|
You could try regular expressions.
|
|
|
|
|
I have multiple columns which contains Year format, so basically year format is NOT unique thru out the
file, so if i use regular expression then it will fetch values from multiple column and i want all the values from
specific single column.
|
|
|
|
|
Not if you write your expression properly.
We'd need to see a sample of the file.
|
|
|
|
|
Pseudo code
open the file (System.IO)
read line (System.Text)
test that it contains the YearStarting pattern in the text (System.Text or regex)
extract the first date after pattern (System.Text or regex)
store the details (System.Data)
repeat test if it is possible to have more than 1 date per line
repeat line 2 until end of file
close file
Fairly simple really
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Use a StreamReader to read the file into a List<string> or some other “collection”.
Iterate over the list looking for page start / end (e.g. form feeds or whatever).
Since you know the x,y of the date in question, count “y” lines from the top / bottom of a “page”.
Once you have the line in question, use “string” functions to get date at “x”; e.g.
// Assumes x relative to 0 and date in mm/dd/yyyy format
String strDate = line.SubString( x, 10 );
Then just convert the “string date” to a suitable format for further processing using Parse or whatever.
|
|
|
|
|
hii........plz help
by use asp.net .... if i hve one image...if i click on some color(i take as buton click event like btngreen_click) i need to change that total image to that green color..
thanqu fnds...
~@nisha~
"The work will teach you how to do it.....!!"
|
|
|
|
|
Why fiddle with the image, why not just replace the image with a green rectangle.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
hummmm.....i need 2 fill with color to that total image.... bye just click on button...
|
|
|
|
|
I'm writing an application that started fine as a Windows Application using Visual c# 2008. I had problems with my PC and had to restart. Now when I try to run the program in the editor it thinks that the ouptput is a Class Library even though it is set to Windows Application under project preperties. How can I fix this?
|
|
|
|
|
Maybe your solution contains several projects and the one that you want isn't the startup project any more?
|
|
|
|
|
hello all,
i have a windows application program contains a dll and i need to decomplie this dll to modify some functions.
can any one advice me how i can do it?
please reply me quickly
best regards
Abdullah
|
|
|
|
|
As you posted this in c# forum, I assume that it's a .NET dll, and you can decompile it with Reflector: http://www.red-gate.com/products/reflector/[^]
Die Energie der Welt ist konstant. Die Entropie der Welt strebt einem Maximum zu.
|
|
|
|
|
Member 4528123 wrote: please reply me quickly
Quickly? Ok, here are some quick options.
1) Contact the company that wrote it, and ask them to change it
2) Teach yourself how to reverse engineer (This might take a few years or more)
3) Figure out another way to solve your problem that doesn't involve decompiling someone else's code.
|
|
|
|
|
If those methods are virtual, you could always override them.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
I would usually try opening it in Reflector ( + ReflexIL plugin) and then just edit the function at the IL level. Much easier that way - if you have the Reflector decompile it completely it will almost always make some mistakes, which you'd have to fix.
If someone was so silly as to use "Reflector breakers" I'd probably first try the tools from NTCore (eg using Rebel.NET to replace the function)
|
|
|
|
|
Hi Guys
Hope you can help. I'm writing a program to do a record count within an XML file
The XML file is structured as per below:
<WEBRequest>
<Request>
<BlockA>
<REC>
<CustomerNumber></CustomerNumber>
<FirstName></FirstName>
<LastName></LastName>
<Email></Email>
</REC>
</BlockA>
<BlockB>
<REC>
<FirstName></FirstName>
<LastName></LastName>
<OrderDetail></OrderDetail>
<PartType></PartType>
</REC>
<REC>
<FirstName></FirstName>
<LastName></LastName>
<OrderDetail></OrderDetail>
<PartType></PartType>
</REC>
<REC>
<FirstName></FirstName>
<LastName></LastName>
<OrderDetail></OrderDetail>
<PartType></PartType>
</REC>
</BlockB>
<BlockC>
....
....
....
....
</BlockC>
....
....
....
</Request>
What I need to do is count and output number of <REC>'s for each <Block> element and output to a cell within excel (Excel Automation is working).
E.g.
BlockA = 1 REC
BlockB = 3 REC
.
.
.
BlockM = 32 REC
I have the excel automated correctly, however, I'm afraid that my inexperience with XML is quite telling, so I dont have a clear idea on how to do the record count.
Thanks in advance!!!
Grg!
|
|
|
|
|
Using XDocument it's quite easy:
XDocument doc = XDocument.Load("YourXMLHere.xml");
var distinctBlocks = from rec in doc.Descendants()
where rec.Name.ToString().StartsWith("Block")
select rec;
var results = from rec in distinctBlocks.Descendants("REC")
select rec;
var output = (from rec in results
group rec by rec.Parent.Name into g
select new {Block = g.Key, Count = g.Count()}).ToList();
modified on Tuesday, April 27, 2010 3:55 PM
|
|
|
|
|
Thanks for Info!
I don't suppose you have the c# code?
|
|
|
|
|
GrgBalden wrote: I don't suppose you have the c# code?
That was C#(3) code.
Using XLinq => Linq to XML.
modified on Wednesday, April 28, 2010 10:33 AM
|
|
|
|
|
Hi can anyone else help with this, I'm somewhat limited to c#2 (using VS2005)??
|
|
|
|
|
here you go.
I created a dummy class that holds the Block name and the rec count:
public class BlockCount
{
private int count = 0;
public int Count
{
get { return count; }
set { count = value; }
}
private string block;
public string Block
{
get { return block; }
set { block = value; }
}
}
private void button1_Click(object sender, EventArgs e)
{
XmlDocument doc = new XmlDocument();
doc.Load("Abs.xml");
XmlNodeList requests = doc.GetElementsByTagName("Request");
if (requests != null && requests.Count > 0)
{
blocks = new List<BlockCount>();
foreach (XmlNode nd in requests)
{
foreach (XmlNode blck in nd.ChildNodes)
{
BlockCount c = new BlockCount();
c.Block = blck.Name;
foreach (XmlNode rec in blck.ChildNodes)
{
c.Count++;
}
blocks.Add(c);
}
}
}
dataGridView1.DataSource = blocks;
}
}
modified on Wednesday, April 28, 2010 2:11 PM
|
|
|
|
|
Thank you kindly!!!
Will give this a go tommorow!
|
|
|
|