Beispiel #1
0
        private void ShowFiles(string _path)
        {
            string pathFolder;

            string[] split;
            try {
                //geting and answer from server and write in the row
                string answer = jsonDeserializeFolder.Deserialize(_path).ToString();
                // parse answer
                jobject = JObject.Parse(answer);
                // geting parametrs from content folder
                var arrFolder = jobject.SelectToken("content");
                // geting list folders
                var listFolder = arrFolder.ToList();
                secondFolder = JsonConvert.DeserializeObject <Root>(answer);
                //get folder options
                for (int i = 0; i < listFolder.Count; i++)
                {
                    pathFolder        = listFolder[i].Path;
                    split             = pathFolder.Split('[', ']', '\'');
                    secondFolder.name = split[2];
                    //setup parametrs folder for display
                    secondFolderInfo.Add(new Folder {
                        name = secondFolder.name, birthtime = secondFolder.birthtime
                    });
                }
                secondListView.ItemsSource = secondFolderInfo;
            }
            catch (Exception ex) {
                labelFolder.Text = ex.Message;
            }
        }
Beispiel #2
0
        private void OnButtonClicked(object sender, EventArgs evevnt)
        {
            string pathFolder;

            string[] split;
            try {
                //Reading a response in a row
                string  answer    = jsonDeserialize.Deserialize().ToString();
                JObject jobject   = JObject.Parse(answer);
                var     arrFolder = jobject.SelectToken("content");
                // parse answer
                var listFolder = arrFolder.ToList();
                // geting parametrs from content folder
                folder = JsonConvert.DeserializeObject <Root>(answer);
                //get folder options
                for (int i = 0; i < listFolder.Count; i++)
                {
                    pathFolder  = listFolder[i].Path;
                    split       = pathFolder.Split('.');
                    folder.name = split[1];
                    //setup parametrs folder for display
                    folderInfo.Add(new Folder {
                        name = folder.name, birthtime = folder.birthtime,
                    });
                }
            }
            catch (Exception) {
                LabelMain.Text = "Oops! Something went wrong";
            }
            lstView.ItemsSource = folderInfo;
        }