Note that there are some explanatory texts on larger screens.

plurals
  1. POMVVM with webservice
    primarykey
    data
    text
    <p>I'm going to do a wpf application using MVVM(It based on <a href="http://www.codeproject.com/KB/WPF/MVVMQuickTutorial.aspx" rel="nofollow noreferrer">http://www.codeproject.com/KB/WPF/MVVMQuickTutorial.aspx</a> ). </p> <p>This application will be connecting with webservice one per month.</p> <p>On webservice I have contract </p> <pre><code>public class Student { public string Name {get; set;} public int Score {get; set;} public DateTime TimeAdded {get; set;} public string Comment {get; set;} } </code></pre> <p>In WPF application Adding, and removing students will be saving to xml file.</p> <p>So at wpf application Student would be something like :</p> <pre><code>public class Student { public string Name {get; set;} public int Score {get; set;} public DateTime TimeAdded {get; set;} public string Comment {get; set;} public Student(string Name, int Score, DateTime TimeAdded, string Comment) { this.Name = Name; this.Score = Score; this.TimeAdded = TimeAdded; this.Comment = Comment; } } public class StudentsModel: ObservableCollection&lt;Student&gt; { private static object _threadLock = new Object(); private static StudentsModel current = null; public static StudentsModel Current { get { lock (_threadLock) if (current == null) current = new StudentsModel(); return current; } } private StudentsModel() { // Getting student s from xml } } public void AddAStudent(String Name, int Score, DateTime TimeAdded, string Comment) { Student aNewStudent = new Student(Name, Score, TimeAdded, Comment); Add(aNewStudent); } } </code></pre> <p>How connect this two classes ?</p> <p>The worst think I guess is that contract Student from webservice would be use in this wpf application to get students from xml, in other application collection of studetns would be getting from database.</p> <p>I'm newbie in design patterns so it is very hard for me :/</p> <p>Example: I click AddUser, and in application A it calls webservice method which adding user to database, in application B it adds user to XML file, and In application. Base class are contracts at webservice.</p> <p>Next explanation:</p> <p>First application uses webservice to save data at database. Second application never save data in xmls and one perm month send this xmls to webservice and convert their to intances of students and save it at database</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload