 |
BOOK: Silverlight 4 Problem - Design - Solution
 | This is the forum to discuss the Wrox book Silverlight 4 Problem - Design - Solution by Nick Lecrenski; ISBN: 9780470534045 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Silverlight 4 Problem - Design - Solution section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

August 18th, 2010, 02:48 PM
|
|
Registered User
|
|
Join Date: Jul 2010
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Step1 and step2 code .. when done in two steps works like a charm
Step1(On Intial Load):
Collection_VClient = new ObservableCollection<VClient>();
context = new BiscuitContext();
LoadOperation<VClient> loVClient = context.Load
(context.GetVClientsQuery()
);
grid_VClient.ItemsSource = loVClient.Entities;
Step2(On a button Click):
var entry = from c in context.VClients
where c.VCCLID == 307
orderby c.VCVAID, c.VCValue
select c;
foreach (VClient item in entry)
Collection_VClient.Add(item);
messageBox.Text = Collection_VClient.Count.ToString();
|
|

August 18th, 2010, 02:57 PM
|
|
Registered User
|
|
Join Date: Jul 2010
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I can convert from C# pretty well but haven't really tried the other way...
This converter gives generally good results, it might work for you also:
Pretty sure you can convert my code to C# there...
I found the code that I used as a basis for mine on this thread, it's in C#:
http://forums.silverlight.net/forums...23/250545.aspx
Look for a post by Colin Blair towards the end of thread...
Randy
|
|

August 18th, 2010, 02:59 PM
|
|
Registered User
|
|
Join Date: Jul 2010
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
|
|

August 18th, 2010, 04:32 PM
|
|
Registered User
|
|
Join Date: Jul 2010
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thank You Rich and Collin Very Very Much.. Works Like A Charm!!!
namespace BiscuitTwo.Views
{
public partial class Page_HowWorks : Page
{
private BiscuitContext context = new BiscuitContext();
ObservableCollection<Journal> Collection_Journal;
ObservableCollection<VClient> Collection_VClient;
ObservableCollection<Client> Collection_Client;
public Page_HowWorks()
{
InitializeComponent();
buttonCount.Click += new RoutedEventHandler(buttonCount_Click);
LoadData(null, null);
}
void buttonCount_Click(object sender, RoutedEventArgs e)
{
grid_Client.ItemsSource = context.Clients;
}
// Executes when the user navigates to this page.
protected override void OnNavigatedTo(NavigationEventArgs e)
{
}
private void LoadData(object sender, EventArgs args)
{
List<LoadOperation> loaderList = new List<LoadOperation>();
loaderList.Add(context.Load<VClient>(context.GetVC lientsQuery(), VClientDataLoadedCallback, loaderList));
loaderList.Add(context.Load<Client>(context.GetCli entsQuery(), LifeJournalDataLoadedCallback, loaderList));
loaderList.Add(context.Load<Journal>(context.GetJo urnalsQuery(), JournalDataLoadedCallback, loaderList));
}
private void VClientDataLoadedCallback(LoadOperation<VClient> lo)
{
CheckDataLoad(lo);
}
private void LifeJournalDataLoadedCallback(LoadOperation<Client > lo)
{
CheckDataLoad(lo);
}
private void JournalDataLoadedCallback(LoadOperation<Journal> lo)
{
CheckDataLoad(lo);
}
private void CheckDataLoad(LoadOperation lo)
{
List<LoadOperation> loaderList = lo.UserState as List<LoadOperation>;
((List<LoadOperation>)lo.UserState).Remove(lo);
if (loaderList.Count == 0)
LoadIsComplete();
}
private void LoadIsComplete()
{
whatsHappening.Text = "Data Loaded";
create_VClient(null, null);
create_Journal(null, null);
create_Client(null, null);
}
void create_Journal(object sender, EventArgs args)
{
Collection_Journal = new ObservableCollection<Journal>();
var entry = from c in context.Journals
where c.JOCLID == 307
orderby c.JODateEntered descending
select c;
foreach (Journal item in entry)
Collection_Journal.Add(item);
whatsHappening.Text = Collection_Journal.Count.ToString();
grid_Journal.ItemsSource = Collection_Journal;
}
void create_VClient(object sender, EventArgs args)
{
Collection_VClient = new ObservableCollection<VClient>();
var entry = from c in context.VClients
where c.VCCLID == 307
orderby c.VCVAID, c.VCValue
select c;
foreach (VClient item in entry)
Collection_VClient.Add(item);
whatsHappening.Text = Collection_VClient.Count.ToString();
grid_VClient.ItemsSource = Collection_VClient;
}
void create_Client(object sender, EventArgs args)
{
Collection_Client = new ObservableCollection<Client>();
var entry = from c in context.Clients
where c.CLID > 0
orderby c.CLID descending
select c;
foreach (Client item in entry)
Collection_Client.Add(item);
whatsHappening.Text = Collection_Client.Count.ToString();
grid_Client.ItemsSource = Collection_Client;
}
}
}
|
|

