Exemplo n.º 1
0
 public static async Task<ObservableCollection<Document>> getAllDocumentsAsync(Cours cours)
 {
    String result = await ClarolineClient.Current.makeOperationAsync(SupportedModules.CLDOC, SupportedMethods.getResourcesList, cours);
    ObservableCollection<Document> docs =  JsonConvert.DeserializeObject<ObservableCollection<Document>>(result);
    foreach (Document doc in docs)
    {
        doc.Group = cours.AllResources.First(val => val.ID.Equals("document"));
    }
     return docs;
 }
Exemplo n.º 2
0
 public static async Task<ObservableCollection<Annonce>> getAllAnnouncesAsync(Cours cours)
 {
     String result = await ClarolineClient.Current.makeOperationAsync(SupportedModules.CLANN, SupportedMethods.getResourcesList, cours);
     ObservableCollection<Annonce> ann = JsonConvert.DeserializeObject<ObservableCollection<Annonce>>(result);
     foreach (Annonce annonce in ann)
     {
         annonce.Group = cours.AllResources.First(val => val.ID.Equals("annonce"));
     }
     return ann;
 }
        /// <summary>
        /// Remplit la page à l'aide du contenu passé lors de la navigation. Tout état enregistré est également
        /// fourni lorsqu'une page est recréée à partir d'une session antérieure.
        /// </summary>
        /// <param name="navigationParameter">Valeur de paramètre passée à
        /// <see cref="Frame.Navigate(Type, Object)"/> lors de la requête initiale de cette page.
        /// </param>
        /// <param name="pageState">Dictionnaire d'état conservé par cette page durant une session
        /// antérieure. Null lors de la première visite de la page.</param>
        protected override void LoadState(Object navigationParameter, Dictionary<String, Object> pageState)
        {
            currentCours = navigationParameter as Cours;

            if (currentCours != null)
            {
                this.DefaultViewModel["Groups"] = currentCours.AllResources;
            }

            //Cours.getCompleteCourseAsync(currentCours);
        }
Exemplo n.º 4
0
        public async Task<string> makeOperationAsync(SupportedModules module, SupportedMethods method, Cours reqCours = null, string resStr = "", bool forAuth = false)
        {
            if (IsNetworkAvailable() && (forAuth || await isValidAccountAsync(forAuth)))
            {
                PostDataWriter args = new PostDataWriter() { module = module, method = method, cidReq = reqCours, resStr = resStr };

                String strContent = "";
                try
                {

                    strContent = await getResponseAsync(args);
#if DEBUG
                    Debug.WriteLine("Call for :" + module + "/" + method + "\nResponse :" + strContent + "\n");
#endif
                }
                catch (Exception ex)
                {
                    lastException = ex;
                }
                return strContent;
            }
            else
            {
                lastException = new NetworkException("Network Unavailable");
                return null;
            }
        }
Exemplo n.º 5
0
        public static async Task<Cours> getCompleteCourseAsync(Cours cours)
        {
            String result = await ClarolineClient.Current.makeOperationAsync(SupportedModules.USER, SupportedMethods.getCourseToolList, cours);

            try
            {
                JsonTextReader reader = new JsonTextReader(new StringReader(result));
                while (reader.Read())
                {
                    if (reader.Value != null)
                    {
                        switch (reader.Value.ToString())
                        {
                            case "isAnn":
                                reader.Read();
                                cours.AllResources[0].isRes = (bool)reader.Value;
                                break;
                            case "annNotif":
                                reader.Read();
                                cours.AllResources[0].resNotif = (bool)reader.Value;
                                break;
                            case "isDnL":
                                reader.Read();
                                cours.AllResources[1].isRes = (bool)reader.Value;
                                break;
                            case "dnlNotif":
                                reader.Read();
                                cours.AllResources[1].resNotif = (bool)reader.Value;
                                break;

                        }
                    }
                }

                cours.AllResources[0].Items.Clear();
                foreach (ItemModel item in (await Annonce.getAllAnnouncesAsync(cours)))
                {
                    cours.AllResources[0].Items.Add(item);
                }
                cours.AllResources[1].Items.Clear();
                foreach (ItemModel item in await Document.getAllDocumentsAsync(cours))
                {
                    cours.AllResources[1].Items.Add(item);
                }
            }
            catch (JsonException ex)
            {
                Debug.WriteLine(ex.Message);
            }

            return cours;
        }
Exemplo n.º 6
0
 public static async Task<Annonce> getSingleAnnounceAsync(Cours cours, int resID)
 {
     String result = await ClarolineClient.Current.makeOperationAsync(SupportedModules.CLANN, SupportedMethods.getResourcesList, cours, resID.ToString());
     return JsonConvert.DeserializeObject<Annonce>(result);
 }