« first day  last day (14 days later) » 

07:12
Hello Manuel! Hope you are not away.
Nope, I'm here ;)
Thats great! I'm still have the same eror: The type or namespace name 'HttpClient' could not be found(are you missing a using directive or an assembly reference?) This error I got for ApiController HttpClient HttpGetAttribute MediaTypeWithQualityHeaderVale MyObect StreamReader and Task
okay. As I wrote in my Mail: ApiController is from MVC WebAPI. This does not work within your WCF application. If you need to take WCF, I'm sorry, I can not help you here, since I have no experience with WCF.
Ok, I will start new phone app and everything should work nowl.
WCF is your webservice, not the phone app ;)
07:22
I meant solution, sorry.
Ah okay ;)
Got to learn alot.
Everyone has to :)
Okay from 11 Errors I got 3
ApiController, Httpget and HttpGGetAttribute, I think I should provide some using ?
Did you put the code for the apicontroller in the phone project?
07:27
well I put it in the mainpage.xaml.cs
Okay, well. To make clear. You want a Phone Application whichs get's its data from a webservice, correct?
Well currently I need to connect my sql server to Windows phone 8 app
where I can display the data
I don't mind which way.
Okay, so the best way is using a webservice here.
As I'm more into SQL Im lost and confused in creating this app.
Therefor you need to have the following: A solution with are phone project and a ASP.NET MVC 4 WebAPI project. Create them, if you don't have both of them
07:30
I tried to found some guides but in the end I got everything except displaying the data I even connected that with Sql thought
OK
When the MVC 4 asks me for template to select I should choose Mobile App right?
Nope
WebAPI
thanks and Engine should be Razor or ASPX?
Mobile App is for creating a website which will be surfed by mobile browsers.
oh tehhre is only RAzor
It does not matter, but take Razor
07:32
ok ok
Ok, Now I got PhoneApp1 and ASP.NET MVC 4 WebAPI - WebApplication1
in my solution
Ok
1
A: LongListSelector on WP8 linq-to-sql binding issue

RaubiEdit: Woops, I'm sorry, I didn't read that you are using WCF for this, since I thought WebAPI will be ok here (regarding to your question to web api and referencing your question here). But maybe you do not need to stick with WCF and can use other technologies? Marek, please take a look at http...

You need the ApiController and ListDTO
for the Web API Project
in this project there is a Controllers\ValuesController.cs
Overwrite the class with the one from my answer
Ok, thanks
Done, Got 0 Errors :)
Okay, then you need the ListDTO and the rest of the code for the phone porject
project*
Ok to be sure, this is how my ValuesController.cs should look like now:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Newtonsoft.Json;