November 9th, 2010, 03:26 AM
|
|
Registered User
|
|
Join Date: Apr 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
can't get anything out of the database?
Just logging this here for clarity/ emphasis:
Got it to work just now. In order to do this I had to: - Upgrade to SQLServer 2008 R2, VWDE2010, WCF RIA 1.0 SP1 Beta, and WCF RIA Services Toolkit 1.0
- Download the Chapter 2.zip file, not the 'All New Code.zip' (tempting).
- Unblock the database files (right-click, Properties, Unblock)
- change User Instance=False to User Instance=True in Web.Config
Only took me a week to get to this point.
Do those 4 things and you will be romping home. Hope This Helps.
|
|

May 21st, 2011, 09:39 AM
|
|
Registered User
|
|
Join Date: May 2011
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Failed to create 'FitnessTrackerPlus database in SQL 2008 R2
Hi,
PS: I started with chapter # 3 as from here only the 'FitnessTrackerPlus' application code starts and was trying to attach the database file for this chapter only. Please correct me if i am doing it wrong?
Also, I downloaded the code and Database files from here -
http://www.wrox.com/WileyCDA/WroxTit...-DOWNLOAD.html
I recently bought this book but having hard time to run anything as when I tried to attach database I get the following error -
The database 'FitnessTrackerPlus' cannot be opened because it is version 655. This server supports 612 and earlier. A downgrade path is not supported. Could not open new database 'FitnessTrackerPlus'. Create Database us aborted. (Microsoft SQL Server error:948)
The version of SQL - SQL 2008 R2, 9.0.5000
I read this whole thread and tried soultions offere here but still no luck.
Can someone please provide me the scripts to create 'FitnessTrackerPlus' database? so that I can proceed learning from this book as right now i am stuck at chapter # 3.
Thanks for your help in advance.
|
|

May 31st, 2011, 06:48 AM
|
|
Registered User
|
|
Join Date: May 2011
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
FitnessTrackerPlus Database issue
Hi All,
I posted below around 10 days ago... and still no reply.
Can someone please help me out here? I am still stuck at chapter # 3.
I was wondering if the author of the book read this forum?
Quote:
Originally Posted by xaml
Hi,
PS: I started with chapter # 3 as from here only the 'FitnessTrackerPlus' application code starts and was trying to attach the database file for this chapter only. Please correct me if i am doing it wrong?
Also, I downloaded the code and Database files from here -
http://www.wrox.com/WileyCDA/WroxTit...-DOWNLOAD.html
I recently bought this book but having hard time to run anything as when I tried to attach database I get the following error -
The database 'FitnessTrackerPlus' cannot be opened because it is version 655. This server supports 612 and earlier. A downgrade path is not supported. Could not open new database 'FitnessTrackerPlus'. Create Database us aborted. (Microsoft SQL Server error:948)
The version of SQL - SQL 2008 R2, 9.0.5000
I read this whole thread and tried soultions offere here but still no luck.
Can someone please provide me the scripts to create 'FitnessTrackerPlus' database? so that I can proceed learning from this book as right now i am stuck at chapter # 3.
Thanks for your help in advance.
|
|
|

May 31st, 2011, 08:03 AM
|
|
Wrox Author
|
|
Join Date: May 2009
Posts: 13
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
Database Code
This error is a result of not attaching the mdf file with the same version of SQL Server that was used to create it. I have included database script files for all chapters in the following location:
http://media.wiley.com/product_ancil...D/Database.zip
You should be able to recreate the database for each chapter using the included script files.
|
|

June 1st, 2011, 07:44 AM
|
|
Registered User
|
|
Join Date: May 2011
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
UserService operation already in progress Error
Thanks a lot!! I was able to run the scripts for chapter # 3 without any issues. I appreciate your help.
I have one more question (I am newbie to RIA services..Aha thats why reading this book) -
When I click Login button on the prepopulated Login credentials, i get the below error -
System.InvalidOperationException was unhandled by user code
Message=UserService operation already in progress.
StackTrace:
at System.ServiceModel.DomainServices.Client.Applicat ionServices.AuthenticationService.StartOperation(A uthenticationOperation operation)
at System.ServiceModel.DomainServices.Client.Applicat ionServices.AuthenticationService.Login(LoginParam eters parameters, Action`1 completeAction, Object userState)
at FitnessTrackerPlus.Controls.Login.<.ctor>b__0(Obje ct se, RoutedEventArgs ev)
at System.Windows.Controls.Primitives.ButtonBase.OnCl ick()
at System.Windows.Controls.Button.OnClick()
at System.Windows.Controls.Primitives.ButtonBase.OnMo useLeftButtonUp(MouseButtonEventArgs e)
at System.Windows.Controls.Control.OnMouseLeftButtonU p(Control ctrl, EventArgs e)
at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)
InnerException:
I get the error at this code line -
Code:
WebContext.Current.Authentication.Login(new LoginParameters(EmailAddress.Text,
Password.Password), LoginCompleteCallback, null);
Do you think the prepopulated userID and PWD is not correct? Can you please provide the default login information?
Quote:
Originally Posted by nlecren
This error is a result of not attaching the mdf file with the same version of SQL Server that was used to create it. I have included database script files for all chapters in the following location:
http://media.wiley.com/product_ancil...D/Database.zip
You should be able to recreate the database for each chapter using the included script files.
|
|
|

October 2nd, 2011, 05:55 AM
|
|
Registered User
|
|
Join Date: Oct 2011
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
用下载的代码中的数据库文件建立数据库和表,我用的是sql 2008 完全版,很好。
|
|
 |
|