Exemple #1
0
 /**These methods write and load a json array.
 * This allows the app to load more quickly.*/
 private void WriteJson(JsonArray data, MainActivity.MovieType type)
 {
     Task.Run(() => {
         File.WriteAllText(context.GetFileStreamPath(type.ToString() + ".json").ToString(),
                           data.ToString());
         var v = File.OpenWrite("");
     });
 }
Exemple #2
0
 private JsonArray LoadJson(MainActivity.MovieType type)
 {
     try {
         var str = File.ReadAllText(context.GetFileStreamPath(type.ToString() + ".json").AbsoluteFile.AbsolutePath);
         return((JsonArray)JsonArray.Parse(str));
     } catch {
         return(new JsonArray());
     }
 }
Exemple #3
0
        public void AddData(JsonArray a, MainActivity.MovieType type)
        {
            JsonArray write;

            switch (type)
            {
            case MainActivity.MovieType.ALSO:
                if (also.Equals(a))
                {
                    return;
                }
                write = also = a;
                break;

            case MainActivity.MovieType.OPEN:
                if (open.Equals(a))
                {
                    return;
                }
                write = open = a;
                break;

            case MainActivity.MovieType.TOP:
                if (top.Equals(a))
                {
                    return;
                }
                write = top = a;
                break;

            default:
                return;
            }
            WriteJson(write, type);
            NotifyDataSetChanged();
        }