Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > BOOK: Silverlight 4 Problem - Design - Solution
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #21 (permalink)  
Old August 18th, 2010, 03:48 PM
Registered User
 
Join Date: Jul 2010
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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();
Reply With Quote
  #22 (permalink)  
Old August 18th, 2010, 03:57 PM
Registered User
Points: 34, Level: 1
Points: 34, Level: 1 Points: 34, Level: 1 Points: 34, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2010
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
Reply With Quote
  #23 (permalink)  
Old August 18th, 2010, 03:59 PM
Registered User
Points: 34, Level: 1
Points: 34, Level: 1 Points: 34, Level: 1 Points: 34, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2010
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

oops...

http://www.developerfusion.com/tools.../csharp-to-vb/
Reply With Quote
  #24 (permalink)  
Old August 18th, 2010, 05:32 PM
Registered User
 
Join Date: Jul 2010
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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;
}

}
}
Reply With Quote
  #25 (permalink)  
Old November 9th, 2010, 03:26 AM
Registered User
Points: 11, Level: 1
Points: 11, Level: 1 Points: 11, Level: 1 Points: 11, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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:
  1. Upgrade to SQLServer 2008 R2, VWDE2010, WCF RIA 1.0 SP1 Beta, and WCF RIA Services Toolkit 1.0
  2. Download the Chapter 2.zip file, not the 'All New Code.zip' (tempting).
  3. Unblock the database files (right-click, Properties, Unblock)
  4. 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.
Reply With Quote
  #26 (permalink)  
Old May 21st, 2011, 10:39 AM
Registered User
 
Join Date: May 2011
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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.
Reply With Quote
  #27 (permalink)  
Old May 31st, 2011, 07:48 AM
Registered User
 
Join Date: May 2011
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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 View Post
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.
Reply With Quote
  #28 (permalink)  
Old May 31st, 2011, 09:03 AM
Wrox Author
 
Join Date: May 2009
Posts: 13
Thanks: 0
Thanked 2 Times in 2 Posts
Default 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.
Reply With Quote
  #29 (permalink)  
Old June 1st, 2011, 08:44 AM
Registered User
 
Join Date: May 2011
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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 View Post
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.
Reply With Quote
  #30 (permalink)  
Old October 2nd, 2011, 06:55 AM
Registered User
Points: 20, Level: 1
Points: 20, Level: 1 Points: 20, Level: 1 Points: 20, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2011
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

用下载的代码中的数据库文件建立数据库和表,我用的是sql 2008 完全版,很好。
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
File Downloads - Fix in Progress Teresa BOOK: Access 2003 VBA Programmer's Reference 0 June 7th, 2006 02:23 PM
Session Reuse Problem-- How to Fix CAHyatt Classic ASP Basics 5 June 1st, 2005 08:04 PM
Problem in making database file address virtual akhilvira ASP.NET 1.0 and 1.1 Basics 0 January 4th, 2005 01:33 AM
ASP Database Connection-File permission problem goljazoran Classic ASP Databases 4 November 29th, 2003 05:09 PM
ASP Database Connection-File permission problem goljazoran BOOK: Beginning ASP 3.0 0 November 10th, 2003 10:09 AM



All times are GMT -4. The time now is 08:12 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.