namespace MvcApplication1.Controllers
{
public class ListController : ApiController
{
[JsonObject]
public class ListDTO
{
[JsonProperty]
public IEnumerable<string> Items { get; set; }
}

[HttpGet]
public ListDTO Get()
{
return new ListDTO()
{
Items = new List<string>()
{
"Item 1",
"Item 2",
},
};
}
}
}
right?
Jepp
may you use a github gist for posting code gist.github.com
07:45
Ok I will, thanks So now I should ListDTO and the other code what I havent used yet insert into MainPage.xaml.cs?
Correct
got 7 Errors atm - also with namespaces HttpClient etc.
Yes, you need to reference HttpClient via NuGet.
Just open NuGet, search for HttpClient and take the Microsoft Libraries for t
You mean like Manage Nuget Packages?
Yes
07:53
Is the correct one Microsoft ASP.NET web API Client Libraries?
One second
Seems correct, yes
But when I try to install it I can only select MvcApplication1 :/
it isn't correct richt?
But when I try Microsoft Http Client Libraries I can select both
Well, go with them, will work too :)
thanks, installed, does it have any using?
Sure :)
System.Net.Http
08:03
Ok I used also
System.Net.Http.Headers;
but still got namespace error for MyObject and StreamReader andTask :/
'System.Net.Http.HttpClient' does not contain a definition for 'DefaultRequest' and no extension method 'DefaultRequest' accepting a first argument of type 'System.Net.Http.HttpClient' could be found (are you missing a using directive or an assembly reference?)
The return type of an async method must be void, Task or Task<T>
and these 2
Jepp sorry. MyObject should be ListDTO
and LongListSelector does not contain Items:add
I think it should be LLS.DataContext?
or ItemsSource?
Okay, for the headers: Use DefaultRequestHeaders instead of DefaultRequest.Headers (I accidently inserted a dot)
Thanks, error is gone.
now there are 3 namespace errors for ListItem StreamReader and Task :/
Task is in System.Threading.Tasks
08:13
Thank you so much, what about Streamreader and ListItem?
StreamReader is System.IO
and should I replace this LLS.Items.Add(new ListItem(item));
with this?
LLS.DataContext = item;
Nope, replace the foreach with LLS.ItemsSource = theList.Items.ToList();
Ok now is everything error free
I'm gonna try to debug it, but how do I connect it to Sql Server? :-o
Well, for the first test, you can go without Sql Server.
08:18
Tried to debug that but got nothing on the MainPage except - My Application hdear and page name.
I think there should be item 1 adn item 2 right?
Not yet At first it does not execute the code at all. At second: Your webservice is not running yet.
Ok, I get that, thanks. but seems to work fine .
The solve the first problem: Switch to MainPage.xaml and insert Loaded="PhoneApplicationPage_Loaded" to the root element (phone:PhoneApplicationPage)
Ok, Got that.
If you set a breakpoint at the first line of the LoadFromWebservice method and start debugging, it should at least stop there. Please verify, so the code actually gets executed
08:26
Ok it will také a moment until my emulator runs.
Yes it stopped there, seems to work
when I try to continue an execution rises:
An exception of type 'System.NotSupportedException' occurred in mscorlib.ni.dll but was not handled in user code
Yes, that is correct. I can't work yet
Oh, NotSupportedException is not was I was excepting. But well, let's start up the Webservice it first.
Ok, sorry.
The fast solution is to start up another Visual Studio, open the same solution and select the web api proect as Startup Project and hit debug
with the same breakpoint at private asyns Task LoacFromWebservice?
The second visual studio will start the webservice, it will not execute the code from the phone project
Rightclick the webservice-project and select "Set as Startup Project"
08:31
It is ust page inspector right?
Yes Im debugging it right now
So a website came up in your internet browser?
Yes
ok, so please try to navigate to /api/list/get
so, the url is something like localhost:<port>/api/list/get
Somewhere in that output there should be "item 1" and "item 2"
I cant find that /api/list/get
I have here localhost:49611
this using (var result = await client.GetStreamAsync("list/get"))
this is what you meant?
localhost:49611/api/list/get
open this in your browser
08:37
in MainPage.xaml.cs
ok
it shows no results :/
What do you get now?
No results found for localhost:49611/api/list/get.
Can you show me the code of the controller again please?
Okay, I get this as output:
<ListController.ListDTO xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/MvcApplication1.Controllers">
    <Items xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <d2p1:string>Item 1</d2p1:string>
    <d2p1:string>Item 2</d2p1:string>
    </Items>
    </ListController.ListDTO>
What browser are you using?
08:42
I use IE..
Okay, IE forces to download the request. You should notice a flashing bar at the bottom of your browser, after surfing the url, which asks you to download the result
I wish I would see that
Do you have another browser installed?
Nope, Im on Windows Server 2012
I shouldn't install there any other browser, but unless this is working for you isn't it OK?
Oh yes, I forgot. That means you are having very hard restrictions when surfing websites. This could lead that IE does not do anything.
08:46
Maybe yes.
ok, so switch back to the phone project in the other visual studio
It poped up
i got that
I opened it in notebook
Set the BaseAddress to localhost:49611
got this
{"Items":["Item 1","Item 2"]}
yes, thats correct
08:47
the only thing I needed was http://
Oh, I forgot something :)
You can't use localhost, since the app is running in the emulator and the webservice is running on the host
You don't have a webspace with .NET 4.5 running, where you can deploy the webservice?
Oh ok, what do you mean by that ?
If it is possible can I deploy it on my webservice?
The problem is: If you are using "localhost" in the emulator, it is a reference to the emulator itself. But your webservice is running outside of the emulator, so the connection will not be possible.
So I have to create "webservice for that I can connect from whatever place" ?
Correct
08:59
Do we know how to do that ? :-o
Well I got Sql server can't I use its login information?
Hehe, no.
Well, what you need is a webspace running .NET 4.5. If you don't have one, we need to find out, how to get access from the emulator to your host machine
As I haven't used webspace running .NET 4.5 so I don't know if I have one but I believe I dnon't
Okay, then there is a bit more work to do
This is the official answer from Microsoft how to do it. It's written for WCF-Webservice, but don't care about this. What you need is the part where they set up the host to accept connection from the emulator
this ? To test connecting from the app running on the emulator to the local web service before configuring the solution
Yes. Otherwise you can't connect to the webservice from the emulator to your host machine
09:12
Ok I will read that and try to do that.
09:27
I failed here: 4.Find the IIS Express configuration file, applicationhost.config, in the following folder. The USERPROFILE environment variable typically has a value of C:\Users\<your user name>.
Im not sure how to continue
You are using Windows Server, therefore you dont use IIS Express, because you have IIS installed ;)
so I can skip this 4.?
¨So i think I should starrt over once again
09:44
I haven't done this before, because I'm deploying my webservice on my vServer, so I can access it from anywhere. :)
Well that is basically what I was doing all the time using WCF I have already project created like that.
So why can't you deploy the webapi webservice?
I'm not sure how to do that.
sorry.
Basically you create a website in IIS which is reachable from anywhere in the world and upload some files of the project
Ok, maybe I should learn first how to do this, this all without knowing is hard to do maybe.
09:57
Yes, this is a big thing, including a lot of different technologies
May I ask for one more thing ? May you please summarize this in some kind so I know what should I learn? I wouldn't waste your time anymore. Thanks a lot
Yes, I'm going to update my answer on Stack Overflow, but give me some time for this ;)
Ok, thank you so much for your time. I appreciate that so much.
You are welcome, but just wait a seond
second
Ok, thanks
10:05
In the meantime, to have a little result: marek.cheeseware.net/api/list/get
Oh whats that?
the webservice from my answer deployed on my server ;)
Thank you
1
A: LongListSelector on WP8 linq-to-sql binding issue

