Jul 7, 2008 in Twingly Summer of Code
I’m trying to get JSON information from a client that i parse and put in a ListBox. The list is populated as it should but when I run the code in debug mode i get “Async_ExceptionOccurred” on the bold line below which doesn’t seem right. I’ve got the idea that maybe I should use “DownloadStringAsync” instead of “OpenReadAsync” but I’m having problems implementing it. As you can see on the “searchUrl” line I’ve also tried to modify the Url, but then everything stops working which i can’t figure out either. I should get exactly the same type of json response from the server (I’ve checked) and the url works in my browser.
I would be very grateful for any help!
—- My code —-
public void SearchClick(object sender, RoutedEventArgs e)
{
resultList.Items.Clear();
string searchText = searchPhrase.Text;
string searchUrl = “http://webserver/search?q=” + HttpUtility.UrlEncode(searchText); //+ “%20type%3awebsite”;
//// Send HTTP request to the JSON search API
WebClient searchService = new WebClient();
searchService.OpenReadCompleted += new OpenReadCompletedEventHandler(DownloadStoriesCompleted);
try
{
searchService.OpenReadAsync(new Uri(searchUrl));
}
catch (Exception Async_ExceptionOccurred)
{
ytext.Text = Async_ExceptionOccurred.ToString();
}
}
void DownloadStoriesCompleted(object sender, OpenReadCompletedEventArgs e)
{
DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(MySearchResults));
blogResults = (MySearchResults)ser.ReadObject(e.Result);
if (blogResults != null)
{
foreach (SearchResult item in blogResults.items)
{
String titleToText = HttpUtility.HtmlDecode(item.title);
resultList.Items.Add(titleToText);
}
}
}
This post was written by Helena Mischel
Jul 2, 2008 in Twingly Summer of Code
So, I’ve skinned the interface and have added some more animations (not just eye candy actually, it is functional as well). However, it would be nice to make it “pop” a little bit more…
The effect I want is to have a element slide and then slow down a bit at the end of the animation. In Blend we have created states for the elements. In our code we use it in the following way:
VisualStateManager.GoToState(this, “NameOfState”, true);
Yay! Automatic animation ftw!
However… It is way to linear… We want more “umpf”
I have tried to edit the spline for the animation in Blend, but in our Silverlight project the animation is still played linear.
Any input is appreciated.
This post was written by Kristoffer Forsgren
Jun 26, 2008 in Twingly Summer of Code
Finally we arrived to Copenhagen, the trip went by just fine. The only problem with the actual trip was that we had to switch train in Malmö. The reason? They had some troubles with the speakers… The strange thing was that the speakers seemed to work just fine.
Anyway, we arrived to Copenhagen at 9.40 pm and began our walk towards the hotel we had made a reservation at. When we finally arrived to the hotel we got some bad news. Our reservation was cancelled.
Apparently they cancel the reservations if you haven’t checked in before 6 pm.
Oh, they had no room available any more either.
Bummer.
We had no choice but to walk towards the city center to find a hotel where we could sleep. Basically we had to walk all the way back to the railway station…
As you might have guessed we found one at last, but it seems as if almost every hotel was fully booked.
We will be back tomorrow with photos, more blog posts and other stuff. We’ll try to post videos as well.
Good night!
This post was written by Kristoffer Forsgren
Jun 25, 2008 in Twingly Summer of Code
So, I’m trying to slide down a canvas with text boxes and stuff using a storyboard with an animation.
Something like this: http://msdn.microsoft.com/en-us/library/cc189019(VS.95).aspx
So far I’ve managed to fade in the text box without the canvas, how I could do that is to me a mystery since the text box is inside the canvas. I’ve tried all kinds of logical and illogical things, nothing has worked. I’ve had contact whit a Microsoft evangelist and not gotten a answer. At one point my whole UI disappeared when i clicked on the tab. This is something that seems to be common reaction from Silverlight when it’s not satisfied with your code. I’ve managed to get the same effect (click -> disappeared UI) at least one time before when I was trying to figure something out and Kristoffer has had it to.
I’m just longing to find some logic in the silverlight code, every time I think I’m close I get slapped in the face. If you’ve found it, please let me know!
This post was written by Helena Mischel
Jun 24, 2008 in Twingly Summer of Code
Anyone who want to explain to me why the entire Silverlight object turns white when I set foreground color of a TextBlock to white? Shouldn’t it be only the TextBlock that gets affected by the following row?
titel.SetValue(TextBlock.ForegroundProperty, “#FFFFFFFF”);
Update
Problem solved:
SolidColorBrush white = new SolidColorBrush();
white.Color = Color.FromArgb(255, 255, 255, 255);
infoTitle.Foreground = white;
This post was written by Kristoffer Forsgren
Jun 16, 2008 in Twingly Summer of Code
If you have a digital camcorder it should be easy as pie to import it to your computer, right? In my opinion the process should look somewhat like:
- Start the computer (Duh!)
- Fire up the video software
- Power up the camcorder
- Connect the camcorder
- Import
In reality it doesn’t matter how I do. The video just won’t be imported. Period.
“No device found”… Well, I can see it, it’s right in front of me.
The camcorder is a Sony DCR-PC9E, the software is Sony Vegas Movie Studio 8.0. Is there anyone who can spot anything they have in common? Yep, both have the same manufacturer. It should work just fine, right?
If anyone has a tip on how to get it to work, make me happy and leave a comment
This post was written by Kristoffer Forsgren
Jun 10, 2008 in Twingly Summer of Code
I’ve finally succeeded with getting a dynamicly loaded image to move where the mouse clicks! It was not an easy task to solve, and at first I just managed to get a blue circle to move where the mouse is.
With this solved we can easily add MouseOver-effects and dynamicly load important images when the user moves the mouse over an “information”-area.
Here is an example:
First, create a new Silverlight project in Expression and save it. Edit the Page.xaml and add this:
Canvas HorizontalAlignment=”Stretch” VerticalAlignment=”Stretch” x:Name=”parentCanvas”
xmlns=”http://schemas.microsoft.com/client/2007″ Background=”Transparent”
MouseLeftButtonDown=”parentCanvas_MouseLeftButtonDown”/>
Add that code between <Grid x:Name=”LayoutRoot” Background=”White”> and </Grid>
Open the project in Visual Studio and write some code like this:
public partial class Page : UserControl
{
Image img1 = new Image();
double newX = 0;
double newY = 0;
public Page()
{
InitializeComponent();
img1.SetValue(Image.SourceProperty, new BitmapImage(new Uri(“picture.PNG”, UriKind.Relative)));
parentCanvas.Children.Add(img1);
}
private void parentCanvas_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
newX = e.GetPosition(null).X;
newY = e.GetPosition(null).Y;
Point myPoint = new Point();
myPoint.X = newX;
myPoint.Y = newY;
img1.SetValue(Canvas.LeftProperty, newX-50);
img1.SetValue(Canvas.TopProperty, newY-50);
}
}
Enjoy!
This post was written by Fredrik Smedberg
Jun 9, 2008 in Twingly Summer of Code
Hey guys!
After working a bit with the python library iGraph, which by the way is really nice, I realized that it wasn’t good enough for this project. The big drawback was that it wasn’t possible to just update the graph with a new node, without actual
ly changing the whole graph.
But I found this algorithm, that could work: Force Based Algorithm.

I’ll be back with an update, as soon as I’ve been able to take a further look into the algorithm, but here is a teaser of our brand new product.
This post was written by Jonas Kac