UXDialog Question

13 replies. Last post: December 6, 2010 9:01 AM by Jimmy Petrus
Tags :
  • New Discussion
  • New Question
  • New Product Feedback
Bill GowerMember

I am developing an app using the ideas presented in the Devforce-ClientUI sample application. From my UXWindow view MemberListView, the user clicks the Edit button to edit an existing member selected in a Grid. On the Member form which is a UXDialog, is a grid listing all the jobs held by the member. The user clicks add to add a new job for the member. The app creates a new job, grabs the next refno # from a table and calls the JobHistoryEditView UXDialog to allow for entry of the new job information. Since this is a Silverlight application, I am doing asynchronous queries. Unfortunately the dialog box is being called and instantiated before the jobhistory object is created is created and the program crashes.

To ensure that the object is created first and that the dialog box is not being called before I do the following.  I place the code to open the dialog editor immediately after the completed successfully routine. I think that this will ensure that the object is created first before the dialog box is called. Unfortunately the dialog box appears at runtime and then the OOB app gooes white and stops. I have a feeling that the program does not like a dialog box being called from where it is. Is that true? Is there a better way to ensure that the object is created first before the dialog box is called?

private void AddJob(object parameter)  //add button command

{

CreateJobHistory(CurrentMember);

}

 

public void CreateJobHistory(Member member)

{

IsBusy =
true; var coop = Coroutine.Start(() => JHRepository.CreateJobHistory(member));

coop.Completed += (sender, args) =>

{

if (args.CompletedSuccessfully)

{

newJob = coop.Result as JobHistory;

this.IsInEditing = true;

JobHistoryEditor.Open(

newJob,

() =>

{ // Ok callback

this.Jobs.Add(SelectedJob); this.SelectedJob = newJob;

CloseEditSession();

},

CloseEditSession); // Cancel

}

else

{

}

};

IsBusy =
false;

}

 

Here is my repository method

public IEnumerable<INotifyCompleted> CreateJobHistory(Member member)

{

var localInfoOp = Manager.LocalInfos.ExecuteAsync(); yield return localInfoOp; //Get first LocalInfo.NextJobHistRef and increment by 1 LocalInfo localInfos = localInfoOp.Results.First<LocalInfo>(); int nextRefNo = localInfos.NextJobHistRef;

localInfos.NextJobHistRef = nextRefNo + 1;

List<Entity> changedEntities = new List<Entity>();

changedEntities.Add(localInfos);

var saveOp = Manager.SaveChangesAsync(changedEntities);

saveOp.Completed += (sender, args) =>

{

if (args.CompletedSuccessfully)

{

}

else

{

}

};

// ////Create a new JobHistory JobHistory newJob = new JobHistory

{

SocSecNo = member.SocSecNo,

RefNo = nextRefNo,

Member = member

};

yield return Coroutine.Return(newJob);

}

All times are GMT -5. The time now is 3:34 AM.
Previous Next