RaubiEdit: Woops, I'm sorry, I didn't read that you are using WCF for this, since I thought WebAPI will be ok here (regarding to your question to web api and referencing your question here). But maybe you do not need to stick with WCF and can use other technologies? Marek, please take a look at http...

I updated the code
for retrieving the items
I also added some more additional information at the end of my answer
10:22
Thank you so much Manuel!
You are welcome ;)
If it works, don't forget to accept the answer, so other people having the same problem, see which solution is working
oh, you already did :D
If you need further information, feel free to contact me
Yeah, you invested a lot of time into my problém you know a lot about this issue so not accepting an answer wouldnt be polite :D , thank you four your kindness.
I had much problems creating my first webservices which will be consumed by an app, so it's no problem helping you out here ;)
Ah, another information: In about a week I'm going to delete the webservice from my server, so don't use it too long ;)
Ok well I think Im going to learn from that
Now I need to create some reports for travel agency app Im gonna handle this problém tomorrow all day loong. Hope that it will be enough time to solve it.
Hehe, yes. :)
10:37
I was thinking about WP8 app which would display some basic data from sql
So I hope it is not that hard.
I have already found some in Store but you know that building your own is a good feeling :D
Jepp, this is true. Accessing a sql server directly from the app is not possible. Even if it is, you will never do it directly. Always go via a webservice.
Otherwise you would need to put in the login information for the server. This is a security problem
which can easily be avoided
Well the login information wouldn't be that big deal for me.
So as you said there is another way which would require fill login information for the server ? sounds interesting to me.
Oh, with the avoidance I just meant the webservice again :)
You will never put login information to some of your services directly into the app. ;)
Ok, I understand that. I was excited for few seconds that there is also another way. So I will deal with webservice tomorrow.
I was thinking about that my code was almost done that I posted as an answer. I followed WebService tutorials but failed when displaying data in long list selector
Yep, sometimes it's a bit harder to get the easy things done ;D
10:50
May I ask what do you think about that code :D?
because I have created WebService, DataClass everything what was needed :o
Sure ;)
If you could say from that what exactly might be missing?
Maybe I'm missing the context currently.
You want to say something about code: What code? :D
Because my ToursDataClass - where I have my one column from Sql is refered to WebService is refered to MainPage.xaml.cs
about this code if you would me so glad stackoverflow.com/questions/18254295/…
I mean about my code
ah okay
I already wrote it in my answer: I would not directly bind the webservice to the mainpage. Normally in WP8-Apps you build your apps with the MVVM architecture. You have a model, a view and a viewmodel.

The Model (in this case) is the data you get from the webservice. A view is your xaml-Page. Now you build another class, the viewmodel, which has all data the view needs. The ViewModel can request new data from the webservice and update it's internal list. The View will automatically update (since the viewmodel will implement the INotifyPropertyChanged interface).
That way, you have an extra abstraction layer. The big advantage is, that the model and viewmodel are normally independent and reusable. If you are writing the same app for Windows 8 and Windows Phone 8, you just have to write two different views. The ViewModel and Model are exact the same. That means, you only need to test it once, you only need to write the business logic once. Saves you a lot of work
I have to do the washing up, I'm back in some minutes
11:36
Thanks so much for this. I thought that only for private use on my WP8 it would be ok. I will follow your guide.
So, I'm back
Well, for private use only, okay. But it is still not possible g

« first day  last day (14 days later) »