Well, xda has been a great place for devs to interact and share......
But while sharing some codes, the BB code tag (i.e [ code ] [ /code ] ) is not very pleasing to the eyes and does not help in better reading.....
Introducing something like a Syntax Highlighter will be really helpful.......
Or else a deal with notepad++ to somehow use it in the vBulletin forums will simply be awesome!
Post your ideas to make xda more helpful!
the code bbcode is just fine.
balamu96m said:
Well, xda has been a great place for devs to interact and share......
But while sharing some codes, the BB code tag (i.e [ code ] [ /code ] ) is not very pleasing to the eyes and does not help in better reading.....
Introducing something like a Syntax Highlighter will be really helpful.......
Or else a deal with notepad++ to somehow use it in the vBulletin forums will simply be awesome!
Post your ideas to make xda more helpful!
Click to expand...
Click to collapse
Try the [ php ] tag It's not perfect, but it's quite good for java IIRC
fuser1337 said:
the code bbcode is just fine.
Click to expand...
Click to collapse
The size of your sig, however, isn't.
Could you either remove some of the content or put it in [ HIDE] tags please?
Related
this is my first post. I am pretty desperate at the moment.
I would like to dynamically create the UI for the WP7 based on a CSV file in Isolated Storage. right now I would settle for just being able to write the UI in XAML from the code behind in C#.
steps that I would like to execute:
1. user clicks a muscle group button which passes a value to another page-done
2. users data is pulled from CSV file and placed in array for easy storage-done
3. for each data element create a XAML TextBlock with the data which is displayed in the UI <-- need some serious help
best I can do is show the XAML code with the <> tags as a string in the UI.
is what I am asking possible?
Thanks for helping.
Knudmt said:
this is my first post. I am pretty desperate at the moment.
I would like to dynamically create the UI for the WP7 based on a CSV file in Isolated Storage. right now I would settle for just being able to write the UI in XAML from the code behind in C#.
steps that I would like to execute:
1. user clicks a muscle group button which passes a value to another page-done
2. users data is pulled from CSV file and placed in array for easy storage-done
3. for each data element create a XAML TextBlock with the data which is displayed in the UI <-- need some serious help
best I can do is show the XAML code with the <> tags as a string in the UI.
is what I am asking possible?
Thanks for helping.
Click to expand...
Click to collapse
Sounds like what you really want to do is dynamically create controls in the code-behind. I would forget about generating "XAML".
Code:
private void AddTextboxesFromCSV(string[] CSVData) {
foreach(string str in CSVData) {
TextBlock tb = new TextBlock();
tb.Name = "txtUserSelectedValue" + CSVData.IndexOf(str);
tb.Text = str;
<YourObject>.Controls.Add(tb);
}
}
Where <YourObject> is the object you want to place the controls into, some sort of layout Panel.
Thanks for the response
I think that is the direction I will be going. Just out of curiosity do you know if what I wanted to do is even possible?
UN app for WP7 does something like this. Go to http://unitednations.codeplex.com/releases/view/57722 and grab the source. Open the source in Visual Studio and browse to the "Framework" folder and open up "BasePage.cs". At the bottom there's a method called AddNavigatingText() that does what I think you are looking to do.
Here's the method:
Code:
protected Grid AddNavigatingText()
{
var NavigatingText = (Grid) XamlReader.Load(
@" <Grid xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation""
xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml"" Height=""30"" VerticalAlignment=""Top"" Background=""#CCFFFFFF"">
<TextBlock HorizontalAlignment=""Left"" TextWrapping=""Wrap"" Text=""Navigating..."" Width=""129"" FontSize=""{StaticResource PhoneFontSizeNormal}"" Margin=""24,0,0,0"" FontFamily=""{StaticResource PhoneFontFamilySemiBold}""/>
<ProgressBar Style=""{StaticResource PerformanceProgressBar}"" RenderTransformOrigin=""0.5,0.5"" Margin=""135,0,0,0"" UseLayoutRounding=""False"" Background=""White"" IsIndeterminate=""True"" LargeChange=""0"" />
</Grid>");
this.Content.As<Grid>().Children.Add(NavigatingText);
return NavigatingText;
}
Thanks for the reply. Looks pretty simple. I downloaded the source and signed up for codeplex. However I can not connect to the tfs.codeplex.com
It's not possible to use dynamically created XAML; code is the way to go and much easier IMHO.
When you open the project just hit cancel at the login screen and it will load.
sulphuricaciduk said:
It's not possible to use dynamically created XAML; code is the way to go and much easier IMHO.
Click to expand...
Click to collapse
Agreed, doing it via code with a very basic XAML based page is likely to be faster, and will actually work. It's also a lot easier to fix things than trying to work out what went wrong in XAML you can't see...
I would agree with the statement that creating the controls dynamically would be faster. And def a great deal easier to read It just bugs me when I know this can be accomplished, yet I cant get it to work
Blade0rz said:
Sounds like what you really want to do is dynamically create controls in the code-behind. I would forget about generating "XAML".
Code:
private void AddTextboxesFromCSV(string[] CSVData) {
foreach(string str in CSVData) {
TextBlock tb = new TextBlock();
tb.Name = "txtUserSelectedValue" + CSVData.IndexOf(str);
tb.Text = str;
<YourObject>.Controls.Add(tb);
}
}
Where <YourObject> is the object you want to place the controls into, some sort of layout Panel.
Click to expand...
Click to collapse
Well that worked very well, thanks! I am having a little formatting issue .. my textblocks show up right on top of each other. any ideas?
Thanks again
Knudmt said:
Well that worked very well, thanks! I am having a little formatting issue .. my textblocks show up right on top of each other. any ideas?
Thanks again
Click to expand...
Click to collapse
I solved this silly issue. just added a listbox control to the xaml front end and added my elements with an ugly cast
listbox1.items.add((TextBlock)myBlock);
Knudmt said:
I solved this silly issue. just added a listbox control to the xaml front end and added my elements with an ugly cast
listbox1.items.add((TextBlock)myBlock);
Click to expand...
Click to collapse
If you had a StackPanel as the parent control, you could have each new textblock stacked...
I have been using ChevronWP7 for more than a month now and I was always wondering how does it work?
I tried to follow the obfuscated code in Reflector but it's really a mess and needs a lot of time and effort to follow the code's logic.
Aside from the code part, it seems that it changes the hosts file under C:\Windows\System32\drivers\etc to something like this
192.168.2.13 developerservices.windowsphone.com
172.26.68.53 developerservices.windowsphone.com
192.168.1.20 developerservices.windowsphone.com
So if anyone is working (has worked) on this, it would be great if you guys share your findings with the community here.
Thank you.
EDIT:
I am not sure if you guys have already seen the Windows Phone Developer Registration program that comes with the SDK or not (I didn't!!! for 3 months), but ChevronWP7 is just that program without the live services authentication! it is that simple, and you can see the source code with reflector
Basically the app does the flowing:
it uses a TcpClient to communicate with the phone over port 27077
PHP:
this.client = new TcpClient();
this.client.SendTimeout = 2000;
this.client.ReceiveTimeout = 2000;
this.client.LingerState.Enabled = true;
this.client.LingerState.LingerTime = 0;
this.client.NoDelay = true;
this.client.Connect("127.0.0.1", 27077);
To check the status of the phone:
it sends this byte array
PHP:
byte[] buffer = new byte[4];
buffer[0] = 16;
buffer[1] = 1;
this.commandData = buffer;
To Unlock the phone :
it sends this byte array
PHP:
List<byte> list = new List<byte>();
ASCIIEncoding encoding = new ASCIIEncoding();
ushort num = (ushort)(((authToken.Length + 3) + 2) + 3);
list.AddRange(new byte[] { 16, 3 });
list.AddRange(BitConverter.GetBytes(num));
list.Add(1);
list.AddRange(BitConverter.GetBytes((ushort)authToken.Length));
list.AddRange(encoding.GetBytes(authToken));
list.Add(2);
list.AddRange(BitConverter.GetBytes((ushort)2));
ushort num2 = isInt ? ((ushort)0) : ((ushort)1);
list.AddRange(BitConverter.GetBytes(num2));
[COLOR="red"]this.commandData[/COLOR] = list.ToArray();
An http server is made to listen for any requests that come from the phone (which were redirected in the system\hosts file to 127.0.0.1) and returns as a response :
PHP:
<ResponseOfRegisteredDeviceStatus xmlns="Microsoft.WindowsMobile.Service.Marketplace" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><ResponseCode>0x00000000</ResponseCode>
<ResponseMessage i:nil="true"/>
<Entity xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.WindowsMobile.Service.Marketplace.BLLDevPortal.Entities">
<a:DaysLeft>365</a:DaysLeft>
<a:AppsAllowed>10</a:AppsAllowed>
</Entity>
</ResponseOfRegisteredDeviceStatus>
The number <a:AppsAllowed> is the number of allowed apps, discussed here in the changed version without the side limit.
To lock the phone :
PHP:
internal LockCommand(string authToken)
{
List<byte> list = new List<byte>();
ASCIIEncoding encoding = new ASCIIEncoding();
ushort num = (ushort) (authToken.Length + 3);
list.AddRange(new byte[] { 16, 2 });
list.AddRange(BitConverter.GetBytes(num));
list.Add(1);
list.AddRange(BitConverter.GetBytes((ushort) authToken.Length));
list.AddRange(encoding.GetBytes(authToken));
this.commandData = list.ToArray();
}
Doesn't matter, next update will nullify it.
First of all, ChevronWP7 is a cool utility, but I don't understand why did they obfuscate the ripped M$ code. Yes the device communication part which is obfuscated it ripped from the Deployment Developer Tool.
Generally speaking this is what ChevronWP7 does:
- Rewrites the host file to redirect the developerservices.windowsphone.com address to localhost
- Bring up a HTTP server with it's own certificate to support HTTPS
- For the query during unlock operation the HTTP server sends back a baked in answer as a result of a successful unlock.
ChevronWP7 does exactly what the deployment tool do, but bypassing the windows live login.
Thanks,
Attila
WithinRafael said:
Doesn't matter, next update will nullify it.
Click to expand...
Click to collapse
How do you know that?
Anyways, I am also checking inside Chevron utility.
To unlock your phone, they send this:
Code:
10032200011A00436F6F6B69653A20486920436861726C6965204B696E64656C210202000100
Code:
.."....Cookie: Hi Charlie Kindel!.....
As a networkStream using this TcpClient:
Code:
chevronTCPClient.SendTimeout = 0x1388;
chevronTCPClient.ReceiveTimeout = 0x1388;
chevronTCPClient.LingerState.Enabled = true;
chevronTCPClient.LingerState.LingerTime = 0x1388;
chevronTCPClient.NoDelay = true;
chevronTCPClient.Connect("127.0.0.1", 0x69c5);
To relock the phone, the data is very similar, its shorter:
Code:
10021D00011A00436F6F6B69653A20486920436861726C6965204B696E64656C21
Also with the joke to Charlie Kindel.
Late to the party, guys
Google Cache because I must get my site up again sometime soon.
hounsell said:
Late to the party, guys
Google Cache because I must get my site up again sometime soon.
Click to expand...
Click to collapse
Meh, you edited a string
As Raf says, this won't work with the first update.
I thought the CheveronWP7 people were talking to Microsoft about allowing sideloading without the need to hack the phone.
Or was that just some BS from Microsoft to get the CheveronWP7 people to shut down their tool?
jfwfreo said:
was that just some BS from Microsoft to get the CheveronWP7 people to shut down their tool?
Click to expand...
Click to collapse
Probably.
Someone will always find a way though. This is the same dance jailbreakers go through with Apple.
FYI "WithinRafael" + "walshieau" + Long Zheng = ChevronWP7 people.
I am not sure if you guys have already seen the Windows Phone Developer Registration program that comes with the SDK or not (I didn't!!! for 3 months), but ChevronWP7 is just that program without the live services authentication! it is that simple, and you can see the whole source code with reflector.
I'm kinda unimpressed now
martani said:
I am not sure if you guys have already seen the Windows Phone Developer Registration program that comes with the SDK or not (I didn't!!! for 3 months), but ChevronWP7 is just that program without the live services authentication! it is that simple, and you can see the whole source code with reflector.
I'm kinda unimpressed now
Click to expand...
Click to collapse
Huh? Have you actually seen the code in reflector?
walshieau said:
Huh? Have you actually seen the code in reflector?
Click to expand...
Click to collapse
Well, when I was looking at Chevron's code, I was kinda skeptic on how the hell did these guys knew the series of bytes to send to the device to unlock, it doesn't make sense. (I even thought that MS would have a hand in this for advertisement stuff )
But well, now with Windows Phone Developer Registration under Reflector, everything is clear
martani said:
Well, when I was looking at Chevron's code, I was kinda skeptic on how the hell did these guys knew the series of bytes to send to the device to unlock, it doesn't make sense. (I even thought that MS would have a hand in this for advertisement stuff )
But well, now with Windows Phone Developer Registration under Reflector, everything is clear
Click to expand...
Click to collapse
Dude, it isn't that simple.
walshieau said:
Dude, it isn't that simple.
Click to expand...
Click to collapse
Can you elaborate more what's complicated besides the commands sent to the phone (that were already on the MS app)?
Redirecting a faked answer to the phone over an http server is not the hardest thing ever I think!
walshieau said:
Dude, it isn't that simple.
Click to expand...
Click to collapse
Martani is right. I am impressed to see the official unlocking tool. Chevron tool look so unimportant now! This isn't a hack or a "jailbreak", MS let us to do this very nice!
WithinRafael said:
Doesn't matter, next update will nullify it.
Click to expand...
Click to collapse
the next update won't nullify it.
I love how everyone is questioning the guys that wrote the tool and the ones that have actually spoken to the MS folks. Classic.
martani said:
Can you elaborate more what's complicated besides the commands sent to the phone (that were already on the MS app)?
Redirecting a faked answer to the phone over an http server is not the hardest thing ever I think!
Click to expand...
Click to collapse
Just because something is obvious when you reverse engineer it doesn't mean it wasn't hard.
RustyGrom said:
I love how everyone is questioning the guys that wrote the tool and the ones that have actually spoken to the MS folks. Classic.
Click to expand...
Click to collapse
i have to agree with rusty ..... give them their credit instead of trying to tear them down just to boost your own ego... theres room for everyone and their homebrews... no need to knock any of them... everyone that has contributed has done a great job...
i mean knocking these guys is like knocking henry ford just because someone figured out how he made the cars and thought they could do it themselves...
its easy to tear something down and figure out what makes it tick, but to make it from scratch with no instructions.... walshie ,long, and raphael ... i applaud your efforts and appreciate what you gave us.... THANK YOU!
im just saying...
martani said:
I am not sure if you guys have already seen the Windows Phone Developer Registration program that comes with the SDK or not (I didn't!!! for 3 months), but ChevronWP7 is just that program without the live services authentication! it is that simple, and you can see the whole source code with reflector.
I'm kinda unimpressed now
Click to expand...
Click to collapse
ChevronWP7 isn't a re-badged version of the official Microsoft tool; I should know. I have the code. To suggest otherwise is quite a slap in the face. You're presenting only a small piece of the puzzle here. For example, you conveniently skip over the reverse engineering effort required to get the response XML.
Of course the command pieces of the code looks the same -- it's a protocol.
In my search to find out a good way (or any way) to post comments on a wordpress article using C# on windowsphone, someone suggested looking into XML-RPC.
Ive done a search & it looks like the right lines, but I have no idea how to actually use it.
Anyone fancy giving me a little example or some sort of push in the right direction about how I can use XML-RPC in my WP7 app.
cris_rowlands said:
In my search to find out a good way (or any way) to post comments on a wordpress article using C# on windowsphone, someone suggested looking into XML-RPC.
Ive done a search & it looks like the right lines, but I have no idea how to actually use it.
Anyone fancy giving me a little example or some sort of push in the right direction about how I can use XML-RPC in my WP7 app.
Click to expand...
Click to collapse
XML-RPC is just reading/writing XML. You could easily just use the built-in Xml classes to build your XML, then use the WebClient to post/receive it from the server. You can use the spec from here to see what XML needs to be generated:
http://www.xmlrpc.com/spec
I don't know of any complete libraries for Windows Phone 7 right now, but you can check this out to get you started:
http://xml-rpc.net/
I've used this silverlight lib called xmlrpc-silverlight. It can be found on google code.
It works perfectly on wp7.
Best regards,
Mateusz
emfor said:
I've used this silverlight lib called xmlrpc-silverlight. It can be found on google code.
It works perfectly on wp7.
Best regards,
Mateusz
Click to expand...
Click to collapse
This will come in handy for one of my projects also, thanks for this!
emfor said:
I've used this silverlight lib called xmlrpc-silverlight. It can be found on google code.
It works perfectly on wp7.
Best regards,
Mateusz
Click to expand...
Click to collapse
Thanks
I found this here: http://code.google.com/p/xmlrpc-silverlight/
But it doesnt seem to have any downloads or code to actually use
Dont suppose you have a copy of it still?
I have too few posts... On the page, go to "Source" tab, than "Browse" and in the "trunk" folder there is file XmlRpc.cs - that's it!
Best regards,
Mateusz
thank you thank you thank you
Found it! Now Im gonna play with it a bit & see if I can get this working ;D
Well, Ive played with it a bit & I think I understand some of it, but I really have never used XML-RPC before & cant get it to work
Any chance you could give me a hint as to how I could post a comment to (for example) this page: http://www.1800pocketpc.com/2011/02/03/fireworks-an-amazing-free-app-for-windows-phone-7.html
Its just a random post from the site Im creating the app for.
On the wordpress page about XML-RPC it says this:
wp.newComment
Create new comment.
If you want to send anonymous comments, leave the second and third parameter blank.
Parameters
■ int blog_id
■ string username
■ string password
■ int post_id
■ struct comment ■ int comment_parent
■ string content
■ string author
■ string author_url
■ string author_email
Return Values
■ int comment_id
Click to expand...
Click to collapse
Sadly Im not quite sure what to do with that. Plus I havent a clue what the "blog_id" or "post_id" would be :/
Ive been coding for 4 years & I still feel like a total newbie half the time >_<
I think something like that shoud work:
Code:
XmlRpcService service = new XmlRpcService("Url_to_the_service");
XmlRpcRequest req = new XmlRpcRequest(service, "wp.NewComment", new object[] {
1,
"UserName",
"Pass",
1,
?,
1,
...
});
req.XmlRpcCallCompleteHandler
+= new XmlRpcCallComplete(req_XmlRpcCallCompleteHandler);
req.Execute(null);
generally this should work. There is an struct element, so you should implement this struct in C# and pass it there...
I don't know WP so i can't help with parameters meaninig...
Good luck!
Best regards,
Mateusz
During working on my project, I wrote (for testing purpose and for the future integration), a small test application called SkyDriveBrowser. I hope, source code of this project will be interesting and helpful to novice programmers.
Code is very simple (nothing fancy or colorful ) and demonstrates a few basic techniques to work with SkyDrive using MS Live component for WP7.
For my own purposes, SkyDriveItem class pay some attention to the archives, you don't need that part.
Code is completely free; you may use it in your commercial or fun projects without any limitations even mentioning my name in about box! Enjoy!
UPDATE: I've added compiled .xap to the archive.
Can you post some screenshot ?
wpxbox said:
Can you post some screenshot ?
Click to expand...
Click to collapse
I can but it has no sense at all. My post for developers only; it's not a complete app but useful piece of code. BTW, archive already contains a compiled .xap; you may sideload it to phone/emulator and play yourself
Oh Ok. Got it Thanks
hello i wanted to know how exactly should i write it down so that i can make different situations for example
if its x=1 new address else if x=2 new address else if x=3 new address and etc
i think im having problem with the $ placement, i wrote
$x=0?*b*/sdcard/*/b*:x=2?*b*/sdcard/*/b*:x=30?*b*/sdcard*/b*$
the /sdcard/ was just example i did include the real address on the code
where ever you see * i meant [ or ] it just xda forum changes it to BOLD so i couldnt write and after [/b
vitalero said:
hello i wanted to know how exactly should i write it down so that i can make different situations for example
if its x=1 new address else if x=2 new address else if x=3 new address and etc
i think im having problem with the $ placement, i wrote
$x=0?*b*/sdcard/*/b*:x=2?*b*/sdcard/*/b*:x=30?*b*/sdcard*/b*$
the /sdcard/ was just example i did include the real address on the code
where ever you see * i meant [ or ] it just xda forum changes it to BOLD so i couldnt write and after [/b
Click to expand...
Click to collapse
Zooper doesn't support nested conditions, so you can't to if-else conditionals. As long as your situations are not overlapping and only one condition is true at the same time, you can just write them as multiple single conditionals to work around this.
could you give me an example? i made 10 different situations and only 1 can be true at each time
and each time that it changes it takes a different file with the [/b command
vitalero said:
could you give me an example? i made 10 different situations and only 1 can be true at each time
and each time that it changes it takes a different file with the [/b command
Click to expand...
Click to collapse
Something like this:
Code:
$#situation#=1?<whatever you want for that condition>$
$#situation#=2?<whatever you want for that condition>$
$#situation#=3?<whatever you want for that condition>$
$#situation#=4?<whatever you want for that condition>$
...
This is obviously just an example to give you the general idea. I'm sure you are able to work your conditions and output into it
Thanks mate works just fine